summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkitfox2014-08-10 05:51:34 +0200
committerkitfox2014-08-10 05:51:34 +0200
commitd997987aae2e0c7490ab54138c3b46bfd9d50539 (patch)
tree14c11ee7bdf3565ec2aab99ba39d437811f8f33b /src
parentFixing SVGSALAMANDER-39. Viewport is now no longer set when rendering a diag... (diff)
downloadsvg-salamander-core-d997987aae2e0c7490ab54138c3b46bfd9d50539.tar.gz
svg-salamander-core-d997987aae2e0c7490ab54138c3b46bfd9d50539.tar.xz
svg-salamander-core-d997987aae2e0c7490ab54138c3b46bfd9d50539.zip
Fixing SVGSALAMANDER-40. Now trimming leading and trailing whitespace from text elements.
Fixing SVGSALAMANDER-44. Raster will now check for changes in height when resizing PatternPaintContext. git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@183 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
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());
}