diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-11-18 13:56:52 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-11-18 13:56:52 +0000 |
commit | 3c666992c4e6159b6bbc0f5f5fa103dc835f2c08 (patch) | |
tree | 38365d0a9b93f77c56ae65184959888e8a93b215 /src/java/org/apache/fop/render/ps/NativeTextHandler.java | |
parent | ca5a3129ed4f7e40248120f470e0773964003c99 (diff) | |
download | xmlgraphics-fop-3c666992c4e6159b6bbc0f5f5fa103dc835f2c08.tar.gz xmlgraphics-fop-3c666992c4e6159b6bbc0f5f5fa103dc835f2c08.zip |
TextHandler interface changes, the Graphics2D implementation is now passed to drawString().
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@718591 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/ps/NativeTextHandler.java')
-rw-r--r-- | src/java/org/apache/fop/render/ps/NativeTextHandler.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/render/ps/NativeTextHandler.java b/src/java/org/apache/fop/render/ps/NativeTextHandler.java index 9f62097e9..98addd19e 100644 --- a/src/java/org/apache/fop/render/ps/NativeTextHandler.java +++ b/src/java/org/apache/fop/render/ps/NativeTextHandler.java @@ -19,6 +19,7 @@ package org.apache.fop.render.ps; +import java.awt.Graphics2D; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.io.IOException; @@ -37,7 +38,7 @@ import org.apache.xmlgraphics.ps.PSGenerator; */ public class NativeTextHandler implements PSTextHandler { - private PSGraphics2D g2d; + private final PSGenerator gen; /** FontInfo containing all available fonts */ protected FontInfo fontInfo; @@ -59,8 +60,8 @@ public class NativeTextHandler implements PSTextHandler { * @param g2d the PSGraphics2D instance this instances is used by * @param fontInfo the FontInfo object with all available fonts */ - public NativeTextHandler(PSGraphics2D g2d, FontInfo fontInfo) { - this.g2d = g2d; + public NativeTextHandler(PSGenerator gen, FontInfo fontInfo) { + this.gen = gen; if (fontInfo != null) { this.fontInfo = fontInfo; } else { @@ -83,7 +84,7 @@ public class NativeTextHandler implements PSTextHandler { } private PSGenerator getPSGenerator() { - return this.g2d.getPSGenerator(); + return this.gen; } /** {@inheritDoc} */ @@ -98,12 +99,19 @@ public class NativeTextHandler implements PSTextHandler { //nop } + /** {@inheritDoc} */ + public void drawString(String text, float x, float y) throws IOException { + // TODO Remove me after removing the deprecated method in TextHandler. + throw new UnsupportedOperationException("Deprecated method!"); + } + /** * Draw a string to the PostScript document. The text is painted using * text operations. * {@inheritDoc} */ - public void drawString(String s, float x, float y) throws IOException { + public void drawString(Graphics2D g, String s, float x, float y) throws IOException { + PSGraphics2D g2d = (PSGraphics2D)g; g2d.preparePainting(); if (this.overrideFont == null) { java.awt.Font awtFont = g2d.getFont(); |