[cairo] cairo-pdf glyph positioning bug with librsvg

Emmanuel Pacaud emmanuel.pacaud at lapp.in2p3.fr
Mon Feb 18 00:24:28 PST 2008


Le dimanche 17 février 2008 à 20:32 -0500, Behdad Esfahbod a écrit :
> Ok, I've got a patch that mostly fixes this now.  The bug was simple:
> librsvg's Pango use was a mess.

Text rendering is the weakest part of librsvg (which is not surprising
since it's also the hardest part to implement...).

> My patch fixes most of the issues, but
> one still remains.  In particular:
> 
>   - In most places, librsvg was converting from PangoUnits to pixels,
> then using that as double.  That is, it was throwing away the fractional
> part of the size.  This only shows without metrics-hinting, that is,
> when rendering to PDF.  Fixed in the patch.
> 
>   - librsvg also was using the ink extents in some places where logical
> extents should be used.  Fixed in the patch.

That's something I'm interrested in. I'm currently implementing a
pango/cairo based mathml renderer, and I'm not really confident in my
use of the pango API. I guess I've not fully understood the difference
between logical and ink extents, and how to use them when you have to
manually position several pango layout in a single row. The pango
documentation lacks some explanation regarding extents.

>   - librsvg was not updating the pango context to match the cairo_t
> before doing measurements.  It only did after measurements where made
> and the layout was being painted.  This caused the measurements to be
> done with different font options than the actual rendering.  Fixed in
> the patch.
> 
>   - librsvg apparently breaks the text upon seeing the first non-ASCII
> text character.  I have no idea why that is.  I guess something to do
> with XML parsing.  This is why the bug looked so ridiculous, because the
> text was being rendered as two PangoLayout's, so it looked like it's a
> pango issue.  The bug will not be completely fixed until this issue
> exists.
> 
> CC'ing gtk-i18n-list and Dom.  Is there any better list to discuss
> librsvg?

There's the librsvg list on sourceforge, mostly used by spammers.

	Emmanuel.

-- 
Emmanuel PACAUD
Groupe Virgo
LAPP - Laboratoire d'Annecy-le-Vieux de physique des particules
9, chemin de Bellevue - BP 110
74941 Annecy-le-Vieux CEDEX
France
Tél: (+33)4 50 09 17 89 - Fax: (+33)4 50 27 94 95



More information about the cairo mailing list