[cairo] Text metric adventures

Keith Packard keithp at keithp.com
Tue Dec 28 11:57:35 PST 2004


Around 11 o'clock on Dec 28, Owen Taylor wrote:

> What about rounding advances to integer pixel amounts when hinting? If you
> don't do that and instead round positions for each glyph individually
> you'll get different results than Xft, etc. 

FreeType provides two sets of advances -- the linear advances which are 
unhinted linearly scaled values and the "normal" advances which come right 
out of the hinting engine. If the hinting engine snaps those to pixel 
boundaries (and I think they generally do), then our advances will exactly 
match those from Xft, assuming no post-scaling transform.

As the metrics I'm computing are all in 'glyph space' (currently scaled by 
the font scale factors), there isn't any non-scaling transforms applied to 
them.  This means that when you rotate the metrics, you'll end up with 
non-pixel grid aligned positions.  I think we have to use these and snap 
each glyph into position instead of snapping the metrics and leaving the 
baseline to wander all over the screen.  That Xft doesn't provide sub-pixel 
metrics for rotated text is not something I think we need to replicate in 
cairo.

I think we also want to stick both advance values into the glyph metrics 
returned to the application so that it can choose which to use.  With 
that, we could decide to snap any un-snapped metrics to pixel boundaries.

-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/20041228/598be224/attachment.pgp


More information about the cairo mailing list