[gs-cvs] gs/lib

Ray Johnston ray at ghostscript.com
Sun Jul 17 22:33:14 PDT 2005


Update of /cvs/ghostscript/gs/lib
In directory casper2:/tmp/cvs-serv19321/lib

Modified Files:
	gs_cff.ps 
Log Message:
Fix handling of Some Type1C (CFF) font subsets where the tables may not
be completely contiguous. Seen with PDF's created by pdflib. Bug 688216.

DETAILS:

The example subset CFF had the "Private" data about 30,000 bytes after
the end of the previous (CharStrings) data. While we try to process the
CFF file sequentially, there is no reason we can't skip bytes. If we
encounter a CFF where positioning (backwards) is required, we will have
to further change the code to set us a "ResuableStreamDecode" file so
we can replace the "pos sub nextstring pop" with "f fileposition" which
will work forwards or backwards.

A CFF that requires this will get an error when loading the font from the
-string- operator (rangecheck). Since we haven't seen one yet, we will
wait until this surfaces.



Index: gs_cff.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/gs_cff.ps,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- gs_cff.ps	12 Apr 2003 18:08:18 -0000	1.17
+++ gs_cff.ps	18 Jul 2005 05:33:12 -0000	1.18
@@ -400,7 +400,8 @@
   68 { { readFDArray } offput }
   69 { { readFDSelect } offput }
 	% This operator only appears in a FDArray element.
-  70 { idstring /FontName pxdef }
+	% We don't really need it, so ignore an error.
+  70 { { idstring } .internalstopped { pop pop } { /FontName pxdef } ifelse }
 .dicttomark readonly def
 
 % readcharset and readFDSelect may require the length of CharStringArray,
@@ -705,21 +706,21 @@
   } forall ] def
 
 	% Read other tables with queued offsets.
-
-  CFFDEBUG { (offsets: ) print [ offsets { pop } forall ] == } if
-  { /f cff def
-    CFFDEBUG { (pos=) print pos = } if
-    offsets pos 2 copy .knownget not { pop pop exit } if
-    3 1 roll undef
-    CFFDEBUG { (exec queued: ) print dup == } if
-    exec
+        % We process these in order so we can advance if needed.
+	% The CFF file may not be positionable.
+  {		% outer loop since offsets may be updated when processing
+    CFFDEBUG { (offsets: ) print [ offsets { pop } forall ] == } if
+    [ offsets { pop } forall ] { lt } .sort	% process in order of appearance
+    { 
+      /f cff def
+      CFFDEBUG { (queued offset: ) print dup =print flush (, current pos=) print pos = } if
+      dup pos ne { dup pos sub nextstring pop } if	% negative advance will cause error
+      offsets exch 2 copy get 3 1 roll undef
+      CFFDEBUG { (exec queued: ) print dup == } if
+      exec
+    } forall
+    offsets length 0 eq { exit } if
   } loop
-  offsets length 0 ne {
-    QUIET not {
-      (Error reading the CFF font ) print resname =string cvs print ( : missing tables at ) print [ offsets { pop } forall ] ==
-      (Current position is ) print pos ==
-    } if
-  } if
 
 	% Process out-of-order tables.
 



More information about the gs-cvs mailing list