[cairo] Font metrics under font transformations

Keith Packard keithp at keithp.com
Thu Jan 13 08:49:14 PST 2005


Around 16 o'clock on Jan 13, "Gustavo J. A. M. Carneiro" wrote:

>  I think most users don't want metrics to be affected by the CTM.

Right, that's a constant in all of the proposals.  We're only talking 
about the (separate) font transformation matrix.  This matrix is currently 
used to perform artificial obliquing by shearing the font; you could also 
use it to reflect the text across the X axis when inverting the cairo 
coordinate system to match PostScript.

> And they don't want vectorial metrics either.

That's my thinking.  We already have one vector -- the 'advance' value is 
split into separate X and Y values.  This was originally designed to 
support vertical text and has been taken over to also support rotated 
baselines when the font is transformed.  We could eliminate this and just 
draw text along the original baseline, but I don't know what the advance 
values should be in that case.

> My ideal API would be one that returned font metrics such that one could
> easily draw a bounding box around a label without knowing or caring about
> any transformation matrices in effect at the moment.

We have something that will draw a box around the label, but the box is 
always upright in user space (i.e. relative to the CTM), so it doesn't fit 
tightly around the glyphs when the font is transformed such that the 
baseline rotates.

I think this will work for most applications; those that want to use font 
transforms which affect the baseline and still want more accurate bounding 
boxes can compute the bounding box for the path containing the glyphs in 
whatever space they like.

The only remaining question is how to represent the line spacing values 
from the global font metrics.  I'm suggesting that we report the values 
normal to the baseline in user space as those will work for both the 
shear and mirror examples mentioned above.

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050113/58a73620/attachment.pgp


More information about the cairo mailing list