summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/kitfox/svg/Text.java11
-rw-r--r--src/main/java/com/kitfox/svg/pattern/PatternPaintContext.java2
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/com/kitfox/svg/Text.java b/src/main/java/com/kitfox/svg/Text.java
index 2ab9a0a..a83c389 100644
--- a/src/main/java/com/kitfox/svg/Text.java
+++ b/src/main/java/com/kitfox/svg/Text.java
@@ -351,14 +351,14 @@ public class Text extends ShapeElement
case TXAN_MIDDLE:
{
AffineTransform at = new AffineTransform();
- at.translate(-textPath.getBounds2D().getWidth() / 2, 0);
+ at.translate(-textPath.getBounds().getWidth() / 2, 0);
textPath.transform(at);
break;
}
case TXAN_END:
{
AffineTransform at = new AffineTransform();
- at.translate(-textPath.getBounds2D().getWidth(), 0);
+ at.translate(-textPath.getBounds().getWidth(), 0);
textPath.transform(at);
break;
}
@@ -389,7 +389,8 @@ public class Text extends ShapeElement
if (obj instanceof String)
{
- String text = (String) obj;
+ String text = (String)obj;
+ text = text.trim();
Shape textShape = font.createGlyphVector(frc, text).getOutline(cursorX, cursorY);
textPath.append(textShape, false);
@@ -429,14 +430,14 @@ public class Text extends ShapeElement
case TXAN_MIDDLE:
{
AffineTransform at = new AffineTransform();
- at.translate(-textPath.getBounds2D().getWidth() / 2, 0);
+ at.translate(-textPath.getBounds().getWidth() / 2, 0);
textPath.transform(at);
break;
}
case TXAN_END:
{
AffineTransform at = new AffineTransform();
- at.translate(-textPath.getBounds2D().getWidth(), 0);
+ at.translate(-Math.ceil(textPath.getBounds().getWidth()), 0);
textPath.transform(at);
break;
}
diff --git a/src/main/java/com/kitfox/svg/pattern/PatternPaintContext.java b/src/main/java/com/kitfox/svg/pattern/PatternPaintContext.java
index a0bdc92..49c8c2c 100644
--- a/src/main/java/com/kitfox/svg/pattern/PatternPaintContext.java
+++ b/src/main/java/com/kitfox/svg/pattern/PatternPaintContext.java
@@ -96,7 +96,7 @@ public class PatternPaintContext implements PaintContext
public Raster getRaster(int x, int y, int w, int h)
{
//System.err.println("" + x + ", " + y + ", " + w + ", " + h);
- if (buf == null || buf.getWidth() != w || buf.getHeight() != buf.getHeight())
+ if (buf == null || buf.getWidth() != w || buf.getHeight() != h)
{
buf = new BufferedImage(w, h, source.getType());
}