[gs-cvs] rev 7679 - trunk/gs/lib
leonardo at ghostscript.com
leonardo at ghostscript.com
Tue Feb 6 01:50:49 PST 2007
Author: leonardo
Date: 2007-02-06 01:50:48 -0800 (Tue, 06 Feb 2007)
New Revision: 7679
Modified:
trunk/gs/lib/gs_ttf.ps
Log:
Fix (TT font loader) : Account PDF Encoding with embedded symbolic TT fonts
that include cmap platformID=3 specificID=1 .
DETAILS :
Bug 689083 "PDF embedded TrueType fonts display with wrong characters".
Embedded fonts have symbolic flag and Encoding entry.
In this case PDF 1.6 spec requires to ignore Encoding
and to create a translation table based on cmap 3.0 or 1.0 .
However the test document does not provide these cmap tables,
so it falls into the "dafault" case (PDF spec 1.6 page 403) :
"If a character cannot be mapped in any of the ways described above,
the results are implementation-dependent."
The old code applied AdobeGlyphList for this case.
It appears different than Acrobat 7 does.
This patch accounts the document's Encoding entry.
Thus the Adobe's implementation dependent behavior appears
to be contradicting to general Adobe's requirement for symbolic fonts.
Please note that ignoring the document's encoding
may give a wrong searchability if the document does not provide ToUnicode.
This one does provide, but we believe that's not general.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/lib/gs_ttf.ps
===================================================================
--- trunk/gs/lib/gs_ttf.ps 2007-02-06 03:26:52 UTC (rev 7678)
+++ trunk/gs/lib/gs_ttf.ps 2007-02-06 09:50:48 UTC (rev 7679)
@@ -1671,6 +1671,7 @@
/.pdfcharkeys {
% The following algorithms are per the PDF Reference, Second Edition
% (PDF 1.3 reference manual).
+ TTFDEBUG { (.pdfcharkeys beg) = } if
is_symbolic {
<00030001> .findcmap {
%
@@ -1684,9 +1685,16 @@
%
( **** Warning: Embedded symbolic TT fonts should not contain a cmap for Platform=3 Encoding=1.\n)
pdfformaterror
- TTFDEBUG { (Using cmap 3.1) = } if
- AdobeGlyphList .pdfmapchars
- /Encoding /WinAnsiEncoding .findencoding
+ prebuilt_encoding null ne {
+ % Bug 689083.
+ TTFDEBUG { (Using cmap 3.0 with prebuilt_encoding.) = } if
+ prebuilt_encoding .invert_encoding .pdfmapchars
+ /Encoding prebuilt_encoding
+ } {
+ TTFDEBUG { (Using cmap 3.1 with WinAnsiEncoding) = } if
+ AdobeGlyphList .pdfmapchars
+ /Encoding /WinAnsiEncoding .findencoding
+ } ifelse
} {
%
% Adobe PDF spec says that in this case PDF interpreter should
@@ -1783,6 +1791,7 @@
} ifelse
} ifelse
} ifelse
+ TTFDEBUG { (.pdfcharkeys end) = } if
} bind def
% <file> <is_symbolic> <Encoding|null> .loadpdfttfont <type42font>
More information about the gs-cvs
mailing list