diff options
Diffstat (limited to 'src/org/apache/fop/svg/PDFTranscoder.java')
-rw-r--r-- | src/org/apache/fop/svg/PDFTranscoder.java | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/src/org/apache/fop/svg/PDFTranscoder.java b/src/org/apache/fop/svg/PDFTranscoder.java index 74197263d..73d5fcb46 100644 --- a/src/org/apache/fop/svg/PDFTranscoder.java +++ b/src/org/apache/fop/svg/PDFTranscoder.java @@ -49,7 +49,6 @@ import org.apache.batik.dom.util.DocumentFactory; import org.apache.batik.ext.awt.image.GraphicsUtil; import org.apache.batik.gvt.GraphicsNode; -import org.apache.batik.gvt.GraphicsNodeRenderContext; import org.apache.batik.gvt.event.EventDispatcher; import org.apache.batik.gvt.renderer.ImageRenderer; import org.apache.batik.gvt.renderer.ImageRendererFactory; @@ -178,8 +177,11 @@ public class PDFTranscoder extends XMLAbstractTranscoder { // build the GVT tree GVTBuilder builder = new GVTBuilder(); ImageRendererFactory rendFactory = new StaticRendererFactory(); - GraphicsNodeRenderContext rc = getRenderContext(stroke); - BridgeContext ctx = new BridgeContext(userAgent, rc); + BridgeContext ctx = new BridgeContext(userAgent); + TextPainter textPainter = null; + textPainter = new StrokingTextPainter(); + ctx.setTextPainter(textPainter); + PDFAElementBridge pdfAElementBridge = new PDFAElementBridge(); AffineTransform currentTransform = new AffineTransform(1, 0, 0, 1, 0, 0); pdfAElementBridge.setCurrentTransform(currentTransform); @@ -269,18 +271,16 @@ public class PDFTranscoder extends XMLAbstractTranscoder { graphics.setSVGDimension(docWidth, docHeight); currentTransform.setTransform(1, 0, 0, -1, 0, height); if (!stroke) { - TextPainter textPainter = null; textPainter = new PDFTextPainter(graphics.getFontState()); - rc.setTextPainter(textPainter); + ctx.setTextPainter(textPainter); } if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) { graphics.setBackgroundColor((Color)hints.get(ImageTranscoder.KEY_BACKGROUND_COLOR)); } graphics.setGraphicContext(new org.apache.batik.ext.awt.g2d.GraphicContext()); - graphics.setRenderingHints(rc.getRenderingHints()); - gvtRoot.paint(graphics, rc); + gvtRoot.paint(graphics); try { graphics.finish(); @@ -290,34 +290,6 @@ public class PDFTranscoder extends XMLAbstractTranscoder { } } - public GraphicsNodeRenderContext getRenderContext(boolean stroke) { - GraphicsNodeRenderContext nodeRenderContext = null; - if (nodeRenderContext == null) { - RenderingHints hints = new RenderingHints(null); - hints.put(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - - hints.put(RenderingHints.KEY_INTERPOLATION, - RenderingHints.VALUE_INTERPOLATION_BILINEAR); - - FontRenderContext fontRenderContext = - new FontRenderContext(new AffineTransform(), true, true); - - TextPainter textPainter = null; - textPainter = new StrokingTextPainter(); - - GraphicsNodeRableFactory gnrFactory = - new ConcreteGraphicsNodeRableFactory(); - - nodeRenderContext = - new GraphicsNodeRenderContext(new AffineTransform(), null, - hints, fontRenderContext, - textPainter, gnrFactory); - } - - return nodeRenderContext; - } - /** * Creates a <tt>DocumentFactory</tt> that is used to create an SVG DOM * tree. The specified DOM Implementation is ignored and the Batik |