freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] Small cache vs. Image cache


From: David Turner
Subject: Re: [Devel] Small cache vs. Image cache
Date: Mon, 27 Aug 2001 12:11:18 +0200

Hello Mike,

Mike Owens a écrit :
> 
> I have a couple of questions concerning the cache manager.
> 
> 1. Is there an advantage in using one cache verses the other?
> 2. Is one faster than the other.
> 3. Are they designed to be used together or can they be used independently?
> 4. Do I have to manage what glyphs are assigned to what cache or does the 
> cache system test for this in some way?

The image cache holds FT_Glyph objects, which by design can be in
any format. They're more flexible, but this comes at a price: an
overhead of about 24 bytes per glyph !!

The small bitmap cache holds "small bitmaps" objects. each one is
made of a small glyph descriptor (where the width/height/bearings/advance
are stored as 8-bit values) + the relevant glyph image bitmap/pixmap

Using a "sbit" cache to store glyph bitmaps is thus a lot more economical
in terms of memory. Which means you'll be able to store a lot more "sbits"
than FT_Glyph objects in a given cache pool (of constant size).

A typical application uses both caches in a single manager. Generally,
small glyph bitmaps (e.g. for character sizes < 32 pixels) are stored in
the "sbit" cache, while others (large bitmaps + outlines) are stored in
the "image" cache.

The application needs to select the cache dynamically when it needs to
render a given glyph (the cache sub-system doesn't deal with this at
all).

That's what "ftview" does, if you need example code..

Cheers,

- David



> Thanks for your help
> Mike Owens
> 
> _______________________________________________
> Devel mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel



reply via email to

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