From: Adrian Cumiskey Date: Tue, 18 Nov 2008 14:01:48 +0000 (+0000) Subject: Merged revisions 718557,718570,718591 via svnmerge from X-Git-Tag: fop-1_0~376^2~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1eaf6721d49efe4d26d79278382f99e4795e60f7;p=xmlgraphics-fop.git Merged revisions 718557,718570,718591 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r718557 | vhennebert | 2008-11-18 11:10:19 +0000 (Tue, 18 Nov 2008) | 2 lines Improved the FAQ by creating a separate entry for the problem about keep-together on table-cell, and the added support for inline keeps in 0.95 ........ r718570 | jeremias | 2008-11-18 13:16:32 +0000 (Tue, 18 Nov 2008) | 1 line Update conference ads. ........ r718591 | acumiskey | 2008-11-18 13:56:52 +0000 (Tue, 18 Nov 2008) | 2 lines TextHandler interface changes, the Graphics2D implementation is now passed to drawString(). ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@718594 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/xmlgraphics-commons-1.4svn.jar b/lib/xmlgraphics-commons-1.4svn.jar index 0932ac0e1..16ac2ef32 100644 Binary files a/lib/xmlgraphics-commons-1.4svn.jar and b/lib/xmlgraphics-commons-1.4svn.jar differ diff --git a/src/documentation/content/xdocs/faq.xml b/src/documentation/content/xdocs/faq.xml index f05f07126..1838a416a 100644 --- a/src/documentation/content/xdocs/faq.xml +++ b/src/documentation/content/xdocs/faq.xml @@ -1,4 +1,4 @@ - + - ApacheCon US 2008 + ApacheCon US 2009 http://us.apachecon.com/ - http://apache.org/ads/ApacheCon/2008-usa-125x125.png + http://apache.org/ads/ApacheCon/2009-usa-125x125.png 125 125 diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java index b8ff8ef3f..374b5a256 100644 --- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java +++ b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java @@ -25,21 +25,20 @@ import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; -import org.w3c.dom.Document; -import org.w3c.dom.svg.SVGLength; - import org.apache.avalon.framework.configuration.Configuration; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.UnitProcessor; import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.image.ImageTranscoder; -import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D; -import org.apache.xmlgraphics.java2d.TextHandler; - import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontSetup; import org.apache.fop.svg.AbstractFOPTranscoder; +import org.apache.xmlgraphics.java2d.TextHandler; +import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D; +import org.apache.xmlgraphics.ps.PSGenerator; +import org.w3c.dom.Document; +import org.w3c.dom.svg.SVGLength; /** * This class enables to transcode an input to a PostScript document. @@ -70,7 +69,7 @@ import org.apache.fop.svg.AbstractFOPTranscoder; */ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder { - private Configuration cfg = null; + private final Configuration cfg = null; protected AbstractPSDocumentGraphics2D graphics = null; /** @@ -99,7 +98,8 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder { FontInfo fontInfo = new FontInfo(); //TODO Do custom font configuration here somewhere/somehow FontSetup.setup(fontInfo); - graphics.setCustomTextHandler(new NativeTextHandler(graphics, fontInfo)); + PSGenerator generator = graphics.getPSGenerator(); + graphics.setCustomTextHandler(new NativeTextHandler(generator, fontInfo)); } super.transcode(document, uri, output); 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(); diff --git a/src/java/org/apache/fop/render/ps/PSSVGHandler.java b/src/java/org/apache/fop/render/ps/PSSVGHandler.java index d4a478fa4..2bc0f069b 100644 --- a/src/java/org/apache/fop/render/ps/PSSVGHandler.java +++ b/src/java/org/apache/fop/render/ps/PSSVGHandler.java @@ -24,18 +24,12 @@ import java.awt.geom.AffineTransform; import java.io.IOException; import java.util.Map; -import org.w3c.dom.Document; - import org.apache.avalon.framework.configuration.Configuration; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.GVTBuilder; import org.apache.batik.gvt.GraphicsNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - -import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; -import org.apache.xmlgraphics.ps.PSGenerator; - import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.AbstractGenericSVGHandler; import org.apache.fop.render.Renderer; @@ -43,6 +37,9 @@ import org.apache.fop.render.RendererContext; import org.apache.fop.render.RendererContextConstants; import org.apache.fop.svg.SVGEventProducer; import org.apache.fop.svg.SVGUserAgent; +import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; +import org.apache.xmlgraphics.ps.PSGenerator; +import org.w3c.dom.Document; /** * PostScript XML handler for SVG. Uses Apache Batik for SVG processing. @@ -262,7 +259,9 @@ public class PSSVGHandler extends AbstractGenericSVGHandler NativeTextHandler nativeTextHandler = null; BridgeContext ctx = new BridgeContext(ua); if (!strokeText) { - nativeTextHandler = new NativeTextHandler(graphics, psInfo.getFontInfo()); + PSGenerator generator = graphics.getPSGenerator(); + FontInfo fontInfo = psInfo.getFontInfo(); + nativeTextHandler = new NativeTextHandler(generator, fontInfo); graphics.setCustomTextHandler(nativeTextHandler); PSTextPainter textPainter = new PSTextPainter(nativeTextHandler); ctx.setTextPainter(textPainter); @@ -283,8 +282,8 @@ public class PSSVGHandler extends AbstractGenericSVGHandler float w = (float)ctx.getDocumentSize().getWidth() * 1000f; float h = (float)ctx.getDocumentSize().getHeight() * 1000f; - float sx = psInfo.getWidth() / (float)w; - float sy = psInfo.getHeight() / (float)h; + float sx = psInfo.getWidth() / w; + float sy = psInfo.getHeight() / h; ctx = null; builder = null;