[gs-cvs] rev 9600 - trunk/ghostpdl/pxl

henrys at ghostscript.com henrys at ghostscript.com
Thu Mar 26 22:01:39 PDT 2009


Author: henrys
Date: 2009-03-26 22:01:39 -0700 (Thu, 26 Mar 2009)
New Revision: 9600

Modified:
   trunk/ghostpdl/pxl/pxfont.c
Log:
Fixes for 690203 and 690323, some pcl drivers write incorrect TrueType
headers, we work around that by setting the header to the default sfnt
version 1 header so the corrupt fonts will work with the font scaling
code.  Cluster testing reports an error in 4316.pxl, which can't be
reproduced locally.


Modified: trunk/ghostpdl/pxl/pxfont.c
===================================================================
--- trunk/ghostpdl/pxl/pxfont.c	2009-03-26 21:35:45 UTC (rev 9599)
+++ trunk/ghostpdl/pxl/pxfont.c	2009-03-27 05:01:39 UTC (rev 9600)
@@ -231,7 +231,22 @@
 	    code = px_fill_in_font((gs_font *)pfont, pxfont, pxs);
 	    if ( code < 0 )
 	      return code;
+            {
+                /* some pcl xl drivers generate an incorrect sfnt
+                   version, in particular they will use a true type
+                   collection header where truetype was intended.  The
+                   hp printer does not detect this problem.  Brutishly,
+                   we write in what the driver writers intended here
+                   and bypass and avoid later failures that would
+                   result from an incorrect header. */
+                static const byte version1_0[4] = {0, 1, 0, 0};
+                /* offset to the sfnt version.   */
+                uint offs = pxfont->offsets.GT +
+                    (pxfont->large_sizes ? 6 : 4);
 
+                if (gs_object_size(mem, header) >= offs + sizeof(version1_0))
+                    memcpy(header + offs, version1_0, sizeof(version1_0));
+            }
 	    code = pl_fill_in_tt_font(pfont, NULL, id);
             if ( code < 0 )
                 return code;



More information about the gs-cvs mailing list