protected void addChildGlyphPositionAttributes(AttributedString as, Element element, BridgeContext ctx) { // do the same for each child element for (Node child = getFirstChild(element); child != null; child = getNextSibling(child)) { if (child.getNodeType() != Node.ELEMENT_NODE) continue; Element childElement = (Element)child; if (isTextChild(childElement)) { addGlyphPositionAttributes(as, childElement, ctx); } } }
protected void addChildPaintAttributes(AttributedString as, Element element, TextNode node, TextPaintInfo parentPI, BridgeContext ctx) { // Add Paint attributres for children of text element for (Node child = getFirstChild(element); child != null; child = getNextSibling(child)) { if (child.getNodeType() != Node.ELEMENT_NODE) { continue; } Element childElement = (Element)child; if (isTextChild(childElement)) { TextPaintInfo pi = getTextPaintInfo(childElement, node, parentPI, ctx); addPaintAttributes(as, childElement, node, pi, ctx); } } }
protected Map getAttributeMap(BridgeContext ctx, Element element, TextPath textPath, Integer bidiLevel, Map result) { Map initialMap = super.getAttributeMap(ctx, element, textPath, bidiLevel, result); String s; s = element.getAttribute(BATIK_EXT_PREFORMATTED_ATTRIBUTE); if (s.length() != 0) { if (s.equals("true")) { result.put(PREFORMATTED, Boolean.TRUE); } } return initialMap; }
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { Node childNode = (Node)evt.getTarget(); //check the type of the node inserted before discard the layout //in the case of <title> or <desc> or <metadata>, the layout //is unchanged switch(childNode.getNodeType()) { case Node.TEXT_NODE: // fall-through is intended case Node.CDATA_SECTION_NODE: laidoutText = null; break; case Node.ELEMENT_NODE: { Element childElement = (Element)childNode; if (isTextChild(childElement)) { addContextToChild(ctx, childElement); laidoutText = null; } break; } } if (laidoutText == null) { computeLaidoutText(ctx, e, getTextNode()); } }
elemTPI.clear(); AttributedString as = buildAttributedString(ctx, e); if (as == null) { tn.setAttributedCharacterIterator(null); addGlyphPositionAttributes(as, e, ctx); if (ctx.isDynamic()) { laidoutText = new AttributedString(as.getIterator()); setBaseTextPaintInfo(pi, e, node, ctx); setDecorationTextPaintInfo(pi, e); addPaintAttributes(as, e, tn, pi, ctx); checkBBoxChange();
: new HashMap(initialAttributes); initialAttributes = getAttributeMap(ctx, element, textPath, bidiLevel, map); Object o = map.get(TextAttribute.BIDI_EMBEDDING); Integer subBidiLevel = bidiLevel; for (Node n = getFirstChild(element); n != null; n = getNextSibling(n)) { ln.equals(SVG_ALT_GLYPH_TAG)) { int before = asb.count; fillAttributedStringBuffer(ctx, nodeElement, false, if (newTextPath != null) { int before = asb.count; fillAttributedStringBuffer(ctx, nodeElement, false, Element ref = ctx.getReferencedElement((Element)n, uriStr); s = TextUtilities.getElementContent(ref); s = normalizeString(s, preserve, prevEndsWithSpace); if (s.length() != 0) { int trefStart = asb.length(); ? new HashMap()
return null; associateSVGContext(ctx, e, node); Node child = getFirstChild(e); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { addContextToChild(ctx,(Element)child); child = getNextSibling(child); node.setRenderingHints(hints); node.setLocation(getLocation(ctx, e));
Node child = getFirstChild(e); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { addContextToChild(ctx, (Element)child); child = getNextSibling(child);
addChildGlyphPositionAttributes(as, element, ctx); return; int firstChar = getElementStartIndex(element); int lastChar = getElementEndIndex(element); addChildGlyphPositionAttributes(as, element, ctx); return; addChildGlyphPositionAttributes(as, element, ctx); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex);
if (element.getLocalName() != BATIK_EXT_FLOW_TEXT_TAG) { super.addPaintAttributes(as, element, node, parentPI, ctx); return; if (ln.equals(BATIK_EXT_FLOW_DIV_TAG)) { super.addPaintAttributes(as, e, node, parentPI, ctx); return;
if (element.getLocalName() != BATIK_EXT_FLOW_TEXT_TAG) { super.addGlyphPositionAttributes(as, element, ctx); return; if (ln.equals(BATIK_EXT_FLOW_DIV_TAG)) { super.addGlyphPositionAttributes(as, e, ctx); return;
/** * Returns a new instance of this bridge. */ public Bridge getInstance() { return new SVGTextElementBridge(); }
/** * This method ensures that any modification to a text * element and its children is going to be reflected * into the GVT tree. */ protected void initializeDynamicSupport(BridgeContext ctx, Element e, GraphicsNode node) { super.initializeDynamicSupport(ctx, e, node); if (ctx.isDynamic()) { // Only add the listeners if we are dynamic. addTextEventListeners(ctx, (NodeEventTarget) e); } }
/** * Adds painting attributes to an AttributedString. */ protected void addPaintAttributes(AttributedString as, Element element, TextNode node, TextPaintInfo pi, BridgeContext ctx) { // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage' if ((!SVGUtilities.matchUserAgent(element, ctx.getUserAgent())) || (!CSSUtilities.convertDisplay(element))) { return; } Object o = elemTPI.get(element); if (o != null) { node.swapTextPaintInfo(pi, (TextPaintInfo)o); } addChildPaintAttributes(as, element, node, pi, ctx); }
elemTPI.clear(); AttributedString as = buildAttributedString(ctx, e); if (as == null) { tn.setAttributedCharacterIterator(null); addGlyphPositionAttributes(as, e, ctx); if (ctx.isDynamic()) { laidoutText = new AttributedString(as.getIterator()); setBaseTextPaintInfo(pi, e, node, ctx); setDecorationTextPaintInfo(pi, e); addPaintAttributes(as, e, tn, pi, ctx); checkBBoxChange();
: new HashMap(initialAttributes); initialAttributes = getAttributeMap(ctx, element, textPath, bidiLevel, map); Object o = map.get(TextAttribute.BIDI_EMBEDDING); Integer subBidiLevel = bidiLevel; for (Node n = getFirstChild(element); n != null; n = getNextSibling(n)) { ln.equals(SVG_ALT_GLYPH_TAG)) { int before = asb.count; fillAttributedStringBuffer(ctx, nodeElement, false, if (newTextPath != null) { int before = asb.count; fillAttributedStringBuffer(ctx, nodeElement, false, Element ref = ctx.getReferencedElement((Element)n, uriStr); s = TextUtilities.getElementContent(ref); s = normalizeString(s, preserve, prevEndsWithSpace); if (s.length() != 0) { int trefStart = asb.length(); ? new HashMap()
return null; associateSVGContext(ctx, e, node); Node child = getFirstChild(e); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { addContextToChild(ctx,(Element)child); child = getNextSibling(child); node.setRenderingHints(hints); node.setLocation(getLocation(ctx, e));
/** * Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. */ public void handleDOMNodeInsertedEvent(MutationEvent evt) { Node childNode = (Node)evt.getTarget(); //check the type of the node inserted before discard the layout //in the case of <title> or <desc> or <metadata>, the layout //is unchanged switch(childNode.getNodeType()) { case Node.TEXT_NODE: // fall-through is intended case Node.CDATA_SECTION_NODE: laidoutText = null; break; case Node.ELEMENT_NODE: { Element childElement = (Element)childNode; if (isTextChild(childElement)) { addContextToChild(ctx, childElement); laidoutText = null; } break; } } if (laidoutText == null) { computeLaidoutText(ctx, e, getTextNode()); } }
Node child = getFirstChild(e); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { addContextToChild(ctx, (Element)child); child = getNextSibling(child);
addChildGlyphPositionAttributes(as, element, ctx); return; int firstChar = getElementStartIndex(element); int lastChar = getElementEndIndex(element); addChildGlyphPositionAttributes(as, element, ctx); return; addChildGlyphPositionAttributes(as, element, ctx); } catch (LiveAttributeException ex) { throw new BridgeException(ctx, ex);