|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.batik.bridge.AbstractSVGBridge
org.apache.batik.bridge.AbstractGraphicsNodeBridge
org.apache.batik.bridge.SVGTextElementBridge
Bridge class for the <text> element.
| Nested Class Summary | |
protected class |
SVGTextElementBridge.AbstractTextChildBridgeUpdateHandler
Implementation for the BridgeUpdateHandler
for the child elements of <text>. |
protected class |
SVGTextElementBridge.AbstractTextChildSVGContext
Implementation of |
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 | |
protected SVGTextElementBridge.DOMChildNodeRemovedEventListener |
childNodeRemovedEventListener
The DOM EventListener to receive 'DOMNodeRemoved' event. |
protected java.util.WeakHashMap |
elemTPI
|
protected java.text.AttributedString |
laidoutText
|
static java.text.AttributedCharacterIterator.Attribute |
PAINT_INFO
|
protected SVGTextElementBridge.DOMSubtreeModifiedEventListener |
subtreeModifiedEventListener
The DOM EventListener to receive 'DOMSubtreeModified' event. |
static java.text.AttributedCharacterIterator.Attribute |
TEXT_COMPOUND_DELIMITER
|
protected boolean |
usingComplexSVGFont
|
protected static java.lang.Integer |
ZERO
|
| Fields inherited from class org.apache.batik.bridge.AbstractGraphicsNodeBridge |
ctx, e, node |
| Fields inherited from interface org.apache.batik.bridge.ErrorConstants |
ERR_ATTRIBUTE_MISSING, ERR_ATTRIBUTE_VALUE_MALFORMED, ERR_CSS_LENGTH_NEGATIVE, ERR_CSS_URI_BAD_TARGET, ERR_LENGTH_NEGATIVE, ERR_URI_BAD_TARGET, ERR_URI_IMAGE_INVALID, ERR_URI_IO, ERR_URI_MALFORMED, ERR_URI_REFERENCE_A_DOCUMENT, ERR_URI_UNSECURE, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES, MSG_BROKEN_LINK_TITLE |
| Constructor Summary | |
SVGTextElementBridge()
Constructs a new bridge for the <text> element. |
|
| Method Summary | |
protected void |
addChildGlyphPositionAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
|
protected void |
addChildNullPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
|
protected void |
addChildPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
TextNode node,
TextPaintInfo parentPI,
BridgeContext ctx)
|
protected void |
addContextToChild(BridgeContext ctx,
org.w3c.dom.Element e)
Add to the element children of the node, a SVGContext to support dynamic updated . |
protected void |
addGlyphPositionAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
Adds glyph position attributes to an AttributedString. |
protected void |
addNullPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
This creates 'dummy' TPI objects for each element and records them in the elemTPI map so we can later update them with the correct paint attributes. |
protected void |
addPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
TextNode node,
TextPaintInfo pi,
BridgeContext ctx)
Adds painting attributes to an AttributedString. |
protected java.text.AttributedString |
buildAttributedString(BridgeContext ctx,
org.w3c.dom.Element element)
Creates the attributed string which represents the given text element children. |
void |
buildGraphicsNode(BridgeContext ctx,
org.w3c.dom.Element e,
GraphicsNode node)
Builds using the specified BridgeContext and element, the specified graphics node. |
protected void |
computeLaidoutText(BridgeContext ctx,
org.w3c.dom.Element e,
GraphicsNode node)
Recompute the layout of the <text> node. |
GraphicsNode |
createGraphicsNode(BridgeContext ctx,
org.w3c.dom.Element e)
Creates a GraphicsNode according to the specified parameters. |
protected float |
distanceBetweenRun(SVGTextElementBridge.CharacterInformation last,
SVGTextElementBridge.CharacterInformation first)
|
protected float |
distanceFirstLastCharacterInRun(SVGTextElementBridge.CharacterInformation first,
SVGTextElementBridge.CharacterInformation last)
|
protected void |
fillAttributedStringBuffer(BridgeContext ctx,
org.w3c.dom.Element element,
boolean top,
TextPath textPath,
java.lang.Integer bidiLevel,
SVGTextElementBridge.AttributedStringBuffer asb)
Fills the given AttributedStringBuffer. |
protected java.util.Map |
getAttributeMap(BridgeContext ctx,
org.w3c.dom.Element element,
TextPath textPath,
java.lang.Integer bidiLevel)
Returns the map to pass to the current characters. |
protected SVGTextElementBridge.CharacterInformation |
getCharacterInformation(java.util.List list,
int startIndex,
int charnum,
java.text.AttributedCharacterIterator aci)
Retrieve the information about a character of en element. |
protected int |
getCharNumAtPosition(org.w3c.dom.Element e,
float x,
float y)
|
int |
getCharNumAtPosition(float x,
float y)
|
float |
getComputedTextLength()
|
protected float |
getComputedTextLength(org.w3c.dom.Element e)
Implementation of SVGTextContentElement.getComputedTextLength(). |
protected java.awt.geom.Point2D |
getEndPoint(SVGTextElementBridge.CharacterInformation info)
|
protected java.awt.geom.Point2D |
getEndPositionOfChar(org.w3c.dom.Element element,
int charnum)
Implementation of SVGTextContentElement.getEndPositionOfChar(int charnum). |
java.awt.geom.Point2D |
getEndPositionOfChar(int charnum)
Returns the current text position after rendering the character in the user coordinate system for rendering the glyph(s) that correspond to the specified character. |
protected java.awt.geom.Rectangle2D |
getExtentOfChar(org.w3c.dom.Element element,
int charnum)
Implementation of SVGTextContentElement.getExtentOfChar(int charnum). |
java.awt.geom.Rectangle2D |
getExtentOfChar(int charnum)
Returns a tightest rectangle which defines the minimum and maximum X and Y values in the user coordinate system for rendering the glyph(s) that correspond to the specified character. |
Bridge |
getInstance()
Returns a new instance of this bridge. |
java.lang.String |
getLocalName()
Returns 'text'. |
protected java.awt.geom.Point2D |
getLocation(BridgeContext ctx,
org.w3c.dom.Element e)
Returns the text node location according to the 'x' and 'y' attributes of the specified text element. |
int |
getNumberOfChars()
Returns the total number of characters to be rendered within the current element. |
protected int |
getNumberOfChars(org.w3c.dom.Element element)
Implementation of SVGTextContentElement.getNumberOfChars(). |
protected TextPaintInfo |
getParentTextPaintInfo(java.text.AttributedCharacterIterator aci,
org.w3c.dom.Element child)
Retrieve in the AttributeString the closest parent of the node 'child' and extract the text decorations of the parent. |
protected float |
getRotationOfChar(org.w3c.dom.Element element,
int charnum)
Implementation of SVGTextContentElement.getRotationOfChar(int charnum). |
float |
getRotationOfChar(int charnum)
Returns the rotation value relative to the current user coordinate system used to render the glyph(s) corresponding to the specified character. |
protected java.awt.geom.Point2D |
getStartPoint(SVGTextElementBridge.CharacterInformation info)
|
protected java.awt.geom.Point2D |
getStartPositionOfChar(org.w3c.dom.Element element,
int charnum)
Implementation of SVGTextContentElement.getStartPositionOfChar(int charnum). |
java.awt.geom.Point2D |
getStartPositionOfChar(int charnum)
Returns the current text position before rendering the character in the user coordinate system for rendering the glyph(s) that correspond to the specified character. |
protected float |
getSubStringLength(org.w3c.dom.Element element,
int charnum,
int nchars)
Implementation of SVGTextContentElement.getSubStringLength(int charnum,int nchars). |
float |
getSubStringLength(int charnum,
int nchars)
|
protected TextPaintInfo |
getTextPaintInfo(org.w3c.dom.Element element,
GraphicsNode node,
TextPaintInfo parent,
BridgeContext ctx)
Constructs a TextDecoration object for the specified element. |
protected java.util.List |
getTextRuns(TextNode node)
Retrieve the list of layout for the text node. |
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 |
handleDOMAttrModifiedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMAttrModified' is fired. |
void |
handleDOMCharacterDataModified(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMCharacterDataModified' is fired. |
void |
handleDOMChildNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeRemoved' is fired. |
void |
handleDOMNodeInsertedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. |
void |
handleDOMNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMNodeInserted' is fired. |
void |
handleDOMSubtreeModifiedEvent(org.w3c.dom.events.MutationEvent evt)
Invoked when an MutationEvent of type 'DOMSubtree' is fired. |
protected void |
initializeDynamicSupport(BridgeContext ctx,
org.w3c.dom.Element e,
GraphicsNode node)
This method insures 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(org.w3c.dom.Node childNode)
Indicate of the parent of a node is a displayed element. |
protected boolean |
nodeAncestorOf(org.w3c.dom.Node node1,
org.w3c.dom.Node node2)
Returns true if node1 is an ancestor of node2 |
protected java.lang.String |
normalizeString(java.lang.String s,
boolean preserve,
boolean stripfirst,
boolean striplast)
Normalizes the given string. |
protected void |
rebuildACI()
|
protected void |
selectSubString(org.w3c.dom.Element element,
int charnum,
int nchars)
Select an ensemble of characters for that element. |
void |
selectSubString(int charnum,
int nchars)
Causes the specified substring to be selected just as if the user selected the substring interactively. |
void |
setBaseTextPaintInfo(TextPaintInfo pi,
org.w3c.dom.Element element,
GraphicsNode node,
BridgeContext ctx)
|
void |
setDecorationTextPaintInfo(TextPaintInfo pi,
org.w3c.dom.Element element)
|
| Methods inherited from class org.apache.batik.bridge.AbstractGraphicsNodeBridge |
dispose, getBBox, getCTM, getDisplay, getFontSize, getGlobalTransform, getPixelToMM, getPixelUnitToMillimeter, getScreenTransform, getViewportHeight, getViewportWidth, handleGeometryChanged, setScreenTransform |
| Methods inherited from class org.apache.batik.bridge.AbstractSVGBridge |
getNamespaceURI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.batik.bridge.Bridge |
getNamespaceURI |
| Field Detail |
protected static final java.lang.Integer ZERO
public static final java.text.AttributedCharacterIterator.Attribute TEXT_COMPOUND_DELIMITER
public static final java.text.AttributedCharacterIterator.Attribute PAINT_INFO
protected java.text.AttributedString laidoutText
protected java.util.WeakHashMap elemTPI
protected boolean usingComplexSVGFont
protected SVGTextElementBridge.DOMChildNodeRemovedEventListener childNodeRemovedEventListener
protected SVGTextElementBridge.DOMSubtreeModifiedEventListener subtreeModifiedEventListener
| Constructor Detail |
public SVGTextElementBridge()
| Method Detail |
public java.lang.String getLocalName()
getLocalName in interface Bridgepublic Bridge getInstance()
getInstance in interface GraphicsNodeBridgegetInstance in class AbstractSVGBridge
public GraphicsNode createGraphicsNode(BridgeContext ctx,
org.w3c.dom.Element e)
createGraphicsNode in interface GraphicsNodeBridgecreateGraphicsNode in class AbstractGraphicsNodeBridgectx - the bridge context to usee - the element that describes the graphics node to build
protected GraphicsNode instantiateGraphicsNode()
instantiateGraphicsNode in class AbstractGraphicsNodeBridge
protected java.awt.geom.Point2D getLocation(BridgeContext ctx,
org.w3c.dom.Element e)
ctx - the bridge context to usee - the text element
public void buildGraphicsNode(BridgeContext ctx,
org.w3c.dom.Element e,
GraphicsNode node)
buildGraphicsNode in interface GraphicsNodeBridgebuildGraphicsNode in class AbstractGraphicsNodeBridgectx - the bridge context to usee - the element that describes the graphics node to buildnode - the graphics node to buildpublic boolean isComposite()
isComposite in interface GraphicsNodeBridge
protected void initializeDynamicSupport(BridgeContext ctx,
org.w3c.dom.Element e,
GraphicsNode node)
initializeDynamicSupport in class AbstractGraphicsNodeBridge
protected void addContextToChild(BridgeContext ctx,
org.w3c.dom.Element e)
SVGContext to support dynamic updated . This is
recurssive, the children of the nodes are also traversed to add
to the support elements their context
ctx - a BridgeContext valuee - an Element valueSVGContext,
BridgeUpdateHandlerpublic void handleDOMNodeInsertedEvent(org.w3c.dom.events.MutationEvent evt)
handleDOMNodeInsertedEvent in interface BridgeUpdateHandlerhandleDOMNodeInsertedEvent in class AbstractGraphicsNodeBridgepublic void handleDOMNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)
handleDOMNodeRemovedEvent in interface BridgeUpdateHandlerhandleDOMNodeRemovedEvent in class AbstractGraphicsNodeBridgepublic void handleDOMChildNodeRemovedEvent(org.w3c.dom.events.MutationEvent evt)
public void handleDOMSubtreeModifiedEvent(org.w3c.dom.events.MutationEvent evt)
public void handleDOMCharacterDataModified(org.w3c.dom.events.MutationEvent evt)
handleDOMCharacterDataModified in interface BridgeUpdateHandlerhandleDOMCharacterDataModified in class AbstractGraphicsNodeBridgeprotected boolean isParentDisplayed(org.w3c.dom.Node childNode)
protected void computeLaidoutText(BridgeContext ctx,
org.w3c.dom.Element e,
GraphicsNode node)
laidoutText with the new
value.
protected void addNullPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
protected void addChildNullPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
public void handleDOMAttrModifiedEvent(org.w3c.dom.events.MutationEvent evt)
handleDOMAttrModifiedEvent in interface BridgeUpdateHandlerhandleDOMAttrModifiedEvent in class AbstractGraphicsNodeBridgepublic void handleCSSEngineEvent(CSSEngineEvent evt)
handleCSSEngineEvent in interface BridgeUpdateHandlerhandleCSSEngineEvent in class AbstractGraphicsNodeBridgeevt - the CSSEngine event that describes the updateprotected void handleCSSPropertyChanged(int property)
handleCSSPropertyChanged in class AbstractGraphicsNodeBridgeprotected void rebuildACI()
protected java.text.AttributedString buildAttributedString(BridgeContext ctx,
org.w3c.dom.Element element)
ctx - the bridge context to useelement - the text element
protected void fillAttributedStringBuffer(BridgeContext ctx,
org.w3c.dom.Element element,
boolean top,
TextPath textPath,
java.lang.Integer bidiLevel,
SVGTextElementBridge.AttributedStringBuffer asb)
protected java.lang.String normalizeString(java.lang.String s,
boolean preserve,
boolean stripfirst,
boolean striplast)
protected boolean nodeAncestorOf(org.w3c.dom.Node node1,
org.w3c.dom.Node node2)
protected void addGlyphPositionAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
protected void addChildGlyphPositionAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
BridgeContext ctx)
protected void addPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
TextNode node,
TextPaintInfo pi,
BridgeContext ctx)
protected void addChildPaintAttributes(java.text.AttributedString as,
org.w3c.dom.Element element,
TextNode node,
TextPaintInfo parentPI,
BridgeContext ctx)
protected java.util.Map getAttributeMap(BridgeContext ctx,
org.w3c.dom.Element element,
TextPath textPath,
java.lang.Integer bidiLevel)
protected TextPaintInfo getParentTextPaintInfo(java.text.AttributedCharacterIterator aci,
org.w3c.dom.Element child)
aci - an AttributedCharacterIterator valuechild - an Element value
TextDecoration value
protected TextPaintInfo getTextPaintInfo(org.w3c.dom.Element element,
GraphicsNode node,
TextPaintInfo parent,
BridgeContext ctx)
public void setBaseTextPaintInfo(TextPaintInfo pi,
org.w3c.dom.Element element,
GraphicsNode node,
BridgeContext ctx)
public void setDecorationTextPaintInfo(TextPaintInfo pi,
org.w3c.dom.Element element)
public int getNumberOfChars()
SVGTextContent
getNumberOfChars in interface SVGTextContentpublic java.awt.geom.Rectangle2D getExtentOfChar(int charnum)
SVGTextContent
getExtentOfChar in interface SVGTextContentcharnum - The index of the character, where the
first character has an index of 0.
public java.awt.geom.Point2D getStartPositionOfChar(int charnum)
SVGTextContent
getStartPositionOfChar in interface SVGTextContentcharnum - The index of the character, where the
first character has an index of 0.
public java.awt.geom.Point2D getEndPositionOfChar(int charnum)
SVGTextContent
getEndPositionOfChar in interface SVGTextContentcharnum - The index of the character, where the
first character has an index of 0.
public void selectSubString(int charnum,
int nchars)
SVGTextContent
selectSubString in interface SVGTextContentcharnum - : The index of the start character
which is at the given point, where the first
character has an index of 0.nchars - : The number of characters in the
substring. If nchars specifies more characters
than are available, then the substring will
consist of all characters starting with charnum
until the end of the list of characters.public float getRotationOfChar(int charnum)
SVGTextContent
getRotationOfChar in interface SVGTextContentcharnum - The index of the character, where the
first character has an index of 0.
public float getComputedTextLength()
getComputedTextLength in interface SVGTextContent
public float getSubStringLength(int charnum,
int nchars)
getSubStringLength in interface SVGTextContent
public int getCharNumAtPosition(float x,
float y)
getCharNumAtPosition in interface SVGTextContentprotected int getNumberOfChars(org.w3c.dom.Element element)
SVGTextContentElement.getNumberOfChars().
protected java.awt.geom.Rectangle2D getExtentOfChar(org.w3c.dom.Element element,
int charnum)
SVGTextContentElement.getExtentOfChar(int charnum).
protected java.awt.geom.Point2D getStartPositionOfChar(org.w3c.dom.Element element,
int charnum)
SVGTextContentElement.getStartPositionOfChar(int charnum).
protected java.awt.geom.Point2D getStartPoint(SVGTextElementBridge.CharacterInformation info)
protected java.awt.geom.Point2D getEndPositionOfChar(org.w3c.dom.Element element,
int charnum)
SVGTextContentElement.getEndPositionOfChar(int charnum).
protected java.awt.geom.Point2D getEndPoint(SVGTextElementBridge.CharacterInformation info)
protected float getRotationOfChar(org.w3c.dom.Element element,
int charnum)
SVGTextContentElement.getRotationOfChar(int charnum).
protected float getComputedTextLength(org.w3c.dom.Element e)
SVGTextContentElement.getComputedTextLength().
protected float getSubStringLength(org.w3c.dom.Element element,
int charnum,
int nchars)
SVGTextContentElement.getSubStringLength(int charnum,int nchars).
protected float distanceFirstLastCharacterInRun(SVGTextElementBridge.CharacterInformation first,
SVGTextElementBridge.CharacterInformation last)
protected float distanceBetweenRun(SVGTextElementBridge.CharacterInformation last,
SVGTextElementBridge.CharacterInformation first)
protected void selectSubString(org.w3c.dom.Element element,
int charnum,
int nchars)
protected int getCharNumAtPosition(org.w3c.dom.Element e,
float x,
float y)
protected java.util.List getTextRuns(TextNode node)
protected SVGTextElementBridge.CharacterInformation getCharacterInformation(java.util.List list,
int startIndex,
int charnum,
java.text.AttributedCharacterIterator aci)
list - : list of the layoutscharnum - : index of the character ( among the
characters of the element ) looked for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||