[cairo] Problems with cairo PDF generation and Mac OS X PDF
rendering
Ryan Schmidt
cairo-2006c at ryandesign.com
Thu Jul 20 06:36:31 PDT 2006
On Jul 7, 2006, at 19:48, Ryan Schmidt wrote:
> Hi again. Graphviz [1] with cairo/pango support now has the ability
> to generate PDFs for the first time, but the result is weird, in
> the following way: The PDF looks fine in Adobe Reader 7.0.8 (the
> latest), and also in Adobe Acrobat Reader 5.0.5 (almost 5 years
> old), but it looks wrong in Mac OS X 10.4.7's Preview.app 3.0.7.
> The PDF, and PNGs of how it looks in Adobe Reader and Preview, are
> attached.
>
> I first asked [2] on the graphviz-devel mailing list (where the
> attachments are also available, in case they don't come through on
> this list) and John Ellson, one of the Graphviz developers,
> suggested I ask here:
>
>> It looks like the viewer is having difficulty with the curve-to
>> segments of paths.
>> I would guess that if you use shape=box for the nodes that they
>> would then show up ?
>> Probably the cairo list is the place to ask first, unless there is
>> an active list for the viewer?
>
> I tried using box-shaped nodes instead of ovals, as he suggested,
> but it made no difference; the PDF still shows up great in Adobe
> Reader, and the node and edge lines are still not shown in Preview.
>
> Preview.app isn't rendering the PDFs; a core Mac OS X library is.
> (The same display anomalies are present when viewing the PDF
> attached to this mail in Mail.app, for example.) If this turns out
> to be a bug in that Mac OS X PDF rendering library, I'll be happy
> to submit a bug report to Apple. But the likely effect of this will
> be that either the bug will be ignored for 3 years, then closed as
> out-of-date, or that the issue will be dealt with after a few
> months but the fix only made available in the next non-free Mac OS
> X update. Which is why I'm asking here first, since if this turns
> out to be a bug in the way cairo generates its PDFs, then I imagine
> the cairo developers would be able to react much quicker than
> this. :-)
>
>
> [1] http://www.graphviz.org/
>
> [2] https://mailman.research.att.com/pipermail/graphviz-devel/
> 2006/000214.html
>
>
> <foo.pdf>
> <foo-in-adobe-reader-7.0.8-correct.png>
> <foo-in-preview-3.0.7-incorrect.png>
There's another wrong behavior I just found. It too is only observed
in Preview.app; everything looks fine in Adobe Reader. This problem
only shows up for certain fonts. Currently, I've seen the problem in
"TimesNewRoman," but not in "Times" or "Verdana"—but this is
unfortunate because the font Graphviz picks by default is TimesNewRoman.
The problem is this: the first glyph mentioned in the graph is the
only one that gets used. This one glyph gets used to represent all
characters in the document. I'll show you what I mean by attaching
PDFs of the correct Times output, the incorrect TimesNewRoman output,
and what these PDFs look like in both Preview.app and Adobe Reader.
The PDF that gets produced for Times also has a very interesting
feature: two "smudges" in the upper row of pixels. Zooming in on
these smudges as far I can, I see that these seem to be part of the
node ovals that I've been missing (the original problem reported
above). So it looks like the nodes (and presumably edges) are being
drawn after all, just not at the right position in the PDF. So the
question becomes, for those who can read the PDF format: is there
anything unusual about the way the coordinates for the node ovals
(and the edge lines) are being specified—something different from the
way the coordinates for the arrowheads are being specified, since
those are coming out fine? Is cairo doing this unusual thing when
writing the PDF, or is Graphviz doing this unusual thing when it's
informing cairo about the coordinates?
Reproduction recipe:
Graphviz 2.9.20060720.0440 was installed using my Mac OS X binaries,
available from http://www.ryandesign.com/graphviz/
The PDFs were created this way:
$ echo 'digraph G {rank=same{hello->world}}' | /usr/local/
graphviz-2.9/bin/dot -Tpdf > hello-TimesNewRoman.pdf
$ echo 'digraph G {rank=same{hello->world}}' | /usr/local/
graphviz-2.9/bin/dot -Tpdf -Nfontname=Times > hello-Times.pdf
The PNGs were created by taking screenshots of the PDFs when opened
at actual size in Preview.app 3.0.7 and Adobe Reader 7.0.8.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-Times.pdf
Type: application/pdf
Size: 8329 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060720/18b13ed5/hello-Times-0001.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-Times-AdobeReader.png
Type: image/png
Size: 4993 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060720/18b13ed5/hello-Times-AdobeReader-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-Times-Preview.app.png
Type: image/png
Size: 3822 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060720/18b13ed5/hello-Times-Preview.app-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-TimesNewRoman.pdf
Type: application/pdf
Size: 13665 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060720/18b13ed5/hello-TimesNewRoman-0001.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-TimesNewRoman-AdobeReader.png
Type: image/png
Size: 5070 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060720/18b13ed5/hello-TimesNewRoman-AdobeReader-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-TimesNewRoman-Preview.app.png
Type: image/png
Size: 3472 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060720/18b13ed5/hello-TimesNewRoman-Preview.app-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-TimesNewRoman-Preview.app-smudge-zoomed.png
Type: image/png
Size: 2685 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060720/18b13ed5/hello-TimesNewRoman-Preview.app-smudge-zoomed-0001.png
More information about the cairo
mailing list