|Subject:||Fw: Example Code|
|Date:||Thu, 3 Aug 2000 00:04:03 +0100|
Sorry - please ignore the previous email since I have solved my problem
From: Kevin Dance <address@hidden>
To: address@hidden <address@hidden>
Date: 02 August 2000 23:33
Subject: Example Code
Has anyone got any example code on how to use the Freetype 2 library. I know that their are demos but this is too complicated for what I want to do.
All I want to do is to initialise the library, load a font and then create a bitmap for a particular character.
Take a look at the following...
if (FT_Init_FreeType(&Library) == 0)
if (FT_New_Face(Library,"arial.ttf",0,&Face) == 0)
if (FT_Set_Char_Size(Face,0,50*64,72,72) == 0)
FT_GlyphSlot Slot = Face->glyph;
int nX = 100;
int nY = 100;
unsigned char String = "TEST";
int nIndex = 0;
if (FT_Load_Char(Face,String[nIndex],FT_LOAD_RENDER) == 0)
nX + Slot->bitmap_left ,
nY + Slot->bitmap_top );
nX += Slot->advance.x;
nY += Slot->advance.y;
This should generate a bitmap of a character but the bitmap size is zero wide and has zero rows.
Could anyone tell me what I am doing wrong? Do I need to allocate the memory for the bitmap myself or is this done by the freetype library.
Thanks in advance
|[Prev in Thread]||Current Thread||[Next in Thread]|