[cairo] cairo-pdf glyph positioning bug with librsvg

Behdad Esfahbod behdad at behdad.org
Sun Feb 17 17:32:34 PST 2008


Ok, I've got a patch that mostly fixes this now.  The bug was simple:
librsvg's Pango use was a mess.  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.

  - 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?


Cheers,

behdad

On Fri, 2008-02-15 at 16:55 -0500, Behdad Esfahbod wrote:
> On Fri, 2008-02-15 at 08:36 -0800, Carl Worth wrote:
> > Here's a bug report I just got that looks worth fixing.
> > 
> > Here's an SVG file:
> > 
> > 	http://cairographics.org/~cworth/images/svgtest.svg
> > 
> > And here's a correct rendering of it with librsvg and cairo's image
> > backend (svg2png):
> > 
> > 	http://cairographics.org/~cworth/images/svgtest.png
> > 
> > And here's an incorrect rendering of it with librsvg and cairo's PDF
> > backend (svg2pdf):
> > 
> > 	http://cairographics.org/~cworth/images/svgtest.pdf
> > 	http://cairographics.org/~cworth/images/svgtest-pdf.png
> > 
> > Ideas? Adrian?
> > 
> > -Carl
> 
> So, we had a bug for this in bugzilla that I could reproduce at the
> time, but a few weeks ago I tried and couldn't.  Looking into it now.
> (Adrian is doing the same right now).
> 
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759
-------------- next part --------------
A non-text attachment was scrubbed...
Name: librsvg-pango.patch
Type: text/x-patch
Size: 6677 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080217/45a11369/attachment.bin 


More information about the cairo mailing list