[cairo] Font interface problem

Bill Spitzak spitzak at d2.com
Tue Mar 9 14:43:16 PST 2004

On Tuesday 09 March 2004 01:21 pm, Maarten Breddels wrote:

> And, do you agree that fonts drawn with:
>   cairo_scale(2,2)
>   cairo_scale_font(2)
> Are '4' (whatever units) high, but it's a font of height 2, linearly
> scaled 2 times in x in y.
> While:
>   cairo_scale(1,1)
>   cairo_scale_font(4)
> Is a font of height 4, and isn't scaled.
> It matters(not that much though) because ttf(truetype fonts) are
> transformed (not necessarily linear) at different sizes to keep them
> readable. Currently they are both drawn as 4 units high, not scaled in
> any way.

I think fonts should be drawn identically for a given transform, no matter 
what portion of that transform is in the CTM and what part is in the font 

There should be seperate arguments to the font selector interface to indicate 
"draw as though you are N points tall". This is much more similar to setting 
the weight or other attributes of the font than to scaling.

There could be a "simple" font choosing interface that takes a "size" and 
sets the font matrix to that size and also sets the "draw as though you are N 
points tall" to the same value (or that value*96/72 to turn Cairo units into 
points on the assumption that the CTM is the default matrix). But internally 
this should be seperated as fast as possible.

PLEASE don't make the mistake of specifying the size of the font in "points" 
or any unit other than the CTM units. This makes it impossible to produce 
predictable graphics unless I go in and retrieve exactly how you map pionts 
to font matricies and then calculate the inverse, a total waste of time on 
everybody's part. If I want to take advantage of a font renderer that draws 
differently depending on the points, you should use a fixed and predictable 
way of turning the size into "points" (such as assumming that the CTM is 
1/96), or let me independently specify this "points" value, since I know the 
"point size" much better than Cairo does (I may be trying to actually draw a 
reduced-size image of the paper, for instance).

                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com

More information about the cairo mailing list