[cairo] Rounding bug in cairo_ft_font.c

Keith Packard keithp at keithp.com
Sat Jan 8 20:37:21 PST 2005


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

> Postscript can get away with device independent metrics because it's
> only targeting the world of high resolution. And the very nature of
> Postscript is that you've done your layout before generating the 
> postscript file. I think we need metrics that take hinting into account.

I think you missed part of the earlier discussion...

The metrics are reported in 'font space', but computed in pixel space 
respecting all of the hints applied to the glyphs.

Part of that discussion also noted that having both 'hinted' and 'linear' 
metrics visible to applications is probably a good idea so that DTP 
applications can set text respecting linear glyph space at some 
appropriate level.

> But even given device-adjustment, the font space convention doesn't
> sound very convenient. If I'm trying to align some text, I want to
> know how big it is in user space.

But the metrics we return are nonsense except in font space; you have no 
basis for understanding what the 'height' means except as it relates to 
the font transformation.

> The Pango convention is user space with device adjustment; of course, 
> in Pango, you are frequently getting metrics of mixtures of different
> fonts in different sizes, so font space isn't even meaningful.

This is one reason why my weird 'scaled font space' works reasonably well; 
for the usual scale-only font transform, you get sensible values for the 
metrics and needn't translate between fonts differing only in size.

> Presumably, by far the most common case of non-scaling font transforms
> is artificial oblique. Especially if we allow transforms out of
> fonts.conf, I  don't see how we can get away without not adjusting the
> metrics.

For artificial oblique, the character and line spacing doesn't (have to) 
change, the only thing which does is the width of each character bounding 
box.  And, shearing the bounding box gives an inaccurate (sometimes wildly 
so) result.  We could just leave this to the PostScript model and let 
applications compute bound boxes by measuring the path of the glyphs...

> The patch I posted seems to help Pango quite a bit. Of course, what I
> have currently mostly reimplements metrics computations instead of using
> the Cairo functions. So, it's just rendering that needed fixing.

Right.  I think that may have been the only fix wrt rendering glyphs 
positioned by applications that I made, but my application was not 
manually positioning glyphs so I had a long list of problems before I got 
to the final relative positioning errors in the xlib backend...

-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/5660a1a6/attachment.pgp


More information about the cairo mailing list