aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-11-26 13:45:04 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-11-26 13:45:04 +0000
commitc4c82d789126875999df9031d44ca9c772a649c5 (patch)
tree3d3a70ba403655336035b977f5b9abd2bb6261e8 /src/java/org/apache/fop/render
parent382636ee6b35783d5d1885b5bb84f87d7b518c02 (diff)
downloadxmlgraphics-fop-c4c82d789126875999df9031d44ca9c772a649c5.tar.gz
xmlgraphics-fop-c4c82d789126875999df9031d44ca9c772a649c5.zip
Merged revisions 719616,719629,719646,719654 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r719616 | jeremias | 2008-11-21 16:07:58 +0000 (Fri, 21 Nov 2008) | 1 line Added support for SVG 1.2 inside fo:instream-foreign-object. The code just used the basic SVGDOMImplementation for SVG 1.1. Now it delegates the DOM building to Batik code instead of to a normal DOM builder. ........ r719629 | jeremias | 2008-11-21 16:33:33 +0000 (Fri, 21 Nov 2008) | 2 lines Fix for unit test failure in transcoder tests (NullPointerException): Have to pass the root PSGraphics2D to NativeTextHandler instead of the PSGenerator as this one hasn't been initialized in PSGraphics2D when the NativeTextHandler is built in AbstractPSTranscoder. ........ r719646 | jeremias | 2008-11-21 17:24:32 +0000 (Fri, 21 Nov 2008) | 1 line Fixed possible ClassCastException that was caused by my earlier attempt to support SVG 1.2. Batik's SAXSVGDocumentFactory doesn't currently deal well with the case when namespaces are declared outside of its scope. Worked around that by doing the SVG version detection in FOP code. SVG12DOMImplementation is obtained by reflection in order to keep backwards compatilibility with earlier Batik versions that don't support SVG 1.2. ........ r719654 | jeremias | 2008-11-21 17:44:08 +0000 (Fri, 21 Nov 2008) | 1 line This actually fixes a bug. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@720850 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r--src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java15
-rw-r--r--src/java/org/apache/fop/render/ps/NativeTextHandler.java15
-rw-r--r--src/java/org/apache/fop/render/ps/PSSVGHandler.java12
3 files changed, 24 insertions, 18 deletions
diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
index 374b5a256..705515311 100644
--- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
+++ b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java
@@ -25,20 +25,23 @@ 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.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;
+
+import org.apache.fop.fonts.FontInfo;
+import org.apache.fop.fonts.FontSetup;
+import org.apache.fop.svg.AbstractFOPTranscoder;
/**
* This class enables to transcode an input to a PostScript document.
@@ -99,7 +102,7 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder {
//TODO Do custom font configuration here somewhere/somehow
FontSetup.setup(fontInfo);
PSGenerator generator = graphics.getPSGenerator();
- graphics.setCustomTextHandler(new NativeTextHandler(generator, fontInfo));
+ graphics.setCustomTextHandler(new NativeTextHandler(graphics, 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 98addd19e..7cf59d519 100644
--- a/src/java/org/apache/fop/render/ps/NativeTextHandler.java
+++ b/src/java/org/apache/fop/render/ps/NativeTextHandler.java
@@ -24,13 +24,14 @@ import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.io.IOException;
+import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
+import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
+import org.apache.xmlgraphics.ps.PSGenerator;
+
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontSetup;
import org.apache.fop.fonts.FontTriplet;
-import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
-import org.apache.xmlgraphics.java2d.ps.PSTextHandler;
-import org.apache.xmlgraphics.ps.PSGenerator;
/**
* Specialized TextHandler implementation that the PSGraphics2D class delegates to to paint text
@@ -38,7 +39,7 @@ import org.apache.xmlgraphics.ps.PSGenerator;
*/
public class NativeTextHandler implements PSTextHandler {
- private final PSGenerator gen;
+ private PSGraphics2D rootG2D;
/** FontInfo containing all available fonts */
protected FontInfo fontInfo;
@@ -60,8 +61,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(PSGenerator gen, FontInfo fontInfo) {
- this.gen = gen;
+ public NativeTextHandler(PSGraphics2D g2d, FontInfo fontInfo) {
+ this.rootG2D = g2d;
if (fontInfo != null) {
this.fontInfo = fontInfo;
} else {
@@ -84,7 +85,7 @@ public class NativeTextHandler implements PSTextHandler {
}
private PSGenerator getPSGenerator() {
- return this.gen;
+ return this.rootG2D.getPSGenerator();
}
/** {@inheritDoc} */
diff --git a/src/java/org/apache/fop/render/ps/PSSVGHandler.java b/src/java/org/apache/fop/render/ps/PSSVGHandler.java
index 2bc0f069b..1e65dfb98 100644
--- a/src/java/org/apache/fop/render/ps/PSSVGHandler.java
+++ b/src/java/org/apache/fop/render/ps/PSSVGHandler.java
@@ -24,12 +24,18 @@ 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;
@@ -37,9 +43,6 @@ 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.
@@ -259,9 +262,8 @@ public class PSSVGHandler extends AbstractGenericSVGHandler
NativeTextHandler nativeTextHandler = null;
BridgeContext ctx = new BridgeContext(ua);
if (!strokeText) {
- PSGenerator generator = graphics.getPSGenerator();
FontInfo fontInfo = psInfo.getFontInfo();
- nativeTextHandler = new NativeTextHandler(generator, fontInfo);
+ nativeTextHandler = new NativeTextHandler(graphics, fontInfo);
graphics.setCustomTextHandler(nativeTextHandler);
PSTextPainter textPainter = new PSTextPainter(nativeTextHandler);
ctx.setTextPainter(textPainter);