pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1682140 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Date Wed, 27 May 2015 23:49:11 GMT
Author: jahewson
Date: Wed May 27 23:49:10 2015
New Revision: 1682140

URL: http://svn.apache.org/r1682140
Log:
PDFBOX-2814: Collect text clip across TJ characters

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1682140&r1=1682139&r2=1682140&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Wed May
27 23:49:10 2015
@@ -39,6 +39,7 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine;
+import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.font.PDCIDFontType0;
@@ -280,9 +281,27 @@ public class PageDrawer extends PDFGraph
     {
         setClip();
     }
+    
+    @Override
+    public void showTextString(byte[] string) throws IOException
+    {
+        beginTextClip();
+        super.showTextString(string);
+        endTextClip();
+    }
 
     @Override
-    protected void showText(byte[] string) throws IOException
+    public void showTextStrings(COSArray array) throws IOException
+    {
+        beginTextClip();
+        super.showTextStrings(array);
+        endTextClip();
+    }
+
+    /**
+     * Begin buffering the text clipping path, if any.
+     */
+    private void beginTextClip()
     {
         PDGraphicsState state = getGraphicsState();
         RenderingMode renderingMode = state.getTextState().getRenderingMode();
@@ -292,9 +311,16 @@ public class PageDrawer extends PDFGraph
         {
             textClippingArea = new Area();
         }
+    }
 
-        super.showText(string);
-
+    /**
+     * End buffering the text clipping path, if any.
+     */
+    private void endTextClip()
+    {
+        PDGraphicsState state = getGraphicsState();
+        RenderingMode renderingMode = state.getTextState().getRenderingMode();
+        
         // apply the buffered clip as one area
         if (renderingMode.isClip())
         {



Mime
View raw message