[cairo] [PATCH]A cairo-ps-surface.c issue for modern finicky versions of ghostscript

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Dec 2 08:16:03 PST 2007


On 2007-12-02 19:29+1030 Adrian Johnson wrote:

> Alan W. Irwin wrote:
>> Hi Adrian:
>>
>> Thanks for working so hard to replicate the problem and also thanks for your
>> explanation of how the various kinds of fonts get embedded.
>>
>> That leads to another question.  Why doesn't the (patched) PostScript
>> backend give consistent results for pscairo and pngcairo (and xcairo) for
>> example 24? At least for the fonts I have installed on my Debian testing
>> system, the Korean peace word is blank for pscairo (and pdfcairo) and
>> one-tenth size for pngcairo and xcairo.  From your explanation I now assume
>> the small size is due to having a bitmapped Korean font installed somewhere
>> on my Debian testing system that fontconfig finds as a last desperate try to
>> find something that vaguely works, but why don't we see that small result
>> for postscript (and pdf)?  Or is this an artifact of the minimalist approach
>> I took to applying your patches?
>
> Looking at the the x24c.pscairo file the Type 3 font is named
> "CairoFont-0-0"
>
>  8 dict begin
>  /FontType 3 def
>     ....
>  currentdict
>  end
>  /CairoFont-0-0 exch definefont pop
>
>
> Then searching for each occurrence of CairoFont-0-0
>
>  /CairoFont-0-0 [ 0 -24 -24 0 0 0 ] selectfont
>  -2096679.5 626.100006 M
>  <0102>
>  [-24 0 ] yS
>
> and
>
>  /CairoFont-0-0 [ 0 -24 -24 0 0 0 ] selectfont
>  -2096949.399994 387.5 M
>  <0304>
>  [-24 0 ] yS
>
> The x coordindate -2096679 is off the page. I've seen this problem
> before when using pango with bitmap fonts. PS and PDF files would have
> large negative numbers in the moveto used to position text. However the
> text would appear ok in PNG files. Using gdb I confirmed that pango is
> passing in large negative coordinates to cairo_show_glyphs(). There is
> also a bug report here
>
>  http://bugs.freedesktop.org/show_bug.cgi?id=10118
>
> and pango bug report here
>
>  http://bugzilla.gnome.org/show_bug.cgi?id=474418
>
> The pango developers do not appear to have made any progress on this bug.
>

Here are some more examples for Behdad's benefit (if he knows some
pango developer willing to take this on).

For the fonts on my particular Debian testing system the problem extends to
three PLplot examples.  Here are the relevant parts (created with a jhbuild
of pango-1.18.3, the minimally patched cairo-1.4.12, and their
dependencies):

x07c.pscairo:
% _cairo_ps_surface_show_glyphs
1 G
/CairoFont-3-0 findfont
[ 0 -17 -17 0 0 0 ] makefont
setfont
-2096990 182.5 M
<01> S
% _cairo_ps_surface_show_glyphs
1 G
/CairoFont-3-0 findfont
[ 0 -17 -17 0 0 0 ] makefont
setfont
-2096990 124.899994 M
<02> S

x23c.pscairo:
% _cairo_ps_surface_show_glyphs
1 G
/CairoFont-3-0 findfont
[ 0 -14 -14 0 0 0 ] makefont
setfont
-2096899 60.100006 M
<01> S
[...]
% _cairo_ps_surface_show_glyphs
1 G
/CairoFont-3-0 findfont
[ 0 -14 -14 0 0 0 ] makefont
setfont
-2096839.600006 664.899994 M
<02> S
[...]
% _cairo_ps_surface_show_glyphs
1 G
/CairoFont-4-0 findfont
[ 0 -13 -13 0 0 0 ] makefont
setfont
-2096720.800003 665.899994 M
<01> S
[...]
% _cairo_ps_surface_show_glyphs
1 G
/CairoFont-4-0 findfont
[ 0 -13 -13 0 0 0 ] makefont
setfont
-2096720.800003 579.5 M
<02> S

x24c.pscairo
% _cairo_ps_surface_show_glyphs
0.941176 G
/CairoFont-4-0 findfont
[ 0 -18 -18 0 0 0 ] makefont
setfont
-2096949.5 381.5 M
<0102>
[-18 0 ] yS

On another Debian (oldstable) system of mine with a modern pango stack built
with jhbuild and also on Andrew Ross's Ubuntu Gutsy system a more
comprehensive system of fonts is installed so this part of the pango and
cairo code is never exercised by the PLplot examples.  So the above issues
are probably fairly rare. Nevertheless, it is good, Adrian, that the type
error for this case has been straightened out by your latest cairo work, and
obviously it would be good, Behdad, for the large negative X issue to be
straightened out for this case for pango if only to lay this issue to rest.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the cairo mailing list