freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] Sample TTF file?


From: Louis Desjardins
Subject: [ft-devel] Sample TTF file?
Date: Fri, 9 Sep 2011 13:00:32 -0700

Is there a sample TTF file available that I could use to test out my code using Freetype? 

Though none of my FT calls result in error, I end up getting zero for my FT_Bitmap width and rows, and am not sure if it's my code or the TTF that I'm using?

Thank-you!

FT_Library  library;
FT_Face     face; 
int error = FT_Init_FreeType( &library );
if( error != 0 )
{
printf("FT_Init_FreeType failed");
}

error = FT_New_Memory_Face( library, reinterpret_cast<const FT_Byte*>(buffer), fileSize, 0, &face );
if( error )
{
LOGI( "FT_New_Memory_Face failed ");
}
        FT_UInt iGlyphIdx = FT_Get_Char_Index( face, 0x020); 
if (iGlyphIdx == 0) 
LOGI("FT_Get_Char_Index failed");

error = FT_Load_Glyph( face, iGlyphIdx, FT_LOAD_DEFAULT );
if( error )
{
LOGI("FT_Load_Glyph failed");
}

error = FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL );
    if ( error )
{
LOGI("FT_Render_Glyph failed");
}

FT_GlyphSlot  slot = face->glyph;
FT_Bitmap *bitmap = &slot->bitmap;

int width = bitmap->width;
int height = bitmap->rows;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]