You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2016/07/17 20:33:32 UTC

svn commit: r1753115 - /poi/trunk/src/java/org/apache/poi/sl/draw/DrawTextShape.java

Author: onealj
Date: Sun Jul 17 20:33:32 2016
New Revision: 1753115

URL: http://svn.apache.org/viewvc?rev=1753115&view=rev
Log:
only calculate getTextHeight if it will be used

Modified:
    poi/trunk/src/java/org/apache/poi/sl/draw/DrawTextShape.java

Modified: poi/trunk/src/java/org/apache/poi/sl/draw/DrawTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/sl/draw/DrawTextShape.java?rev=1753115&r1=1753114&r2=1753115&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/sl/draw/DrawTextShape.java (original)
+++ poi/trunk/src/java/org/apache/poi/sl/draw/DrawTextShape.java Sun Jul 17 20:33:32 2016
@@ -85,9 +85,9 @@ public class DrawTextShape extends DrawS
             graphics.rotate(Math.toRadians(textRot));
             graphics.translate(-cx, -cy);
         }
-
+        
         // first dry-run to calculate the total height of the text
-        double textHeight = getTextHeight(graphics);
+        double textHeight;
 
         switch (s.getVerticalAlignment()){
             default:
@@ -95,9 +95,11 @@ public class DrawTextShape extends DrawS
                 y += insets.top;
                 break;
             case BOTTOM:
+                textHeight = getTextHeight(graphics);
                 y += anchor.getHeight() - textHeight - insets.bottom;
                 break;
             case MIDDLE:
+                textHeight = getTextHeight(graphics);
                 double delta = anchor.getHeight() - textHeight - insets.top - insets.bottom;
                 y += insets.top + delta/2;
                 break;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org