[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Example Code
From: |
Gaiser, Jason |
Subject: |
RE: Example Code |
Date: |
Wed, 2 Aug 2000 16:08:01 -0700 |
Well, what did you change!?!?
Also, I definitely agree that the current Freetype2 demo code is a bit
complicated. I think it would be nice to have some basic code that doesn't
even involve graphics (perhaps just rendering the bitmaps to memory, or, as
I did once to test things, just construct strings and printf the bitmap to
the screen :) ). Trying to understand both the freetype library AND the
demo code was a pain.
Just My Two Cents,
Jason
P.S. - Thanks for the great library guys!
-----Original Message-----
From: Kevin Dance [mailto:address@hidden
Sent: Wednesday, August 02, 2000 4:04 PM
To: address@hidden
Subject: Fw: Example Code
Sorry - please ignore the previous email since I have solved my problem
-----Original Message-----
From: Kevin Dance < address@hidden
<mailto:address@hidden> >
To: address@hidden <mailto:address@hidden> <
address@hidden <mailto: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...
{
FT_Library Library;
if (FT_Init_FreeType(&Library) == 0)
{
FT_Face Face;
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;
FT_UInt GlyphIndex;
int nX = 100;
int nY = 100;
unsigned char String[] = "TEST";
int nIndex = 0;
while (String[nIndex])
{
if (FT_Load_Char(Face,String[nIndex],FT_LOAD_RENDER) == 0)
{
Display( Slot->bitmap,
nX + Slot->bitmap_left ,
nY + Slot->bitmap_top );
nX += Slot->advance.x;
nY += Slot->advance.y;
}
nIndex++;
}
}
}
}
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
Kevin Dance