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

mpsuzuki at ghostscript.com mpsuzuki at ghostscript.com
Tue Jan 29 04:41:42 PST 2008


Author: mpsuzuki
Date: 2008-01-29 04:41:42 -0800 (Tue, 29 Jan 2008)
New Revision: 8512

Modified:
   trunk/gs/lib/gs_ttf.ps
Log:
Fix (TT): Ignore broken post 2.0 table generated by "Windows Type 1 Installer".

DETAILS:

This is the second fix for bug 689495, that is quite specific
to a TrueType font generated by "Windows Type 1 Installer".

"Windows Type 1 Installer" makes a TrueType font including broken
post table in format 2.0. Previous fix (SVN revision 8351) just
ignores such broken post table, and ISOLatin1Encoding is used
for fallback. When such TrueType font is combined with WinAnsiEncoding,
some glyph names (exists only in WinAnsiEncoding) cannot be resolved.

The post table format 2.0 uses 2 maps to assign a glyph name to
TrueType glyph index: the first map is from TrueType glyph index
to glyph name index (glyphNameIndex[] array), the second map is
from glyph name index to glyph name string (names[] Pascal string
array). The broken post table generated by "Windows Type 1 Installer"
seems to use name[] array by TrueType glyph index directly, and
the glyphNameIndex[] array has unreliable values.

This patch sets /.broken_post when the post table is broken (the
detection of broken post table is same with SVN revision 8351),
then use names[] array by TrueType glyph index when /.broken_post
is set.

EXPECTED DIFFERENCES:

None.


Modified: trunk/gs/lib/gs_ttf.ps
===================================================================
--- trunk/gs/lib/gs_ttf.ps	2008-01-29 11:54:50 UTC (rev 8511)
+++ trunk/gs/lib/gs_ttf.ps	2008-01-29 12:41:42 UTC (rev 8512)
@@ -618,6 +618,10 @@
         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
+      } for
+      /postnames exch def
+
         % 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
@@ -626,14 +630,21 @@
         % 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
+      /.broken_post false def
+      .latin1isodict postnames {
+        dup null ne
+        % dup /.notdef ne and
+        {
+          2 copy known {
+            TTFDEBUG { (ignore post table that redefines ISOLatin1Encoding glyph name ) print dup == flush } if
+            /.broken_post true def
+            pop exit
+          } if
+        } if
+        pop
+      } forall
+      pop
+
       numglyphs array 0 1 numglyphs 1 sub {
 	dup 2 mul 34 add postglyphs exch 2 //getinterval_from_stringarray exec 
 	dup 0 get 8 bitshift exch 1 get add dup 258 lt {
@@ -661,6 +672,18 @@
 	} ifelse
 	2 index 3 1 roll put
       } for
+
+      .broken_post {
+        pop
+        0 1 postnames length 1 sub {
+          postnames 1 index get null eq {
+            postnames 1 index /.notdef put
+          } if
+          pop
+        } for
+
+        [ postnames aload length 1 roll ]
+      } if
     }
     ifelse
   } bind



More information about the gs-cvs mailing list