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

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Dec 1 16:24:35 PST 2007


On 2007-11-30 12:48-0800 Carl Worth wrote:

> On Fri, 30 Nov 2007 15:07:45 -0500, Behdad Esfahbod wrote:
>> We should have tested the new ghostscript release before releasing
>> 1.4.12.  Given the multiple fixes that Adrian committed recently,
>> nothing stops us from releasing 1.4.14 in December.  It would be much
>> easier after all, to have frequent releases.
>
> Yes. Adrian, could you please cherry-pick your recent fixes onto the
> 1.4 branch as well? That should be something like the following with
> recent git:
>
> 	git checkout -b 1.4 origin/1.4
> 	git cherry-pick -x <commit>
> 	...
> 	<test here of course>
> 	git push origin 1.4
>

There is actually one other PostScript issue for cairo-1.4.12 (and previous)
that the extensive set of PLplot examples has revealed when the results are
interpreted with ghostscript 8.56 (and later).

Here is the typical 'gv --noquiet' error message assoicated with
this non xyshow issue.

Error: /typecheckGPL Ghostscript 8.56: Unrecoverable error, exit code 1
  in definefont
Operand stack:
    CairoFont-4-0   --dict:8/10(L)--   Font
Execution stack:
    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1797   1   3   %oparray_pop   1796   1   3   %oparray_pop   1792   1   3   %oparray_pop   1675   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1765   2   3   %oparray_pop
Dictionary stack:
    --dict:1086/1123(ro)(G)--   --dict:0/20(G)--   --dict:80/200(L)--
Current allocation mode is local
Last OS error: 2

Now "definefont" occurs throughout our ~30 different pscairo results, but
the three examples that have the above error have a special signature for
definefont that can be grepped for as follows:

irwin at raven> grep '>> definefont pop' *.pscairo
x07c.pscairo:>> definefont pop
x23c.pscairo:>> definefont pop
x23c.pscairo:>> definefont pop
x24c.pscairo:>> definefont pop

That signature is defined in src/cairo-ps-surface.c for the cairo-1.4.12
release.  I don't have enough understanding of PostScript to
figure out why gv is complaining about the type
of (presumably) the various objects that make up the font, but I did notice
that Adrian had reworked this area of the code for a git commit entitled

PS: Make Type 3 fonts text selectable

I don't think the above issue has anything to do with Type 3 fonts, but
nevertheless since he reworked the area, I thought there was a good chance
that the above issue would be fixed regardless of the motivation of the
change, and that turned out to be the case!

So, in sum if you patch the cairo-1.4.12 version of src/cairo-ps-surface.c
with the "PS: Ensure that xyshow operator has a pair of offsets for each
glyph" one-line patch at
http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=5e8f60531a09f357db38c4b646b1bbd29b97a891
and the "PS: Make Type 3 fonts text selectable" patch at
http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=97b0d8b3c376f7848514debbe0697a2159a26eb9

AND also change the header appropriately (this is a part of another
of Adrian's patches, but I am trying to be minimalist here) with

--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -459,6 +459,7 @@ typedef struct _cairo_scaled_font_subset
       */
      unsigned long *glyphs;
      unsigned long *to_unicode;
+    char          **glyph_names;
      unsigned int num_glyphs;
      cairo_bool_t is_composite;
  } cairo_scaled_font_subset_t;

then both the xyshow range errors discussed earlier in this thread and
the above typecheck error in definefont disappear for all the pscairo
examples produced by PLplot.

A word of explanation.  Our range of examples is so extensive that we
exercise the font system pretty hard.  There is clearly some issue with the
Debian testing fonts for the above three examples (x07c.pscairo,
x23c.pscairo, and x24c.pscairo). For the 24th example which is a "peace"
flag, the Korean word for peace is displayed at roughly one-tenth size for
our xcairo and pngcairo results and as blank for our pscairo results
generated with the patched cairo and also as a blank for pdfcairo.  I am
virtually positive it is this font issue that generates the special
definefont signature that caused the trouble and which had to be patched.
Thus, you could say that debian testing problems with fonts give a unique
opportunity to explore how cairo responds to such font errors.  :-) The X,
png, pdf, and patched PostScript back ends of cairo are okay under these
difficult testing circumstances, but the PostScript back end for the vanilla
cairo-1.4.12 produces files which modern gv/ghostscript does not like under
these circumstances.

I suggest for your forthcoming release that you at least include the three
PostScript backend patches above which give good results with no
gv/ghostscript errors for the extensive PLplot testing of that backend.

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