freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] Font & Glyph caching


From: Eric Poulsen
Subject: Re: [Freetype] Font & Glyph caching
Date: 08 Oct 2002 09:35:43 -0700

On Tue, 2002-10-08 at 09:14, David Turner wrote:
> Eric Poulsen wrote:
> > I'm developing an application that only (currently) needs to do metrics
> > on fonts for layout purposes.  The app will not be rendering any text
> > directly.
> > 
> > I've written a class to cache fonts (load on demand), then I use 
> > FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT ) to load a glyph, and
> > measure it.
> > 
> > My question: Do I need to glyph caching if I'm not rendering the
> > glyphs?  
> > 
> Well, you'll need to cache the metrics :-)
> 
> Either implement your own cache, or simply use the glyph cache even if
> you only use the metrics..
> 
> Also, what kind of metrics do you need (expressed in font units, scaled,
> hinted, etc...)

David, 

Thanks for the reply.

I just need to measure the bounding box of strings of text for layout
purposes; word wrap & justification in order to create PostScript
files.  My app supports user-configurable metrics, though points (1/72
inch) are the unofficial default because that's what PS uses.  I'm not
sure what actual units the application will use internally -- I want to
avoid cumulative conversion errors if possible.

I've also implemented kerning, so I'm not sure if metric caching would
be all that efficient, given the high number of kerning pairs.  The
glyph caching would probably be good.

The crux of my problem is that I don't know what FT2 calls are
"expensive."  I was wondering if FT_Load_Glyph() is only expensive if
you're rendering ...

In any case, it would be simple to cache glyphs myself.

> 
> It's not possible to get the hinted metrics without loading the whole
> glyph. But you could store it in other places for frequent re-use..
> 
> Regards,
 





reply via email to

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