[poppler] poppler/poppler: CairoOutputDev.cc, 1.25, 1.26 CairoOutputDev.h, 1.10, 1.11

Jeff Muizelaar jrmuizel at freedesktop.org
Tue Jan 10 09:56:02 PST 2006


Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv9666/poppler

Modified Files:
	CairoOutputDev.cc CairoOutputDev.h 
Log Message:
2006-01-10  Jeff Muizelaar  <jeff at infidigm.net>

	* poppler/CairoOutputDev.cc:
	* poppler/CairoOutputDev.h:
	Fix the following fixme in CairoOutputDevice.

	// FIXME: This is quite right yet, we need to accumulate all
	// glyphs within one text object before we clip.  Right now this
	// just add this one string.

	The fix uses a strategy similar to the one the Splash backend.
	textClipPath is used to store the appended path from each call to
	endString(). The accumulated path is clipped in endTextObject.


Index: CairoOutputDev.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.cc,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- CairoOutputDev.cc	8 Jan 2006 22:59:48 -0000	1.25
+++ CairoOutputDev.cc	10 Jan 2006 17:55:59 -0000	1.26
@@ -57,6 +57,7 @@
   stroke_pattern = NULL;
   stroke_opacity = 1.0;
   fill_opacity = 1.0;
+  textClipPath = NULL;
 }
 
 CairoOutputDev::~CairoOutputDev() {
@@ -411,12 +412,22 @@
 
   // clip
   if (render & 4) {
-    // FIXME: This is quite right yet, we need to accumulate all
-    // glyphs within one text object before we clip.  Right now this
-    // just add this one string.
     LOG (printf ("clip string\n"));
+    // append the glyph path to textClipPath.
+
+    // set textClipPath as the currentPath
+    if (textClipPath) {
+      cairo_append_path (cairo, textClipPath);
+      cairo_path_destroy (textClipPath);
+    }
+    
+    // append the glyph path
     cairo_glyph_path (cairo, glyphs, glyphCount);
-    cairo_clip (cairo);
+   
+    // move the path back into textClipPath 
+    // and clear the current path
+    textClipPath = cairo_copy_path (cairo);
+    cairo_new_path (cairo);
   }
   
   gfree (glyphs);
@@ -440,6 +451,14 @@
 }
 
 void CairoOutputDev::endTextObject(GfxState *state) {
+  if (textClipPath) {
+    // clip the accumulated text path
+    cairo_append_path (cairo, textClipPath);
+    cairo_clip (cairo);
+    cairo_path_destroy (textClipPath);
+    textClipPath = NULL;
+  }
+
 }
 
 

Index: CairoOutputDev.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/CairoOutputDev.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- CairoOutputDev.h	3 Dec 2005 23:23:53 -0000	1.10
+++ CairoOutputDev.h	10 Jan 2006 17:55:59 -0000	1.11
@@ -150,6 +150,7 @@
   cairo_surface_t *surface;
   cairo_glyph_t *glyphs;
   int glyphCount;
+  cairo_path_t *textClipPath;
 };
 
 #endif



More information about the poppler mailing list