mirror of https://github.com/apache/poi.git
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
This commit is contained in:
parent
d2053bb4f2
commit
7d7b67fef6
|
@ -85,9 +85,9 @@ public class DrawTextShape extends DrawSimpleShape {
|
||||||
graphics.rotate(Math.toRadians(textRot));
|
graphics.rotate(Math.toRadians(textRot));
|
||||||
graphics.translate(-cx, -cy);
|
graphics.translate(-cx, -cy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// first dry-run to calculate the total height of the text
|
// first dry-run to calculate the total height of the text
|
||||||
double textHeight = getTextHeight(graphics);
|
double textHeight;
|
||||||
|
|
||||||
switch (s.getVerticalAlignment()){
|
switch (s.getVerticalAlignment()){
|
||||||
default:
|
default:
|
||||||
|
@ -95,9 +95,11 @@ public class DrawTextShape extends DrawSimpleShape {
|
||||||
y += insets.top;
|
y += insets.top;
|
||||||
break;
|
break;
|
||||||
case BOTTOM:
|
case BOTTOM:
|
||||||
|
textHeight = getTextHeight(graphics);
|
||||||
y += anchor.getHeight() - textHeight - insets.bottom;
|
y += anchor.getHeight() - textHeight - insets.bottom;
|
||||||
break;
|
break;
|
||||||
case MIDDLE:
|
case MIDDLE:
|
||||||
|
textHeight = getTextHeight(graphics);
|
||||||
double delta = anchor.getHeight() - textHeight - insets.top - insets.bottom;
|
double delta = anchor.getHeight() - textHeight - insets.top - insets.bottom;
|
||||||
y += insets.top + delta/2;
|
y += insets.top + delta/2;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue