[gs-cvs] rev 7754 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Thu Mar 1 12:15:49 PST 2007


Author: leonardo
Date: 2007-03-01 12:15:49 -0800 (Thu, 01 Mar 2007)
New Revision: 7754

Modified:
   trunk/gs/src/gdevpdts.c
Log:
Fix (pdfwrite) : Handle a text with degenerate CTM.

DETAILS :

The old code failed with undefinedresult when writing
a text to output with degenerate CTM. 
The new code writes it somehow to provide searchability.
See comment in code.
Such text is not visible in rendering.
We don't care about 'Tj' optimization
because such cases are rare.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gdevpdts.c
===================================================================
--- trunk/gs/src/gdevpdts.c	2007-03-01 15:27:39 UTC (rev 7753)
+++ trunk/gs/src/gdevpdts.c	2007-03-01 20:15:49 UTC (rev 7754)
@@ -16,6 +16,7 @@
 #include "math_.h"
 #include "memory_.h"
 #include "gx.h"
+#include "gserrors.h"
 #include "gdevpdfx.h"
 #include "gdevpdtx.h"
 #include "gdevpdtf.h"		/* for pdfont->FontType */
@@ -148,7 +149,15 @@
     int code = gs_distance_transform_inverse(dx, dy, pmat, pdist);
     double rounded;
 
-    if (code < 0)
+    if (code == gs_error_undefinedresult) {
+	/* The CTM is degenerate.
+	   Can't know the distance in user space.
+	   Set zero because we believe it is not important for rendering.
+	   We want to copy the text to PDF to make it searchable.
+	   Bug 689006.
+	 */
+	pdist->x = pdist->y = 0;
+    } else if (code < 0)
 	return code;
     /* If the distance is very close to integers, round it. */
     if (fabs(pdist->x - (rounded = floor(pdist->x + 0.5))) < 0.0005)



More information about the gs-cvs mailing list