You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/05/05 19:08:56 UTC

svn commit: r1889536 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java

Author: tilman
Date: Wed May  5 19:08:56 2021
New Revision: 1889536

URL: http://svn.apache.org/viewvc?rev=1889536&view=rev
Log:
PDFBOX-4892: remove redurant variable + simplify method, as suggested by valerybokov

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java?rev=1889536&r1=1889535&r2=1889536&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java Wed May  5 19:08:56 2021
@@ -91,8 +91,7 @@ public final class TextPosition
         this.endX = endX;
         this.endY = endY;
 
-        int rotationAngle = pageRotation;
-        this.rotation = rotationAngle;
+        this.rotation = pageRotation;
 
         this.maxHeight = maxHeight;
         this.pageHeight = pageHeight;
@@ -106,14 +105,14 @@ public final class TextPosition
         this.fontSize = fontSize;
         this.fontSizePt = fontSizeInPt;
 
-        x = getXRot(rotationAngle);
-        if (rotationAngle == 0 || rotationAngle == 180)
+        x = getXRot(rotation);
+        if (rotation == 0 || rotation == 180)
         {
-            y = this.pageHeight - getYLowerLeftRot(rotationAngle);
+            y = this.pageHeight - getYLowerLeftRot(rotation);
         }
         else
         {
-            y = this.pageWidth - getYLowerLeftRot(rotationAngle);
+            y = this.pageWidth - getYLowerLeftRot(rotation);
         }
     }
 
@@ -668,7 +667,7 @@ public final class TextPosition
     private void insertDiacritic(int i, TextPosition diacritic)
     {
         StringBuilder sb = new StringBuilder();
-        sb.append(unicode.substring(0, i));
+        sb.append(unicode, 0, i);
 
         float[] widths2 = new float[widths.length + 1];
         System.arraycopy(widths, 0, widths2, 0, i);