org.apache.batik.bridge
public class SVGTextElementBridge extends AbstractGraphicsNodeBridge implements SVGTextContent
Nested Class Summary | |
---|---|
protected abstract class | SVGTextElementBridge.AbstractTextChildBridgeUpdateHandler
Implementation for the BridgeUpdateHandler
for the child elements of <text>.
|
abstract class | SVGTextElementBridge.AbstractTextChildSVGContext
Implementation of SVGContext for
the children of <text> |
protected class | SVGTextElementBridge.AbstractTextChildTextContent |
protected static class | SVGTextElementBridge.AttributedStringBuffer
This class is used to build an AttributedString. |
protected static class | SVGTextElementBridge.CharacterInformation
Helper class to collect information about one Glyph
in the GlyphVector |
protected class | SVGTextElementBridge.DOMChildNodeRemovedEventListener
The DOM EventListener invoked when a node is removed. |
protected class | SVGTextElementBridge.DOMSubtreeModifiedEventListener
The DOM EventListener invoked when the subtree is modified. |
protected class | SVGTextElementBridge.TextPathBridge
BridgeUpdateHandle for <textPath> element. |
protected class | SVGTextElementBridge.TRefBridge
BridgeUpdateHandle for <tref> element. |
protected class | SVGTextElementBridge.TspanBridge
BridgeUpdateHandle for <tspan> element. |
Field Summary | |
---|---|
static Attribute | ALT_GLYPH_HANDLER |
static Attribute | ANCHOR_TYPE |
static Attribute | BASELINE_SHIFT |
protected SVGTextElementBridge.DOMChildNodeRemovedEventListener | childNodeRemovedEventListener
The DOM EventListener to receive 'DOMNodeRemoved' event. |
protected WeakHashMap | elemTPI |
protected int | endLimit
This is used to store the end of the last piece of text
content from an element with xml:space="preserve". |
static Attribute | GVT_FONTS |
static Attribute | GVT_FONT_FAMILIES |
protected AttributedString | laidoutText |
static Attribute | PAINT_INFO |
protected SVGTextElementBridge.DOMSubtreeModifiedEventListener | subtreeModifiedEventListener
The DOM EventListener to receive 'DOMSubtreeModified' event. |
static Attribute | TEXTPATH |
static Attribute | TEXT_COMPOUND_DELIMITER |
static Attribute | TEXT_COMPOUND_ID |
protected boolean | usingComplexSVGFont |
protected static Integer | ZERO |
Constructor Summary | |
---|---|
SVGTextElementBridge()
Constructs a new bridge for the <text> element. |
Method Summary | |
---|---|
protected void | addChildGlyphPositionAttributes(AttributedString as, Element element, BridgeContext ctx) |
protected void | addChildPaintAttributes(AttributedString as, Element element, TextNode node, TextPaintInfo parentPI, BridgeContext ctx) |
protected void | addContextToChild(BridgeContext ctx, Element e)
Add to the element children of the node, an
SVGContext to support dynamic update. |
protected void | addGlyphPositionAttributes(AttributedString as, Element element, BridgeContext ctx)
Adds glyph position attributes to an AttributedString. |
protected void | addPaintAttributes(AttributedString as, Element element, TextNode node, TextPaintInfo pi, BridgeContext ctx)
Adds painting attributes to an AttributedString. |
protected void | addTextEventListeners(BridgeContext ctx, NodeEventTarget e)
Adds the DOM listeners for this text bridge. |
protected AttributedString | buildAttributedString(BridgeContext ctx, Element element)
Creates the attributed string which represents the given text
element children.
|
void | buildGraphicsNode(BridgeContext ctx, Element e, GraphicsNode node)
Builds using the specified BridgeContext and element, the
specified graphics node.
|
protected void | computeLaidoutText(BridgeContext ctx, Element e, GraphicsNode node)
Recompute the layout of the <text> node.
|
GraphicsNode | createGraphicsNode(BridgeContext ctx, Element e)
Creates a GraphicsNode according to the specified parameters.
|
void | dispose()
Disposes this text element bridge by removing the text event listeners
that were added in SVGTextElementBridge. |
protected float | distanceBetweenRun(SVGTextElementBridge.CharacterInformation last, SVGTextElementBridge.CharacterInformation first) |
protected float | distanceFirstLastCharacterInRun(SVGTextElementBridge.CharacterInformation first, SVGTextElementBridge.CharacterInformation last) |
protected void | fillAttributedStringBuffer(BridgeContext ctx, Element element, boolean top, TextPath textPath, Integer bidiLevel, Map initialAttributes, SVGTextElementBridge.AttributedStringBuffer asb)
Fills the given AttributedStringBuffer. |
protected Map | getAttributeMap(BridgeContext ctx, Element element, TextPath textPath, Integer bidiLevel, Map result)
Returns the map to pass to the current characters.
|
protected SVGTextElementBridge.CharacterInformation | getCharacterInformation(List list, int startIndex, int charnum, AttributedCharacterIterator aci)
Retrieve the information about a character
of en element. |
int | getCharNumAtPosition(float x, float y) |
protected int | getCharNumAtPosition(Element e, float x, float y) |
float | getComputedTextLength() |
protected float | getComputedTextLength(Element e)
Implementation of org.w3c.dom.svg.SVGTextContentElement#getComputedTextLength(). |
protected Point2D | getEndPoint(SVGTextElementBridge.CharacterInformation info) |
Point2D | getEndPositionOfChar(int charnum) |
protected Point2D | getEndPositionOfChar(Element element, int charnum)
Implementation of org.w3c.dom.svg.SVGTextContentElement#getEndPositionOfChar(int charnum). |
Rectangle2D | getExtentOfChar(int charnum) |
protected Rectangle2D | getExtentOfChar(Element element, int charnum)
Implementation of org.w3c.dom.svg.SVGTextContentElement#getExtentOfChar(int charnum). |
protected Node | getFirstChild(Node n)
Returns the first child node of the given node that should be
processed by the text bridge. |
protected List | getFontList(BridgeContext ctx, Element element, Map result)
This method adds all the font related properties to result
It also builds a List of the GVTFonts and returns it. |
Bridge | getInstance()
Returns a new instance of this bridge. |
String | getLocalName()
Returns 'text'. |
protected Point2D | getLocation(BridgeContext ctx, Element e)
Returns the text node location according to the 'x' and 'y'
attributes of the specified text element.
|
protected Node | getNextSibling(Node n)
Returns the next sibling node of the given node that should be
processed by the text bridge. |
int | getNumberOfChars() |
protected int | getNumberOfChars(Element element)
Implementation of org.w3c.dom.svg.SVGTextContentElement#getNumberOfChars(). |
protected Node | getParentNode(Node n)
Returns the parent node of the given node that should be
processed by the text bridge. |
protected TextPaintInfo | getParentTextPaintInfo(Element child)
Retrieve in the AttributeString the closest parent
of the node 'child' and extract the text decorations
of the parent.
|
float | getRotationOfChar(int charnum) |
protected float | getRotationOfChar(Element element, int charnum)
Implementation of org.w3c.dom.svg.SVGTextContentElement#getRotationOfChar(int charnum). |
protected Point2D | getStartPoint(SVGTextElementBridge.CharacterInformation info) |
Point2D | getStartPositionOfChar(int charnum) |
protected Point2D | getStartPositionOfChar(Element element, int charnum)
Implementation of org.w3c.dom.svg.SVGTextContentElement#getStartPositionOfChar(int charnum). |
float | getSubStringLength(int charnum, int nchars) |
protected float | getSubStringLength(Element element, int charnum, int nchars)
Implementation of org.w3c.dom.svg.SVGTextContentElement#getSubStringLength(int charnum,int nchars). |
static Rectangle2D | getTextBounds(BridgeContext ctx, Element elem, boolean checkSensitivity) |
Set | getTextEnclosureSet(AffineTransform at, Rectangle2D rect) |
static boolean | getTextIntersection(BridgeContext ctx, Element elem, AffineTransform ati, Rectangle2D rect, boolean checkSensitivity) |
Set | getTextIntersectionSet(AffineTransform at, Rectangle2D rect) |
protected TextNode | getTextNode() |
protected TextPaintInfo | getTextPaintInfo(Element element, GraphicsNode node, TextPaintInfo parentTPI, BridgeContext ctx)
Constructs a TextDecoration object for the specified element. |
protected List | getTextRuns(TextNode node)
Retrieve the list of layout for the
text node. |
void | handleAnimatedAttributeChanged(AnimatedLiveAttributeValue alav)
Invoked when the animated value of an animatable attribute has changed. |
void | handleCSSEngineEvent(CSSEngineEvent evt)
Invoked when CSS properties have changed on an element.
|
protected void | handleCSSPropertyChanged(int property)
Invoked for each CSS property that has changed. |
void | handleDOMCharacterDataModified(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMCharacterDataModified'
is fired. |
void | handleDOMChildNodeRemovedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired. |
void | handleDOMNodeInsertedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. |
void | handleDOMSubtreeModifiedEvent(MutationEvent evt)
Invoked when an MutationEvent of type 'DOMSubtree' is fired. |
protected void | initializeDynamicSupport(BridgeContext ctx, Element e, GraphicsNode node)
This method ensures that any modification to a text
element and its children is going to be reflected
into the GVT tree. |
protected GraphicsNode | instantiateGraphicsNode()
Creates the GraphicsNode depending on the GraphicsNodeBridge
implementation. |
boolean | isComposite()
Returns false as text is not a container. |
protected boolean | isParentDisplayed(Node childNode)
Indicate of the parent of a node is
a displayed element.
|
protected boolean | isTextChild(Element e) |
protected boolean | isTextElement(Element e) |
static boolean | isTextSensitive(Element e) |
protected boolean | nodeAncestorOf(Node node1, Node node2)
Returns true if node1 is an ancestor of node2 |
protected String | normalizeString(String s, boolean preserve, boolean stripfirst)
Normalizes the given string. |
protected void | rebuildACI() |
protected void | removeContextFromChild(BridgeContext ctx, Element e)
From the SVGContext from the element children of the node.
|
protected void | removeTextEventListeners(BridgeContext ctx, NodeEventTarget e)
Removes the DOM listeners for this text bridge. |
void | selectSubString(int charnum, int nchars) |
protected void | selectSubString(Element element, int charnum, int nchars)
Select an ensemble of characters for that element.
|
void | setBaseTextPaintInfo(TextPaintInfo pi, Element element, GraphicsNode node, BridgeContext ctx) |
void | setDecorationTextPaintInfo(TextPaintInfo pi, Element element) |
SVGContext
to support dynamic update. This is
recursive, the children of the nodes are also traversed to add
to the support elements their context
Parameters: ctx a BridgeContext
value e an Element
value
See Also: SVGContext BridgeUpdateHandler
Parameters: ctx the bridge context to use element the text element
Parameters: ctx the bridge context to use e the element that describes the graphics node to build node the graphics node to build
laidoutText
with the new
value.Parameters: ctx the bridge context to use e the element that describes the graphics node to build
Returns: a graphics node that represents the specified element
Parameters: ctx the BridgeContext to use for throwing exceptions element the text element whose attributes are being collected textPath the text path that the characters of element
will be placed along bidiLevel the bidi level of element
result a Map into which the attributes of element
's
characters will be stored
Returns: a new Map that contains the attributes that must be inherited into a child element if the given element has no characters before the child element
Parameters: list list of the layouts startIndex index in the ACI of the first character for the element charnum index of the character (among the characters of the element) looked for.
Returns: information about the glyph representing the character
Parameters: ctx the bridge context to use e the text element
Parameters: child an Element
value
Returns: a TextDecoration
value
Parameters: evt the CSSEngine event that describes the update
Returns: true if the parent of the node is <text>, <tspan>, <tref>, <textPath>, <a>, <altGlyph>
SVGContext
from the element children of the node.
Parameters: ctx the BridgeContext
for the document e the Element
whose subtree's elements will have
threir SVGContext
s removed
See Also: SVGContext BridgeUpdateHandler