[gs-cvs] rev 7676 - trunk/gs/lib

leonardo at ghostscript.com leonardo at ghostscript.com
Mon Feb 5 08:58:07 PST 2007


Author: leonardo
Date: 2007-02-05 08:58:07 -0800 (Mon, 05 Feb 2007)
New Revision: 7676

Modified:
   trunk/gs/lib/pdf_font.ps
Log:
Fix (PDF interpreter) : Allow 2-byte ToUnicode CMap for 1-byte fonts.

DETAILS :

Bug 689073 "conversion to PDF fails with rangecheck error".

First, the supplied test case is definitely incorrect.
because it's ToUnicode cmap defines bfchar codes,
which fall outside any code space range defined in the CMap.
Particularly there are 1-byte bfchar codes,
and codespace defines 2-byte codes only.

Second, The PDF spec 1.6. page 472 reads :
"The CMap file must contain begincodespacerange and endcodespacerange
operators that are consistent with the encoding that the font uses. 
In particular, for a simple font, the codespace must be one byte long."
The test case those operators define a 2-byte space for a simple font.

However Adobe handles this document, so we provide a tolerance
for 1-byte fonts. It appears pretty simple : don't substitute
Encoding names for codes over the Encoding length.

Note that codes over the Encoding length appear unuseful
for the test document. In same time they appear consistent 
with codespacerange, so there exist a theoretical possibility that
same CMap is used with another 2-byte font. 
Therefore we keep 2-byte codes intact.

Note that ToUnicode CMap appears unuseful for both
the original and the converted document,
because they use standard glyph names only.
Possibly Adobe don't issue an error due to that.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/lib/pdf_font.ps
===================================================================
--- trunk/gs/lib/pdf_font.ps	2007-02-04 16:19:41 UTC (rev 7675)
+++ trunk/gs/lib/pdf_font.ps	2007-02-05 16:58:07 UTC (rev 7676)
@@ -380,7 +380,9 @@
         % A single pair.
         exch pop exch pop exch pop exch        % e [] i (values) offset
         4 index null ne {
-          4 index exch get
+          4 index length 1 index gt {
+            4 index exch get
+          } if
         } if                                   % e [] i (values) cid|name
         exch 
         PDFDEBUG {



More information about the gs-cvs mailing list