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

alexcher at ghostscript.com alexcher at ghostscript.com
Sat Jun 30 16:46:18 PDT 2007


Author: alexcher
Date: 2007-06-30 16:46:18 -0700 (Sat, 30 Jun 2007)
New Revision: 8093

Modified:
   trunk/gs/lib/pdf_font.ps
Log:
Compare the type of the object cached in the font descriptot with the expected
type and ignore the cache when the types mismatch. The same descriptor can
refer to Font and CIDFont resources if they happen to have the same name and
are not embedded. Bug 689301, customer 870.

DETAILS:
tx_pdf 12.0.112.500 created quite strange PDF file. The file refers to
Palatino font and Palatino CIDFont through the same font descriptor.
Both the font and CIDFont versions are not embedded. There's no rule in PDF
against merging equal objects from unrelated contexts.

Old code cached the font or CIDFont file in the font descriptor.
Re-using the font descriptor for a different type of the object caused the
wrong object to be retrieved from the cache. In turn, this causes /undefined
error later on.

The patch compares the type of the cached object with the expected type
and ignores the cache when the types mismatch. In our case this results in
an attempt to find Palatino CIDFont resource. Since this resource is not
available, the CMap name is used as a default CIDFont resource name for
the given CMap. In this case, /Adobe-Japan1 /CIDFont resource is searched.
When this resource is available, the file finishes normally. Otherwise the
file fails with /undefinedresource in findresource.

DIFFERENCES:
None


Modified: trunk/gs/lib/pdf_font.ps
===================================================================
--- trunk/gs/lib/pdf_font.ps	2007-06-30 12:25:22 UTC (rev 8092)
+++ trunk/gs/lib/pdf_font.ps	2007-06-30 23:46:18 UTC (rev 8093)
@@ -1446,7 +1446,16 @@
   } {
     dup dup /FontDescriptor knownoget {
                                           % font-res font-res font-desc
-      dup /FontObject .knownget {
+
+      dup /FontObject .knownget dup {     % font-res font-res font-desc font? bool bool
+        % Check that the cached FontObject has the right resource type
+        % The same font descriptor can be reused in a CID and non-CID contexts. bug 689301
+        3 index /Subtype knownoget not { /Type1 } if
+        dup /CIDFontType0 eq exch /CIDFontType2 eq or  % font-res font-res font-desc font bool is_cid
+        2 index /CIDFontType known xor {
+          pop pop //false                 % font-res font-res font-desc false 
+        } if
+      } if {
                                           % res res desc obj
           3 1 roll pop pop                % res obj
       } { 



More information about the gs-cvs mailing list