Fixed some drawString positioning problems with EscherGraphics.java

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353538 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2004-03-21 22:38:55 +00:00
parent 5654132e26
commit 4718592e15
2 changed files with 4 additions and 4 deletions

View File

@ -89,7 +89,7 @@
<property name="changelog.file" value="${build.site}/changelog.html"/>
<property name="dist.dir" value="build/dist"/>
<property name="jar.name" value="poi"/>
<property name="version.id" value="2.5-final"/>
<property name="version.id" value="2.5.1-final"/>
<property name="halt.on.test.failure" value="true"/>
<path id="main.classpath">

View File

@ -269,9 +269,9 @@ public class EscherGraphics
excelFont = new Font( font.getName(), font.getStyle(), (int) ( font.getSize() / verticalPixelsPerPoint ));
}
FontDetails d = StaticFontMetrics.getFontDetails( excelFont );
int width = (int) ( (d.getStringWidth( str ) * 2.5) + 12 );
int height = (int) ( ( font.getSize() * 2.0 * verticalPixelsPerPoint ) + 6 );
y -= ( font.getSize() * verticalPixelsPerPoint ); // we want to draw the shape from the top-left
int width = (int) ( (d.getStringWidth( str ) * 8) + 12 );
int height = (int) ( ( font.getSize() / verticalPixelsPerPoint ) + 6 ) * 2;
y -= ( font.getSize() / verticalPixelsPerPoint ) + 2 * verticalPixelsPerPoint; // we want to draw the shape from the top-left
HSSFTextbox textbox = escherGroup.createTextbox( new HSSFChildAnchor( x, y, x + width, y + height ) );
textbox.setNoFill( true );
textbox.setLineStyle( HSSFShape.LINESTYLE_NONE );