aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2014-04-28 15:06:33 +0000
committerSimon Steiner <ssteiner@apache.org>2014-04-28 15:06:33 +0000
commit5bda482265a85b6d5556a1ac9b103809ef495173 (patch)
tree7f83dec52d92b9c9e293f2dbc1616f79cc5b15c1 /src/java/org/apache
parent040e4a7bbe9f400a28b91c2bf176d0e71f4b226c (diff)
downloadxmlgraphics-fop-5bda482265a85b6d5556a1ac9b103809ef495173.tar.gz
xmlgraphics-fop-5bda482265a85b6d5556a1ac9b103809ef495173.zip
FOP-2345 SVG to AFP text spacing wrong
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1590665 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/svg/AbstractFOPTextPainter.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java b/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java
index 7df127d3a..9cb868448 100644
--- a/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java
+++ b/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java
@@ -152,8 +152,21 @@ public abstract class AbstractFOPTextPainter implements TextPainter {
double y = outputLocation.getY();
try {
try {
+ AFPGraphics2D afpg2d = (AFPGraphics2D)g2d;
+ int fontSize = 0;
+ if (font != null) {
+ fontSize = (int) Math.round(afpg2d.convertToAbsoluteLength(font.getFontSize()));
+ }
+ if (fontSize < 6000) {
+ nativeTextHandler.drawString(g2d, txt, (float) (x + tx), (float) y);
+ } else {
+ double scaleX = g2d.getTransform().getScaleX();
+ for (int i = 0; i < txt.length(); i++) {
+ double ad = run.getLayout().getGlyphAdvances()[i] * scaleX;
+ nativeTextHandler.drawString(g2d, txt.charAt(i) + "", (float) (x + tx + ad), (float) y);
+ }
+ }
//TODO draw underline and overline if set
- nativeTextHandler.drawString(g2d, txt, (float) (x + tx), (float) y);
//TODO draw strikethrough if set
} catch (IOException ioe) {
if (g2d instanceof AFPGraphics2D) {