You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/11/09 16:42:54 UTC
svn commit: r332070 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java
Author: jeremias
Date: Wed Nov 9 07:42:51 2005
New Revision: 332070
URL: http://svn.apache.org/viewcvs?rev=332070&view=rev
Log:
Bugzilla #37330:
Fix for bridge registration.
Submitted by: Thomas Deweese <deweese.at.apache.org>
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java?rev=332070&r1=332069&r2=332070&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java Wed Nov 9 07:42:51 2005
@@ -30,8 +30,6 @@
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.ext.awt.RenderingHintsKeyExt;
-import org.apache.batik.gvt.TextPainter;
-import org.apache.batik.gvt.renderer.StrokingTextPainter;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.ImageTranscoder;
@@ -69,6 +67,8 @@
implements Configurable {
private Configuration cfg = null;
+
+ /** Graphics2D instance that is used to paint to */
protected PDFDocumentGraphics2D graphics = null;
/**
@@ -149,10 +149,12 @@
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.setTransform(curTxf);
+ graphics.preparePainting();
+
+ graphics.transform(curTxf);
graphics.setRenderingHint
(RenderingHintsKeyExt.KEY_TRANSCODING,
RenderingHintsKeyExt.VALUE_TRANSCODING_VECTOR);
@@ -165,31 +167,49 @@
}
}
+ /** @see org.apache.batik.transcoder.SVGAbstractTranscoder#createBridgeContext() */
protected BridgeContext createBridgeContext() {
- /*boolean stroke = true;
- if (hints.containsKey(KEY_STROKE_TEXT)) {
- stroke = ((Boolean)hints.get(KEY_STROKE_TEXT)).booleanValue();
- }*/
-
- BridgeContext ctx = new BridgeContext(userAgent);
- TextPainter textPainter = null;
- textPainter = new StrokingTextPainter();
- ctx.setTextPainter(textPainter);
- /*if (!stroke) {
- textPainter = new PDFTextPainter(graphics.getFontInfo());
- ctx.setTextPainter(textPainter);
- }*/
-
- PDFTextElementBridge pdfTextElementBridge;
- pdfTextElementBridge = new PDFTextElementBridge(graphics.getFontInfo());
- ctx.putBridge(pdfTextElementBridge);
-
- PDFAElementBridge pdfAElementBridge = new PDFAElementBridge();
- AffineTransform currentTransform = new AffineTransform(1, 0, 0, 1, 0, 0);
- pdfAElementBridge.setCurrentTransform(currentTransform);
- ctx.putBridge(pdfAElementBridge);
- ctx.putBridge(new PDFImageElementBridge());
+ BridgeContext ctx = new PDFBridgeContext(userAgent);
+
return ctx;
+ }
+
+ /**
+ * BridgeContext which registers the custom bridges for PDF output.
+ */
+ public class PDFBridgeContext extends BridgeContext {
+ /**
+ * Constructs a new bridge context.
+ * @param userAgent the user agent
+ */
+ public PDFBridgeContext(UserAgent userAgent) {
+ super(userAgent);
+ }
+
+ /** @see org.apache.batik.bridge.BridgeContext#registerSVGBridges() */
+ public void registerSVGBridges() {
+ super.registerSVGBridges();
+
+ /*
+ boolean stroke = true;
+ if (hints.containsKey(KEY_STROKE_TEXT)) {
+ stroke = ((Boolean)hints.get(KEY_STROKE_TEXT)).booleanValue();
+ }
+ if (!stroke) {
+ textPainter = new PDFTextPainter(graphics.getFontInfo());
+ ctx.setTextPainter(textPainter);
+ }
+ */
+
+ putBridge(new PDFTextElementBridge(graphics.getFontInfo()));
+
+ PDFAElementBridge pdfAElementBridge = new PDFAElementBridge();
+ pdfAElementBridge.setCurrentTransform(new AffineTransform());
+ putBridge(pdfAElementBridge);
+
+ putBridge(new PDFImageElementBridge());
+ }
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org