[cairo] font lifetime

Bill Spitzak spitzak at d2.com
Thu Jan 27 11:55:55 PST 2005


I'm a little worried about the apparent design that exposes some sort of 
"object" for each possible font transform.

It is highly likely that future graphics implementations will render all 
letters larger than about 20 pixels by using the 3D hardware to 
texture-map a single large (like 128x128) rendering of the letter 
through an arbitrary transform, and will render sizes larger than 128 by 
actually filling the letter shape using the path-filling mechanism. 
Changing the transform will be absolutely free (in that drawing a letter 
with a different transform takes no more time than drawing it again with 
the same transform). I also suspect this will become the solution for 
all transforms smaller than some minimum size, and all non-right-angle 
rotations, any shears, and if screen resolution is raised to 180 dpi or 
so, it will replace ALL rendering of characters.

In this case trying to support some kind of object that remembers a 
transform and pointer to internal font is going to be a big piece of 
unnecessary overhead. It would be very bad if Cairo's design was 
compromised by obsolete hardware designs.

I would much prefer an API where you set the font using a string name, 
and you set the font transform, and then you ask for font metrics. The 
only assumption about the metrics is that if the same font and same 
transform is used you get the same results. Otherwise you should ask 
Cairo again. The Cairo implementation should do the necessary work to 
cache this correctly, rather than punting it to higher levels.





More information about the cairo mailing list