Bug 689790 - Regression: Error writing PDF file: Missing glyph CID=0 in Bug689614.pdf
Summary: Regression: Error writing PDF file: Missing glyph CID=0 in Bug689614.pdf
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: master
Hardware: Macintosh MacOS X
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-10 07:35 UTC by Marcos H. Woehrmann
Modified: 2009-01-06 06:40 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
singular_ctm_empty_fontbbox.pdf (2.06 KB, application/pdf)
2008-05-04 20:40 UTC, Marcos H. Woehrmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2008-04-10 07:35:50 UTC
The attached file, one of the regression test suite, fails with -sDEVICE=pdfwrite with gshead (r8631).  
The command line I'm using for testing:

  bin/gs -sDEVICE=pdfwrite -sOutputFile=test.pdf ./Bug689614.pdf

The complete output from Ghostscript:

GPL Ghostscript SVN PRE-RELEASE 8.63 (2008-03-01)
Copyright (C) 2008 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Loading NimbusRomNo9L-Regu font from /Users/marcos/Desktop/artifex/fonts/n021003l.pfb... 
2907132 1368150 13653164 12329655 3 done.
Loading NimbusSanL-Regu font from /Users/marcos/Desktop/artifex/fonts/n019003l.pfb... 2944080 
1470913 13689924 12374579 3 done.
GPL Ghostscript SVN PRE-RELEASE 8.63: Missing glyph CID=0 in the font HiddenHorzOCR . The output 
PDF may fail with some viewers.
Error: /rangecheck in --run--
Operand stack:
   --nostringval--   --dict:13/22(L)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   -
-nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1905   1   3   
%oparray_pop   1904   1   3   %oparray_pop   1888   1   3   %oparray_pop   --nostringval--   --
nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   -
-nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --
nostringval--   %loop_continue   --nostringval--   %finish_show   --nostringval--   --nostringval--   8   
9   2   --nostringval--   (pdf_text_enum_t)
Dictionary stack:
   --dict:1149/1684(ro)(G)--   --dict:1/20(G)--   --dict:76/200(L)--   --dict:76/200(L)--   --
dict:108/127(ro)(G)--   --dict:273/300(ro)(G)--   --dict:22/25(L)--   --dict:4/6(L)--   --
dict:26/40(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript SVN PRE-RELEASE 8.63: Unrecoverable error, exit code 1


Also, the message "GPL Ghostscript SVN PRE-RELEASE 8.63: Missing glyph CID=0 in the font 
HiddenHorzOCR . The output PDF may fail with some viewers." is a bit odd in that it prints out the 
Ghostscript release information; this isn't normally done for warnings or other messages.
Comment 1 Marcos H. Woehrmann 2008-04-10 07:36:43 UTC
Created attachment 3929 [details]
Bug689614.pdf

This file is a customer file that was originally associated with bug 689614. 
Therefore it needs to be marked private.
Comment 2 Marcos H. Woehrmann 2008-04-10 07:40:21 UTC
Converting this file to a raster format (such as tiff24nc) works.
Comment 3 Ken Sharp 2008-04-10 08:09:31 UTC
Yes, the error message is specific to pdfwrite (gdevpdtc.c, line 527):

eprintf2("Missing glyph CID=%d in the font %s . The output PDF may fail with
some viewers.\n", (int)cid, buf);

Notice it uses eprintf, hence the reason the release information gets printed. I
think the last person to mess about here was me last summer on bug 689212, so I
guess I broke something.

Not sure why, I'll have to debug it to find out.
Comment 4 Marcos H. Woehrmann 2008-04-10 08:48:15 UTC
This isn't a regression; gs8.54 fails the same way.
Comment 5 Marcos H. Woehrmann 2008-05-04 20:40:41 UTC
Created attachment 3979 [details]
singular_ctm_empty_fontbbox.pdf

The regression file, singular_ctm_empty_fontbbox.pdf (attached), fails the same
way.
Comment 6 Ken Sharp 2009-01-05 09:14:11 UTC
I think this has always been incorrect. While processing text we discover that
we need a glyph from a CIDFont, and the glyph is not present (the error message
is misleading).

We substitute for CID = 0 (is the .notdef) and carry on. It 'looks like' this
was intended to skip the next sequence of code by setting the 'code' variable to
1, however, if this is the *first* glyph in the font, then the .notdef seems to
have a zero width. So we go off and process its width. When we come back we then
execute the CDevProc, sadly we try to do this with the missing glyph CID, so
unsurprisingly it fails.

I have a 'fix' (more of a work-around) which I'm testing now.
Comment 7 Ken Sharp 2009-01-06 06:40:00 UTC
Fixed with this patch:

http://ghostscript.com/pipermail/gs-cvs/2009-January/008907.html