[gs-commits] rev 11609 - trunk/gs/base

ken at ghostscript.com ken at ghostscript.com
Fri Aug 6 11:15:22 UTC 2010


Author: ken
Date: 2010-08-06 11:15:22 +0000 (Fri, 06 Aug 2010)
New Revision: 11609

Modified:
   trunk/gs/base/gdevpdtt.c
Log:
Fix pdfwrite
There is a hack in type 3 font creation in pdfwrite which increases the FontMatrix if
all the elements are very small, apparently Acrobat is unable to cope with very small 
FontMatrix entries.

However, if all the entries are 0, it ends up running round a loop multiplying by 10
indefinitely. This change simply avoids the loop if all the matrix elements are 0.
Naturally this isn't a useful font, its a Quality Logic test file.

Expected Differences
File 13-13.ps should no longer hang


Modified: trunk/gs/base/gdevpdtt.c
===================================================================
--- trunk/gs/base/gdevpdtt.c	2010-08-06 11:11:40 UTC (rev 11608)
+++ trunk/gs/base/gdevpdtt.c	2010-08-06 11:15:22 UTC (rev 11609)
@@ -1123,6 +1123,11 @@
     if (pdfont->u.simple.s.type3.Resources == NULL)
 	return_error(gs_error_VMerror);
     /* Adobe viewers have a precision problem with small font matrices : */
+    /* Don't perform this test if all entries are 0, leads to infinite loop! */
+    if (pdfont->u.simple.s.type3.FontMatrix.xx != 0.0 ||
+	pdfont->u.simple.s.type3.FontMatrix.xy != 0.0 ||
+	pdfont->u.simple.s.type3.FontMatrix.yx != 0.0 ||
+	pdfont->u.simple.s.type3.FontMatrix.yy != 0.0) {
     while (any_abs(pdfont->u.simple.s.type3.FontMatrix.xx) < 0.001 &&
 	   any_abs(pdfont->u.simple.s.type3.FontMatrix.xy) < 0.001 &&
 	   any_abs(pdfont->u.simple.s.type3.FontMatrix.yx) < 0.001 &&
@@ -1132,6 +1137,7 @@
 	pdfont->u.simple.s.type3.FontMatrix.yx *= 10;
 	pdfont->u.simple.s.type3.FontMatrix.yy *= 10;
     }
+    }
     *ppdfont = pdfont;
     return 0;
 }



More information about the gs-commits mailing list