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 2014/12/11 08:39:51 UTC

svn commit: r1644571 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TextPosition.java

Author: tilman
Date: Thu Dec 11 07:39:51 2014
New Revision: 1644571

URL: http://svn.apache.org/r1644571
Log:
PDFBOX-2552: normalize the rotation angle for all values

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TextPosition.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TextPosition.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TextPosition.java?rev=1644571&r1=1644570&r2=1644571&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TextPosition.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TextPosition.java Thu Dec 11 07:39:51 2014
@@ -235,16 +235,16 @@ public class TextPosition
         this.endX = endXValue;
         this.endY = endYValue;
 
-        this.rot = pageRotation;
-        // make sure it is 0 to 270 and no negative numbers
-        if(this.rot < 0)
+        // normalize the rotation angle
+        while (pageRotation < 0)
         {
-            rot += 360;
+            pageRotation += 360;
         }
-        else if (rot >= 360)
+        while (pageRotation >= 360)
         {
-            rot -= 360;
+            pageRotation -= 360;
         }
+        this.rot = pageRotation;
 
         this.maxTextHeight = maxFontH;
         this.pageHeight = pageHeightValue;