You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2009/01/06 19:30:18 UTC

svn commit: r732038 - /incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java

Author: lehmi
Date: Tue Jan  6 10:30:17 2009
New Revision: 732038

URL: http://svn.apache.org/viewvc?rev=732038&view=rev
Log:
PDFBOX-358: fix some drawing-problems if the rotation-angle is not a multiple of 90 degrees.

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

Modified: incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java
URL: http://svn.apache.org/viewvc/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java?rev=732038&r1=732037&r2=732038&view=diff
==============================================================================
--- incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java (original)
+++ incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdfviewer/PageDrawer.java Tue Jan  6 10:30:17 2009
@@ -161,11 +161,10 @@
     		// Set translation to 0,0. We only need the scaling and shearing
             textPos.setValue(2, 0, 0);
             textPos.setValue(2, 1, 0);
+            // because of the moved 0,0-reference, we have to shear in the opposite direction
+            textPos.setValue(0, 1, (-1)*textPos.getValue(0, 1));
+            textPos.setValue(1, 0, (-1)*textPos.getValue(1, 0));
             AffineTransform at = textPos.createAffineTransform();
-    		// If there is a rotation, we have to add a additional rotation by 180°. 
-    		// Don't no why.yet. I guess there is a problem with clockwise- and counterclockwise-rotation
-            if (at.getShearX() != 0 || at.getShearY() != 0)
-            	at.rotate(Math.PI);
             font.drawString( text.getCharacter(), graphics, text.getFontSize(), at, x, y );
         }
         catch( IOException io )