freetype
[Top][All Lists]
Advanced

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

Re: FreeType 2 Tutorial part 1.. Can't wait for part 2


From: David Turner
Subject: Re: FreeType 2 Tutorial part 1.. Can't wait for part 2
Date: Fri, 30 Jun 2000 17:56:15 +0200

Hi Harley,

Harley Blumenfeld a écrit :
> 
> I saw that in the docs section and found it very useful. Especially
> since I am in the process of converting my app from freetype 1.3.1 to
> freetype2.
> 
> I can't wait for part 2 which discusses kerning. Right now I am using
> a HUGE HACK for kerning.  Here is a snippet from my code :
> 
OK, just to inform you that FT_Get_Kerning has been recently modified
to include a new parameter that describe how the returned metrics
are scaled.. Have a look at the new "freetype/freetype.h" through
CVS (or ViewCVS) for more info :-)

> FT_Vector kerningVec;
> FT_Get_Kerning( m_face, codes[ i ], codes[ i+1 ],&kerningVec );
> if (m_face->size->metrics.x_scale != 0x10000)
> {
> kerningVec.x = FT_MulFix( kerningVec.x, m_face->size>metrics.x_scale );
> kerningVec.x = (kerningVec.x+32) & -64;
> }
> else
> {
> kerningVec.x = kerningVec.x >> 6;
> }
> 
> It seems that face->size->metrics.x_scale is always == 0x10000, so
> FT_MultFix doesn't do anything since it's operation is (a*b)/0x10000.
> This causes KerningVec.x to be too big. Is feels like a hack is this
> approach wrong?
> 
no, metrics.x_scale isn't always 0x10000. I'm really surprised
you get this value.. Are you sure, with which font ??

> Also - I am caching FT_Bitmaps and FT_BitmapGlyphs. How should I destroy
> these variables when I am done? The reason I am caching them is because
> my application uses the pixmaps as GL_ALPHA texture maps.
>
If you're using FT_BitmapGlyph objects (both in the old and new version
of ftglyph.h), you should call FT_Done_Glyph to get rid of the bitmap object,
including its buffer.

FT_Bitmap is just a bitmap descriptor. What do you mean way you say you
cache them, something like:

  - you load the glyph  (FT_Load_Glyph/FT_Load_Char)
  - you render it within the glyph slot (FT_Render_Glyph)
  - then what do you do ??

Best regards,

- David



reply via email to

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