freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] the joys of FT_Set_Char_Size()


From: jonathan . foster
Subject: Re: [Freetype] the joys of FT_Set_Char_Size()
Date: Fri, 23 Jan 2004 12:07:40 +0000

Hi,

> To share a FT_Face object between multiple instances of that font face at
> differing sizes...
This is possible.  You can have many FT_Size objects (representing a
font at a specific size) for a single FT_Face.  See:
http://www.freetype.org/freetype2/docs/reference/ft2-sizes_management.html

>judicious use of a face cache and FT_Set_Char_Size().
If you are using a face cache, why not just use FTC_Manager_Lookup_Size()?
This should take care of caching FT_Size objects for you.  It also
activates the FT_Size for you, so you can just use the FT_Face as normal.
This is how I handle kerning.

Kind regards,

Jon Foster
--

Carsten Haitzler (The Rasterman) <address@hidden> wrote:

Ahh and so at long last it is that I would go through my code and fix a FIXME:
that has been lying around for many an age...

To share a FT_Face object between multiple instances of that font face at
differing sizes...

And behold did I marvel at the fact that the code worked. I was astounded that
it was almost flawless and "just worked (tm)". And it was then I basked in the
glory of the judicious use of a face cache and FT_Set_Char_Size().

But the gods did not want life to be this easy. They did gnash their teeth in
chagrin and thusly so sent their evil demons to the earth to lay waste to such
happiness. They did so on the day I ran my performance tests...

AAARGH!

(sorry about the over-dramatic prose).

So yes. I suspected FT_Set_Char_Size() would be a little nasty so I already
wrapped it so it would only call it *IF* the font face that was shared was
REALLY being used at a new size... even with this in, the performance hit was
shocking! But now instead I have to load the font face multiple times instead if
I use the same font at more than one size.

"Aaah but then just use a glyph and font metric cache yourself" I hear you say!
well - I already have a glyph cache. It's fast. I'm happy. I could add in glyph
metrics to it in a snap thus keeping calls to FT_Set_Char_Size() only when new
glyphs are generated. This should solve most of the deathly ills, except there
is a new little demon to deal with: KERNING! I would need a way of caching the
kerning information. I want to keep hinting - it looks much better. I want
kerning - it looks much better. I can keep my own cache of glyph and general
font metrics I use... EXCEPT for kerning. I cannot see a way of getting kerning
information out of freetype2 so I can make my own kerning table and thus not
have to call FT_Set_Char_Size() unless generating a new glyph bit/pixmap.

Soooo... after a lot of windy longs... you guys know freetype much better than I
- I'm asking... what do I do? How do I keep performance AND manage to share face
outlines and save extra loads and memory? Is my only choice to turn off kerning?
Is there something int the freetype api that lets me get some form of kerning
rule table per glyph (ie left if glyph = X, kerning modifiers are for right
glyph: Y = -2, Z = 1, A = 3, B = 5, G = 2, J = -2)... ?

It'd be really helpful to know what to do other than just shrug and go "either
load the font multiple times... or ditch kerning" :(

BTW. Thanks for all the code. Nice yummy stuff. So happy it exists. Good work!
:)

--
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    address@hidden
熊耳 - 車君 (数田)                  address@hidden
Tokyo, Japan (東京 日本)

_______________________________________________
Freetype mailing list
address@hidden
http://www.freetype.org/mailman/listinfo/freetype








reply via email to

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