diff options
author | Javen O'Neal <onealj@apache.org> | 2016-07-17 20:33:32 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2016-07-17 20:33:32 +0000 |
commit | 7d7b67fef65950ac041f098f1e6887c08029bb39 (patch) | |
tree | 76ba8fda5e764cb764e10e1e704028e11caa2e49 /src | |
parent | d2053bb4f2e3edf554b55f5a05b6ddf1043440eb (diff) | |
download | poi-7d7b67fef65950ac041f098f1e6887c08029bb39.tar.gz poi-7d7b67fef65950ac041f098f1e6887c08029bb39.zip |
only calculate getTextHeight if it will be used
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1753115 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/poi/sl/draw/DrawTextShape.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/sl/draw/DrawTextShape.java b/src/java/org/apache/poi/sl/draw/DrawTextShape.java index f6e3891e5f..3a1d8faeea 100644 --- a/src/java/org/apache/poi/sl/draw/DrawTextShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawTextShape.java @@ -85,9 +85,9 @@ public class DrawTextShape extends DrawSimpleShape { 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 DrawSimpleShape { 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;
|