1 17 18 19 20 package org.apache.fop.render.ps; 21 22 import org.apache.batik.bridge.SVGTextElementBridge; 23 import org.apache.batik.bridge.BridgeContext; 24 import org.apache.batik.gvt.GraphicsNode; 25 import org.apache.batik.gvt.TextNode; 26 27 import org.w3c.dom.Element ; 28 import org.w3c.dom.Node ; 29 30 38 public class PSTextElementBridge extends SVGTextElementBridge { 39 40 private PSTextPainter textPainter; 41 42 46 public PSTextElementBridge(PSTextPainter textPainter) { 47 this.textPainter = textPainter; 48 } 49 50 57 public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) { 58 GraphicsNode node = super.createGraphicsNode(ctx, e); 59 61 if (true) { 62 ((TextNode)node).setTextPainter(getTextPainter()); 63 } 64 return node; 65 } 66 67 private PSTextPainter getTextPainter() { 68 return this.textPainter; 69 } 70 71 85 private boolean isSimple(BridgeContext ctx, Element element, GraphicsNode node) { 86 for (Node n = element.getFirstChild(); 87 n != null; 88 n = n.getNextSibling()) { 89 90 switch (n.getNodeType()) { 91 case Node.ELEMENT_NODE: 92 93 if (n.getLocalName().equals(SVG_TSPAN_TAG) 94 || n.getLocalName().equals(SVG_ALT_GLYPH_TAG)) { 95 return false; 96 } else if (n.getLocalName().equals(SVG_TEXT_PATH_TAG)) { 97 return false; 98 } else if (n.getLocalName().equals(SVG_TREF_TAG)) { 99 return false; 100 } 101 break; 102 case Node.TEXT_NODE: 103 case Node.CDATA_SECTION_NODE: 104 default: 105 } 106 } 107 108 111 112 return true; 113 } 114 } 115 116 | Popular Tags |