[cairo] Misplaced glyphs in PDF backend

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Mon Jun 13 13:56:37 PDT 2005

  OK, I think I have a real bug here.  Not sure whether it is cairo or
pango bug.  My initial bet is on cairo.
  The test program in attachment uses pangocairo to render a certain
unicode glyph, called "LEFT SQUARE BRACKET EXTENSION", and the draws a
bounding box around it, using BB information returned by the pango
layout.  I use the same subroutine to output for both PNG and PDF
backends; however, the resulting output files differ significantly.  As
you can see comparing the PDF output [1,2] with the corresponding PNG
[3], you can see the vertical bar in the PDF file is further to the left
than in the PNG file.  The bounding boxes are correct in both cases
(this is logical rect, not ink rect), just the position in the PDF is

  That said, it looks like a minor problem.  But this is just a small
test case I wrote.  I'm working on a MathML renderer using pango +
cairo, and there the full effect of this bug is much worse.  The problem
is that I am implementing "vertical stretching" of operators like
parenthesis by vertically stacking certain special glyphs found in the
unicode map.  However, some bug in the PDF backend is causing most of
these "pieces" to be out of place, as can be seen comparing [4] and [5].
This has to be a bug, since I'm using exactly the same code for both PNG
and PDF output.


PS: example fonts containing these glyphs are FreeMono (freefonts) and
Code2000 (http://home.att.net/~jameskass/code2000_page.htm).

[1] http://telecom.inescporto.pt/~gjc/CairoMath/BracketExtension.pdf
[2] http://telecom.inescporto.pt/~gjc/CairoMath/Screenshot-BracketExtension.pdf.png
[3] http://telecom.inescporto.pt/~gjc/CairoMath/BracketExtension.png
[4] http://telecom.inescporto.pt/~gjc/CairoMath/Screenshot-test.py-1.png
[5] http://telecom.inescporto.pt/~gjc/CairoMath/output.pdf
Gustavo J. A. M. Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>
The universe is always one step beyond logic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pangocairo-simple.py
Type: text/x-python
Size: 1354 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050613/3dfc9f30/pangocairo-simple.py

More information about the cairo mailing list