summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2015-08-10 12:13:36 +0000
committerSimon Steiner <ssteiner@apache.org>2015-08-10 12:13:36 +0000
commiteb8f9e82d215f6daae9a0702063b0ab86ef859b3 (patch)
tree2f643e08b56cce92b8c8e9d6c41db34081fd9626 /src/java
parent2e1089dd671b8d2283d245972a1bfd93e9d0daa0 (diff)
downloadxmlgraphics-fop-eb8f9e82d215f6daae9a0702063b0ab86ef859b3.tar.gz
xmlgraphics-fop-eb8f9e82d215f6daae9a0702063b0ab86ef859b3.zip
FOP-2473: SVG text using filters not shown
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1695041 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java3
-rw-r--r--src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java15
2 files changed, 16 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java b/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
index fac9f4005..d2f05106f 100644
--- a/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
+++ b/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
@@ -49,6 +49,7 @@ import org.apache.fop.render.ImageHandler;
import org.apache.fop.render.ImageHandlerUtil;
import org.apache.fop.render.RenderingContext;
import org.apache.fop.render.pdf.PDFLogicalStructureHandler.MarkedContentInfo;
+import org.apache.fop.render.ps.PSImageHandlerSVG;
import org.apache.fop.svg.PDFAElementBridge;
import org.apache.fop.svg.PDFBridgeContext;
import org.apache.fop.svg.PDFGraphics2D;
@@ -85,7 +86,7 @@ public class PDFImageHandlerSVG implements ImageHandler {
GVTBuilder builder = new GVTBuilder();
//Controls whether text painted by Batik is generated using text or path operations
- boolean strokeText = false;
+ boolean strokeText = PSImageHandlerSVG.shouldStrokeText(imageSVG.getDocument().getChildNodes());
//TODO connect with configuration elsewhere.
BridgeContext ctx = new PDFBridgeContext(ua,
diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java b/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java
index 6d277f2f0..c679d7d75 100644
--- a/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java
+++ b/src/java/org/apache/fop/render/ps/PSImageHandlerSVG.java
@@ -103,7 +103,7 @@ public class PSImageHandlerSVG implements ImageHandler {
PSImageUtils.writeImage(encoder, imgDim, imgDescription, targetRect, cm, gen, ri, mi.getMaskColor());
} else {
//Controls whether text painted by Batik is generated using text or path operations
- boolean strokeText = false;
+ boolean strokeText = shouldStrokeText(imageSVG.getDocument().getChildNodes());
//TODO Configure text stroking
SVGUserAgent ua = new SVGUserAgent(context.getUserAgent(),
@@ -327,6 +327,19 @@ public class PSImageHandlerSVG implements ImageHandler {
return opacityFound;
}
+ public static boolean shouldStrokeText(NodeList childNodes) {
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node curNode = childNodes.item(i);
+ if (shouldStrokeText(curNode.getChildNodes())) {
+ return true;
+ }
+ if ("text".equals(curNode.getLocalName())) {
+ return curNode.getAttributes().getNamedItem("filter") != null;
+ }
+ }
+ return false;
+ }
+
/** {@inheritDoc} */
public int getPriority() {
return 400;