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

mpsuzuki at ghostscript.com mpsuzuki at ghostscript.com
Wed Nov 7 23:57:22 PST 2007


Author: mpsuzuki
Date: 2007-11-07 23:57:21 -0800 (Wed, 07 Nov 2007)
New Revision: 8351

Modified:
   trunk/gs/lib/gs_ttf.ps
Log:
Fix: Ignore problematic post table in format 2.0 with ISOLatin1Encoding glyph names.

DETAILS:
Some TrueType fonts converted by "Windows Type 1 Installer" have
problematic post table format 2.0 including MacGlyphEncoding
entries which should be omitted. Such extra entries in the
beginning of glyphName array make /Encoding broken. By checking
if glyph name in post table is predefined one in MacGlyphEncoding,
such problematic post table can be detected. By ignoring such
problematic post table, bug 689495 is fixed.

However, some TrueType fonts designed for Microsoft redefines
MacGlyphEncoding glyph name out of predefined range. To permit
such font, the post table in format 2.0 is checked by
ISOLatin1Encoding which is the cross section of MacGlyphEncoding
and WinAnsiEncoding. ISOLatin1Encoding is enought to fix the
bug 689495.

EXPECTED DIFFERENCES:
None.


Modified: trunk/gs/lib/gs_ttf.ps
===================================================================
--- trunk/gs/lib/gs_ttf.ps	2007-11-07 07:13:45 UTC (rev 8350)
+++ trunk/gs/lib/gs_ttf.ps	2007-11-08 07:57:21 UTC (rev 8351)
@@ -192,6 +192,7 @@
 
 % Invert the MacRomanEncoding.
 /.romanmacdict MacRomanEncodingForTrueType .invert_encoding def
+/.latin1isodict ISOLatin1Encoding .invert_encoding def
 
 % Define remapping for misnamed glyphs in TrueType 'post' tables.
 % There are probably a lot more than this!
@@ -621,7 +622,21 @@
 	postglyphs postpos //get_from_stringarray exec
         postglyphs postpos 1 add 2 index //getinterval_from_stringarray exec cvn
 	exch postpos add 1 add /postpos exch def
-        2 index 3 1 roll put
+        2 index 3 1 roll
+        % Some TrueType fonts converted by "Windows Type 1 Installer" have
+        % problematic post table including MacGlyphEncoding entries which
+        % should be omitted. Such extra entries in the beginning of glyphName
+        % array make /Encoding broken. If we find populary predefined
+        % ISOLatin1Encoding glyph name in the post table, empty encoding is
+        % returned. Some TrueType fonts for Microsoft Windows redefines
+        % MacGlyphEncoding glyph name out of predefined range). To permit
+        % such fonts, ISOLatin1Encoding is used to find broken post. Bug 689495.
+        .latin1isodict 1 index known {
+          TTFDEBUG { (ignore post table that redefines ISOLatin1Encoding glyph name /) print dup == flush } if
+          pop pop pop pop [ ] /numglyphs 0 def exit
+        } {
+          put
+        } ifelse
       } for
       /postnames exch def
       numglyphs array 0 1 numglyphs 1 sub {



More information about the gs-cvs mailing list