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

alexcher at ghostscript.com alexcher at ghostscript.com
Mon Dec 31 14:46:51 PST 2007


Author: alexcher
Date: 2007-12-31 14:46:50 -0800 (Mon, 31 Dec 2007)
New Revision: 8470

Modified:
   trunk/gs/src/gstext.c
   trunk/gs/src/gstext.h
   trunk/gs/src/gxchar.c
Log:
Add a flag that marks PDF text rendering mode 3 to avoid confusion with other
non-rendering text operations such as stringwidth. This avoids unnecessary 
calculation of the current point, which fails when the CTM is singular. This
patch continues conservative approach to the text rendering modes started in
rev. 4006. Bug 689614, customer 384.

DIFFERENCES:
None.


Modified: trunk/gs/src/gstext.c
===================================================================
--- trunk/gs/src/gstext.c	2007-12-31 19:06:52 UTC (rev 8469)
+++ trunk/gs/src/gstext.c	2007-12-31 22:46:50 UTC (rev 8470)
@@ -293,7 +293,8 @@
 
 static inline uint text_do_draw(gs_state * pgs)
 {
-    return (pgs->text_rendering_mode == 3 ? TEXT_DO_NONE : TEXT_DO_DRAW);
+    return (pgs->text_rendering_mode == 3 ?
+        TEXT_DO_NONE | TEXT_RENDER_MODE_3 : TEXT_DO_DRAW);
 }
 
 /* Begin PostScript-equivalent text operations. */

Modified: trunk/gs/src/gstext.h
===================================================================
--- trunk/gs/src/gstext.h	2007-12-31 19:06:52 UTC (rev 8469)
+++ trunk/gs/src/gstext.h	2007-12-31 22:46:50 UTC (rev 8470)
@@ -86,6 +86,8 @@
 #define TEXT_INTERVENE            0x10000
 	/* Define whether to return the width. */
 #define TEXT_RETURN_WIDTH         0x20000
+	/* PDF mode "3 Tr" */
+#define TEXT_RENDER_MODE_3        0x40000
 
 /*
  * Define the structure of parameters passed in for text display.

Modified: trunk/gs/src/gxchar.c
===================================================================
--- trunk/gs/src/gxchar.c	2007-12-31 19:06:52 UTC (rev 8469)
+++ trunk/gs/src/gxchar.c	2007-12-31 22:46:50 UTC (rev 8470)
@@ -183,7 +183,9 @@
     penum->show_gstate =
 	(propagate_charpath && (pgs->in_charpath != 0) ?
 	 pgs->show_gstate : pgs);
-    if (!(~operation & (TEXT_DO_NONE | TEXT_RETURN_WIDTH))) {
+    if((operation & 
+         (TEXT_DO_NONE | TEXT_RETURN_WIDTH | TEXT_RENDER_MODE_3)) == 
+         (TEXT_DO_NONE | TEXT_RETURN_WIDTH)) {
 	/* This is stringwidth. */
 	gx_device_null *dev_null =
 	    gs_alloc_struct(mem, gx_device_null, &st_device_null,
@@ -1339,7 +1341,6 @@
 show_finish(gs_show_enum * penum)
 {
     gs_state *pgs = penum->pgs;
-    int code, rcode;
 
     if ((penum->text.operation & TEXT_DO_FALSE_CHARPATH) || 
 	(penum->text.operation & TEXT_DO_TRUE_CHARPATH)) {
@@ -1348,13 +1349,18 @@
     }
     if (penum->auto_release)
 	penum->procs->release((gs_text_enum_t *)penum, "show_finish");
-    if (!SHOW_IS_STRINGWIDTH(penum))
-	return 0;
-    /* Save the accumulated width before returning, */
-    /* and undo the extra gsave. */
-    code = gs_currentpoint(pgs, &penum->returned.total_width);
-    rcode = gs_grestore(pgs);
-    return (code < 0 ? code : rcode);
+    
+    if((penum->text.operation & 
+         (TEXT_DO_NONE | TEXT_RETURN_WIDTH | TEXT_RENDER_MODE_3)) == 
+         (TEXT_DO_NONE | TEXT_RETURN_WIDTH)) {
+        /* Save the accumulated width before returning, */
+        /* and undo the extra gsave. */
+        int code = gs_currentpoint(pgs, &penum->returned.total_width);
+        int rcode = gs_grestore(pgs);
+
+        return (code < 0 ? code : rcode);
+    }
+    return 0;
 }
 
 /* Release the structure. */



More information about the gs-cvs mailing list