You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ja...@apache.org on 2014/09/20 00:22:19 UTC

svn commit: r1626355 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java

Author: jahewson
Date: Fri Sep 19 22:22:19 2014
New Revision: 1626355

URL: http://svn.apache.org/r1626355
Log:
PDFBOX-2366: Allow text adjustments to be easily overridden

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java?rev=1626355&r1=1626354&r2=1626355&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFStreamEngine.java Fri Sep 19 22:22:19 2014
@@ -312,8 +312,7 @@ public class PDFStreamEngine
                     ty = 0;
                 }
 
-                // update the text matrix
-                textMatrix.concatenate(Matrix.getTranslatingInstance(tx, ty));
+                applyTextAdjustment(tx, ty);
             }
             else if(obj instanceof COSString)
             {
@@ -328,6 +327,18 @@ public class PDFStreamEngine
     }
 
     /**
+     * Applies a text position adjustment from the TJ operator. May be overridden in subclasses.
+     *
+     * @param tx x-translation
+     * @param ty y-translation
+     */
+    protected void applyTextAdjustment(float tx, float ty)
+    {
+        // update the text matrix
+        textMatrix.concatenate(Matrix.getTranslatingInstance(tx, ty));
+    }
+
+    /**
      * Process text from the PDF Stream. You should override this method if you want to
      * perform an action when encoded text is being processed.
      *