[cairo] Rounding bug in cairo_ft_font.c

Keith Packard keithp at keithp.com
Sat Jan 8 17:15:15 PST 2005


Around 19 o'clock on Jan 8, Owen Taylor wrote:

> Spent time today getting basic Cairo/Pango integration working, and I
> noticed that rotated text was falling off the baseline for longer
> lines. The problem turned out to be accumulation of rounding error
> in cairo_xlib_surface.c. Attached patch seems to fix.

This is a minor part of a larger patch that I have here which tries to
resolve the metrics issue of transformed fonts.  I'm still not happy with
the result.  I think PostScript's answer might be a better long-term plan.
In that world, metrics are always returned in 'font space', that pre-scaled
world before the affine font and ctm transforms are applied.  

As FreeType applies only a scale factor to hinting computations, it's
actually pretty easy to get back to 'font space' from FreeType pixel space.
Whether that's useful is a different question -- right now, my patch 
actually scales but doesn't otherwise transform the metrics to user space, 
so "normal" text "just works", although any non-scaling transforms 
aren't reflected in the reported metrics.

I don't know if the rotated text alignment is entirely separate in my code 
from the other issues.

-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/20050108/2425e84e/attachment.pgp


More information about the cairo mailing list