From 4718592e15c3e0ba54cdc18d2c5027a252073885 Mon Sep 17 00:00:00 2001 From: Glen Stampoultzis Date: Sun, 21 Mar 2004 22:38:55 +0000 Subject: [PATCH] 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 --- build.xml | 2 +- src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.xml b/build.xml index 73ebd5de2..512a15b3a 100644 --- a/build.xml +++ b/build.xml @@ -89,7 +89,7 @@ - + diff --git a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java index 58aaee8d7..546978814 100644 --- a/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java +++ b/src/java/org/apache/poi/hssf/usermodel/EscherGraphics.java @@ -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 );