[cairo] glyph caching
c99drn at cs.umu.se
Tue Apr 20 07:55:42 PDT 2004
I've implemented a simple glyph cache system for cairo's font interface.
The freetype cache system wasn't useful as it caches font faces and
glyph images. Cairo need to cache cairo surfaces.
My glyph cache system isn't font-backend specific. Future font-backends
can easily use it as well. It adds a new font backend function;
glyph_create. This function should create an image surface for a
specific glyph. If a font-backend implements this function it can use
the cairo_font_lookup_glyph function to get a mask surfaces for a glyph.
Caching is automatically handled in cairo_font.c.
Cache size is currently 256 glyphs for all fonts. A
cairo_font_set_cache_size might be useful.
I've also fixed so that glyph rendering in the freetype backend is now
done using FT_Outline_Get_Bitmap instead of FT_Render_Glyph. Freetype
can now always render directly to an image surface.
text performance with glyph caching:
image backend: ~20% faster than without
xlib backend: ~100% faster
gl backend: ~2200% faster
The patch can be found here:
David Reveman <c99drn at cs.umu.se>
More information about the cairo