aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/svg/SVGElementMapping.java
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-11-02 07:45:18 +0000
committerKeiron Liddle <keiron@apache.org>2001-11-02 07:45:18 +0000
commit4cf83fe1e5dab96e2e348877b0e43d8abdc6c0d9 (patch)
tree7775bd735536527bca329a5a35bc3486e441f35b /src/org/apache/fop/svg/SVGElementMapping.java
parentcaeb7b6fb44928f710a272d4495a687bd3e353e2 (diff)
downloadxmlgraphics-fop-4cf83fe1e5dab96e2e348877b0e43d8abdc6c0d9.tar.gz
xmlgraphics-fop-4cf83fe1e5dab96e2e348877b0e43d8abdc6c0d9.zip
svg renderer now basically works, pages, text, leader, svg
some other misc updates to areas git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194534 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/svg/SVGElementMapping.java')
-rw-r--r--src/org/apache/fop/svg/SVGElementMapping.java140
1 files changed, 73 insertions, 67 deletions
diff --git a/src/org/apache/fop/svg/SVGElementMapping.java b/src/org/apache/fop/svg/SVGElementMapping.java
index 012cd9b89..dc7df3dfb 100644
--- a/src/org/apache/fop/svg/SVGElementMapping.java
+++ b/src/org/apache/fop/svg/SVGElementMapping.java
@@ -17,78 +17,84 @@ import org.apache.fop.fo.ElementMapping;
import org.apache.fop.apps.Driver;
import org.apache.batik.util.XMLResourceDescriptor;
+import org.apache.batik.dom.svg.SVGDOMImplementation;
public class SVGElementMapping implements ElementMapping {
- private static HashMap foObjs = null;
-
- public synchronized void addToBuilder(TreeBuilder builder) {
+ private static HashMap foObjs = null;
- if(foObjs == null) {
- // this sets the parser that will be used
- // by default (SVGBrokenLinkProvider)
- // normally the user agent value is used
- XMLResourceDescriptor.setXMLParserClassName(Driver.getParserClassName());
-
- foObjs = new HashMap();
- foObjs.put("svg", SVGElement.maker());
- foObjs.put("rect", SVGObj.maker("rect"));
- foObjs.put("line", SVGObj.maker("line"));
- foObjs.put("text", SVGObj.maker("text"));
-
- foObjs.put("desc", SVGObj.maker("desc"));
- foObjs.put("title", SVGObj.maker("title"));
- foObjs.put("circle", SVGObj.maker("circle"));
- foObjs.put("ellipse", SVGObj.maker("ellipse"));
- foObjs.put("g", SVGObj.maker("g"));
- foObjs.put("polyline", SVGObj.maker("polyline"));
- foObjs.put("polygon", SVGObj.maker("polygon"));
- foObjs.put("defs", SVGObj.maker("defs"));
- foObjs.put("path", SVGObj.maker("path"));
- foObjs.put("use", SVGObj.maker("use"));
- foObjs.put("tspan", SVGObj.maker("tspan"));
- foObjs.put("tref", SVGObj.maker("tref"));
- foObjs.put("image", SVGObj.maker("image"));
- foObjs.put("style", SVGObj.maker("style"));
-
- foObjs.put("textPath", SVGObj.maker("textPath"));
- foObjs.put("clipPath", SVGObj.maker("clipPath"));
- foObjs.put("mask", SVGObj.maker("mask"));
- foObjs.put("linearGradient", SVGObj.maker("linearGradient"));
- foObjs.put("radialGradient", SVGObj.maker("radialGradient"));
- foObjs.put("stop", SVGObj.maker("stop"));
- foObjs.put("a", SVGObj.maker("a"));
- foObjs.put("switch", SVGObj.maker("switch"));
- foObjs.put("symbol", SVGObj.maker("symbol"));
-
- foObjs.put("pattern", SVGObj.maker("pattern"));
-
- foObjs.put("marker", SVGObj.maker("marker"));
- foObjs.put("animate", SVGObj.maker("animate"));
- foObjs.put("altGlyph", SVGObj.maker("altGlyph"));
- foObjs.put("font", SVGObj.maker("font"));
- foObjs.put("glyph", SVGObj.maker("glyph"));
- foObjs.put("missing-glyph", SVGObj.maker("missing-glyph"));
- foObjs.put("hkern", SVGObj.maker("hkern"));
- foObjs.put("vkern", SVGObj.maker("vkern"));
- foObjs.put("set", SVGObj.maker("set"));
- foObjs.put("animateMotion", SVGObj.maker("animateMotion"));
- foObjs.put("animateColor", SVGObj.maker("animateColor"));
- foObjs.put("animateTransform", SVGObj.maker("animateTransform"));
- foObjs.put("cursor", SVGObj.maker("cursor"));
- foObjs.put("filter", SVGObj.maker("filter"));
-
- foObjs.put("feFlood", SVGObj.maker("feFlood"));
- foObjs.put("feGaussianBlur", SVGObj.maker("feGaussianBlur"));
- foObjs.put("feOffset", SVGObj.maker("feOffset"));
- foObjs.put("feMerge", SVGObj.maker("feMerge"));
- foObjs.put("feMergeNode", SVGObj.maker("feMergeNode"));
+ public synchronized void addToBuilder(TreeBuilder builder) {
+ try {
+ if (foObjs == null) {
+ // this sets the parser that will be used
+ // by default (SVGBrokenLinkProvider)
+ // normally the user agent value is used
+ XMLResourceDescriptor.setXMLParserClassName(
+ Driver.getParserClassName());
+
+ foObjs = new HashMap();
+ foObjs.put("svg", SVGElement.maker());
+ foObjs.put("rect", SVGObj.maker("rect"));
+ foObjs.put("line", SVGObj.maker("line"));
+ foObjs.put("text", SVGObj.maker("text"));
+
+ foObjs.put("desc", SVGObj.maker("desc"));
+ foObjs.put("title", SVGObj.maker("title"));
+ foObjs.put("circle", SVGObj.maker("circle"));
+ foObjs.put("ellipse", SVGObj.maker("ellipse"));
+ foObjs.put("g", SVGObj.maker("g"));
+ foObjs.put("polyline", SVGObj.maker("polyline"));
+ foObjs.put("polygon", SVGObj.maker("polygon"));
+ foObjs.put("defs", SVGObj.maker("defs"));
+ foObjs.put("path", SVGObj.maker("path"));
+ foObjs.put("use", SVGObj.maker("use"));
+ foObjs.put("tspan", SVGObj.maker("tspan"));
+ foObjs.put("tref", SVGObj.maker("tref"));
+ foObjs.put("image", SVGObj.maker("image"));
+ foObjs.put("style", SVGObj.maker("style"));
+
+ foObjs.put("textPath", SVGObj.maker("textPath"));
+ foObjs.put("clipPath", SVGObj.maker("clipPath"));
+ foObjs.put("mask", SVGObj.maker("mask"));
+ foObjs.put("linearGradient", SVGObj.maker("linearGradient"));
+ foObjs.put("radialGradient", SVGObj.maker("radialGradient"));
+ foObjs.put("stop", SVGObj.maker("stop"));
+ foObjs.put("a", SVGObj.maker("a"));
+ foObjs.put("switch", SVGObj.maker("switch"));
+ foObjs.put("symbol", SVGObj.maker("symbol"));
+
+ foObjs.put("pattern", SVGObj.maker("pattern"));
+
+ foObjs.put("marker", SVGObj.maker("marker"));
+ foObjs.put("animate", SVGObj.maker("animate"));
+ foObjs.put("altGlyph", SVGObj.maker("altGlyph"));
+ foObjs.put("font", SVGObj.maker("font"));
+ foObjs.put("glyph", SVGObj.maker("glyph"));
+ foObjs.put("missing-glyph", SVGObj.maker("missing-glyph"));
+ foObjs.put("hkern", SVGObj.maker("hkern"));
+ foObjs.put("vkern", SVGObj.maker("vkern"));
+ foObjs.put("set", SVGObj.maker("set"));
+ foObjs.put("animateMotion", SVGObj.maker("animateMotion"));
+ foObjs.put("animateColor", SVGObj.maker("animateColor"));
+ foObjs.put("animateTransform", SVGObj.maker("animateTransform"));
+ foObjs.put("cursor", SVGObj.maker("cursor"));
+ foObjs.put("filter", SVGObj.maker("filter"));
+
+ foObjs.put("feFlood", SVGObj.maker("feFlood"));
+ foObjs.put("feGaussianBlur", SVGObj.maker("feGaussianBlur"));
+ foObjs.put("feOffset", SVGObj.maker("feOffset"));
+ foObjs.put("feMerge", SVGObj.maker("feMerge"));
+ foObjs.put("feMergeNode", SVGObj.maker("feMergeNode"));
+ }
+
+ String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
+ builder.addMapping(svgNS, foObjs);
+
+ builder.addPropertyListBuilder(svgNS,
+ new DirectPropertyListBuilder());
+ } catch (Throwable t) {
+ // if the classes are not available
}
-
- String uri = "http://www.w3.org/2000/svg";
- builder.addMapping(uri, foObjs);
-
- builder.addPropertyListBuilder(uri, new DirectPropertyListBuilder());
}
}