Bug 692241 - pdf creation fails with Error: /typecheck in --readonly-- with sans font windows 7 SP1
Summary: pdf creation fails with Error: /typecheck in --readonly-- with sans font wind...
Status: RESOLVED INVALID
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 9.02
Hardware: PC All
: P4 normal
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-28 18:50 UTC by Jan Nieuwenhuizen
Modified: 2011-05-28 21:34 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
LilyPond input with sans font (51 bytes, text/x-lilypond)
2011-05-28 18:50 UTC, Jan Nieuwenhuizen
Details
PS file produced on Windows 7 without SP, fine (535.68 KB, application/postscript)
2011-05-28 18:51 UTC, Jan Nieuwenhuizen
Details
PS file produced on Windows 7 SP1, triggers error (533.72 KB, application/postscript)
2011-05-28 18:52 UTC, Jan Nieuwenhuizen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Nieuwenhuizen 2011-05-28 18:50:30 UTC
Created attachment 7545 [details]
LilyPond input with sans font

Attached are two PostScript files generated by LilyPond from
the lily-sans.ly input file

    lily-sans-sp0.ps  # generated on Windows 7 32bit without SP
    lily-sans-sp1.ps  # generated on Windows 7 32bit SP1

we have similar reports from the 64bit platform.

LilyPond uses gs to produce the final PDF using this command

    gs -dSAFER -dDEVICEWIDTHPOINTS=595.28 -dDEVICEHEIGHTPOINTS=841.89 -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -r1200 -sDEVICE=pdfwrite -sOutputFile=./lily-sans-sp1.pdf -c.setpdfwrite -flily-sans-sp1.ps

From lily-sans-sp0.ps, gs produces a nice pdf, while with lily-sans-sp1.ps,
gs gives this error

    $ gswin32c -dNOSAFER -dDEVICEWIDTHPOINTS=595.28 -dDEVICEHEIGHTPOINTS=841.89 -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -r1200 -sDEVICE=pdfwrite -sOutputFile=./lily-sans-sp1.pdf -c.setpdfwrite -flily-sans-sp1.ps --debug
GPL Ghostscript 9.02 (2011-03-30)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /typecheck in --readonly--
Operand stack:
   CharStrings   --dict:951/951(L)--   glyph   glyph
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1162/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:8/11(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 536023
GPL Ghostscript 9.02: Unrecoverable error, exit code 1

Similar, running this on Ubuntu Natty with stock gs-9.01

     gs -dSAFER -dDEVICEWIDTHPOINTS=595.28 -dDEVICEHEIGHTPOINTS=841.89 -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -r1200 -sDEVICE=pdfwrite -sOutputFile=./1.pdf -c.setpdfwrite -flily-sans-sp1.ps
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /typecheck in --readonly--
Operand stack:
   CharStrings   --dict:951/951(L)--   glyph   glyph
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1160/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:8/11(L)--
Current allocation mode is local
Current file position is 536023
GPL Ghostscript 9.01: Unrecoverable error, exit code 1
Comment 1 Jan Nieuwenhuizen 2011-05-28 18:51:54 UTC
Created attachment 7546 [details]
PS file produced on Windows 7 without SP, fine

PS file produced on Windows 7 without SP, fine
Comment 2 Jan Nieuwenhuizen 2011-05-28 18:52:32 UTC
Created attachment 7547 [details]
PS file produced on Windows 7 SP1, triggers error

PS file produced on Windows 7 SP1, triggers error
Comment 3 Chris Liddell (chrisl) 2011-05-28 21:34:38 UTC
Definitely not a Ghostscript problem.

If you look at line 8271 of the non-working file, it looks like:
/pi 570 def /glyph 571 571 def /glyph 572 572 def /glyph573 573 def /uni2074 574 def


compared with the equivalent line from the working file:
/pi 570 def /uniF006 571 def /uniF007 572 def /uniF008 573 def /uni2074 574 def



You'll note that the non-working file repeats the values for two key/value pairs: 571 and 572, thus leaving two instances of the name /glyph on the top of the stack at the end of the CharStrings definition. Judging by the definition following those (/glyph573 573 def) I would assume that there are two spurious spaces added, and that the line is intended to be:

/pi 570 def /glyph571 571 def /glyph572 572 def /glyph573 573 def /uni2074 574 def

With that change hand applied, the file runs without error and /looks/ right to me (but I don't have LilyPond to view the intended appearance, so I can't be totally sure).