org.vectomatic.dom.svg.impl
Class SVGTextContentElement

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.dom.client.Node
          extended by com.google.gwt.dom.client.Element
              extended by org.vectomatic.dom.svg.impl.SVGElement
                  extended by org.vectomatic.dom.svg.impl.SVGTextContentElement
Direct Known Subclasses:
SVGTextPathElement, SVGTextPositioningElement

public class SVGTextContentElement
extends SVGElement

The SVGTextContentElement is inherited by various text-related interfaces, such as SVGTextElement, SVGTSpanElement, SVGTRefElement, SVGAltGlyphElement and SVGTextPathElement.

For the methods on this interface that refer to an index to a character or a number of characters, these references are to be interpreted as an index to a UTF-16 code unit or a number of UTF-16 code units, respectively. This is for consistency with DOM Level 2 Core, where methods on the CharacterData interface use UTF-16 code units as indexes and counts within the character data. Thus for example, if the text content of a text element is a single non-BMP character, such as U+10000, then invoking getNumberOfChars() on that element will return 2 since there are two UTF-16 code units (the surrogate pair) used to represent that one character.


Field Summary
 
Fields inherited from class com.google.gwt.dom.client.Element
DRAGGABLE_AUTO, DRAGGABLE_FALSE, DRAGGABLE_TRUE
 
Fields inherited from class com.google.gwt.dom.client.Node
DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE
 
Constructor Summary
protected SVGTextContentElement()
           
 
Method Summary
 int getCharNumAtPosition(OMSVGPoint point)
          Returns the index of the character whose corresponding glyph cell bounding box contains the specified point.
 float getComputedTextLength()
          The total sum of all of the advance values from rendering all of the characters within this element, including the advance value on the glyphs (horizontal or vertical), the effect of properties kerning, letter-spacing and word-spacing and adjustments due to attributes tspan/dx and tspan/dy on tspan elements.
 OMSVGPoint 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.
 OMSVGRect 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.
 OMSVGAnimatedBoolean getExternalResourcesRequired()
          Corresponds to attribute ISVGExternalResourcesRequired.getExternalResourcesRequired() on the given element.
 OMSVGAnimatedEnumeration getLengthAdjust()
          Corresponds to attribute 'lengthAdjust' on the given element.
 int getNumberOfChars()
          Returns the total number of characters available for rendering within the current element, which includes referenced characters from tref reference, regardless of whether they will be rendered.
 OMSVGStringList getRequiredExtensions()
          Corresponds to attribute ISVGTests.getRequiredExtensions() on the given element.
 OMSVGStringList getRequiredFeatures()
          Corresponds to attribute ISVGTests.getRequiredFeatures() on the given element.
 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.
 OMSVGPoint 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.
 float getSubStringLength(int charnum, int nchars)
          The total sum of all of the advance values from rendering the specified substring of the characters, including the advance value on the glyphs (horizontal or vertical), the effect of properties kerning, letter-spacing and word-spacing and adjustments due to attributes tspan/dx and tspan/dy on tspan elements.
 OMSVGStringList getSystemLanguage()
          Corresponds to attribute ISVGTests.getSystemLanguage() on the given element.
 OMSVGAnimatedLength getTextLength()
          Corresponds to attribute 'textLength' on the given element.
 String getXmllang()
          Corresponds to attribute xml:lang on the given element.
 String getXmlspace()
          Corresponds to attribute xml:space on the given element.
 boolean hasExtension(String extension)
          Returns true if the user agent supports the given extension, specified by a URI.
 void selectSubString(int charnum, int nchars)
          Causes the specified substring to be selected just as if the user selected the substring interactively.
 void setXmllang(String value)
          Corresponds to attribute xml:lang on the given element.
 void setXmlspace(String value)
          Corresponds to attribute xml:space on the given element.
 
Methods inherited from class org.vectomatic.dom.svg.impl.SVGElement
getClassName_, getMarkup, getOwnerSVGElement, getViewportElement, getXmlbase, setXmlbase
 
Methods inherited from class com.google.gwt.dom.client.Element
addClassName, as, as, blur, dispatchEvent, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getAttribute, getClassName, getClientHeight, getClientWidth, getDir, getDraggable, getElementsByTagName, getFirstChildElement, getId, getInnerHTML, getInnerText, getLang, getNextSiblingElement, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getPropertyBoolean, getPropertyDouble, getPropertyInt, getPropertyJSO, getPropertyObject, getPropertyString, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getString, getStyle, getTabIndex, getTagName, getTitle, hasAttribute, hasTagName, is, is, removeAttribute, removeClassName, replaceClassName, scrollIntoView, setAttribute, setClassName, setDir, setDraggable, setId, setInnerHTML, setInnerText, setLang, setPropertyBoolean, setPropertyDouble, setPropertyInt, setPropertyJSO, setPropertyObject, setPropertyString, setScrollLeft, setScrollTop, setTabIndex, setTitle
 
Methods inherited from class com.google.gwt.dom.client.Node
appendChild, cloneNode, getChild, getChildCount, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPreviousSibling, hasChildNodes, hasParentElement, insertAfter, insertBefore, insertFirst, isOrHasChild, removeChild, removeFromParent, replaceChild, setNodeValue
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SVGTextContentElement

protected SVGTextContentElement()
Method Detail

getTextLength

public final OMSVGAnimatedLength getTextLength()
Corresponds to attribute 'textLength' on the given element.


getLengthAdjust

public final OMSVGAnimatedEnumeration getLengthAdjust()
Corresponds to attribute 'lengthAdjust' on the given element. The value must be one of the length adjust constants defined on this interface.


getNumberOfChars

public final int getNumberOfChars()
Returns the total number of characters available for rendering within the current element, which includes referenced characters from tref reference, regardless of whether they will be rendered. Effectively, this is equivalent to the length of the Node::textContent attribute from DOM Level 3 Core ([DOM3], section 1.4), if that attribute also expanded tref elements.

Returns:
Total number of characters.

getComputedTextLength

public final float getComputedTextLength()
The total sum of all of the advance values from rendering all of the characters within this element, including the advance value on the glyphs (horizontal or vertical), the effect of properties kerning, letter-spacing and word-spacing and adjustments due to attributes tspan/dx and tspan/dy on tspan elements. For non-rendering environments, the user agent shall make reasonable assumptions about glyph metrics.

Returns:
The text advance distance.

getSubStringLength

public final float getSubStringLength(int charnum,
                                      int nchars)
                               throws com.google.gwt.core.client.JavaScriptException
The total sum of all of the advance values from rendering the specified substring of the characters, including the advance value on the glyphs (horizontal or vertical), the effect of properties kerning, letter-spacing and word-spacing and adjustments due to attributes tspan/dx and tspan/dy on tspan elements. For non-rendering environments, the user agent shall make reasonable assumptions about glyph metrics. If multiple consecutive characters are rendered inseparably (e.g., as a single glyph or a sequence of glyphs, or because the range encompasses half of a surrogate pair), and nchars is greater than 0 then the measured range shall be expanded so that each of the inseparable characters are included.

Parameters:
charnum - The index of the first character in the substring, 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.
Returns:
The text advance distance.
Throws:
DOMException(INDEX_SIZE_ERR) - Raised if charnum or nchars is negative or if charnum is greater than or equal to the number of characters at this node.
com.google.gwt.core.client.JavaScriptException

getStartPositionOfChar

public final OMSVGPoint getStartPositionOfChar(int charnum)
                                        throws com.google.gwt.core.client.JavaScriptException
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. The current text position has already taken into account the effects of any inter-character adjustments due to properties kerning, letter-spacing and word-spacing and adjustments due to attributes 'x', 'y', 'dx' and 'dy'. If multiple consecutive characters are rendered inseparably (e.g., as a single glyph or a sequence of glyphs), then each of the inseparable characters will return the start position for the first glyph.

Parameters:
charnum - The index of the character, where the first character has an index of 0.
Returns:
The character's start position.
Throws:
DOMException(INDEX_SIZE_ERR) - Raised if the charnum is negative or if charnum is greater than or equal to the number of characters at this node.
com.google.gwt.core.client.JavaScriptException

getEndPositionOfChar

public final OMSVGPoint getEndPositionOfChar(int charnum)
                                      throws com.google.gwt.core.client.JavaScriptException
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. This current text position does not take into account the effects of any inter-character adjustments to prepare for the next character, such as properties kerning, letter-spacing and word-spacing and adjustments due to attributes 'x', 'y', 'dx' and 'dy'. If multiple consecutive characters are rendered inseparably (e.g., as a single glyph or a sequence of glyphs), then each of the inseparable characters will return the end position for the last glyph.

Parameters:
charnum - The index of the character, where the first character has an index of 0.
Returns:
The character's end position.
Throws:
DOMException(INDEX_SIZE_ERR) - Raised if the charnum is negative or if charnum is greater than or equal to the number of characters at this node.
com.google.gwt.core.client.JavaScriptException

getExtentOfChar

public final OMSVGRect getExtentOfChar(int charnum)
                                throws com.google.gwt.core.client.JavaScriptException
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. The calculations assume that all glyphs occupy the full standard glyph cell for the font. If multiple consecutive characters are rendered inseparably (e.g., as a single glyph or a sequence of glyphs), then each of the inseparable characters will return the same extent.

Parameters:
charnum - The index of the character, where the first character has an index of 0.
Returns:
The rectangle which encloses all of the rendered glyph(s).
Throws:
DOMException(INDEX_SIZE_ERR) - Raised if the charnum is negative or if charnum is greater than or equal to the number of characters at this node.
com.google.gwt.core.client.JavaScriptException

getRotationOfChar

public final float getRotationOfChar(int charnum)
                              throws com.google.gwt.core.client.JavaScriptException
Returns the rotation value relative to the current user coordinate system used to render the glyph(s) corresponding to the specified character. If multiple glyph(s) are used to render the given character and the glyphs each have different rotations (e.g., due to text-on-a-path), the user agent shall return an average value (e.g., the rotation angle at the midpoint along the path for all glyphs used to render this character). The rotation value represents the rotation that is supplemental to any rotation due to properties glyph-orientation-horizontal and glyph-orientation-vertical; thus, any glyph rotations due to these properties are not included into the returned rotation value. If multiple consecutive characters are rendered inseparably (e.g., as a single glyph or a sequence of glyphs), then each of the inseparable characters will return the same rotation value.

Parameters:
charnum - The index of the character, where the first character has an index of 0.
Returns:
The rotation angle.
Throws:
DOMException(INDEX_SIZE_ERR) - Raised if the charnum is negative or if charnum is greater than or equal to the number of characters at this node.
com.google.gwt.core.client.JavaScriptException

getCharNumAtPosition

public final int getCharNumAtPosition(OMSVGPoint point)
Returns the index of the character whose corresponding glyph cell bounding box contains the specified point. The calculations assume that all glyphs occupy the full standard glyph cell for the font. If no such character exists, a value of -1 is returned. If multiple such characters exist, the character within the element whose glyphs were rendered last (i.e., take into account any reordering such as for bidirectional text) is used. If multiple consecutive characters are rendered inseparably (e.g., as a single glyph or a sequence of glyphs), then the user agent shall allocate an equal percentage of the text advance amount to each of the contributing characters in determining which of the characters is chosen.

Parameters:
point - A point in user space.
Returns:
The index of the character which is at the given point, where the first character has an index of 0.

selectSubString

public final void selectSubString(int charnum,
                                  int nchars)
                           throws com.google.gwt.core.client.JavaScriptException
Causes the specified substring to be selected just as if the user selected the substring interactively.

Parameters:
charnum - 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.
Throws:
DOMException(INDEX_SIZE_ERR) - Raised if charnum or nchars is negative or if charnum is greater than or equal to the number of characters at this node.
com.google.gwt.core.client.JavaScriptException

getExternalResourcesRequired

public final OMSVGAnimatedBoolean getExternalResourcesRequired()
Corresponds to attribute ISVGExternalResourcesRequired.getExternalResourcesRequired() on the given element. Note that the SVG DOM defines the attribute ISVGExternalResourcesRequired.getExternalResourcesRequired() as being of type OMSVGAnimatedBoolean, whereas the SVG language definition says that ISVGExternalResourcesRequired.getExternalResourcesRequired() is not animated. Because the SVG language definition states that ISVGExternalResourcesRequired.getExternalResourcesRequired() cannot be animated, the OMSVGAnimatedBoolean.getAnimVal() will always be the same as the OMSVGAnimatedBoolean.getBaseVal().


getXmllang

public final String getXmllang()
Corresponds to attribute xml:lang on the given element.


setXmllang

public final void setXmllang(String value)
                      throws com.google.gwt.core.client.JavaScriptException
Corresponds to attribute xml:lang on the given element.

Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

getXmlspace

public final String getXmlspace()
Corresponds to attribute xml:space on the given element.


setXmlspace

public final void setXmlspace(String value)
                       throws com.google.gwt.core.client.JavaScriptException
Corresponds to attribute xml:space on the given element.

Throws:
DOMException(NO_MODIFICATION_ALLOWED_ERR) - Raised on an attempt to change the value of a read only attribute.
com.google.gwt.core.client.JavaScriptException

getRequiredFeatures

public final OMSVGStringList getRequiredFeatures()
Corresponds to attribute ISVGTests.getRequiredFeatures() on the given element.


getRequiredExtensions

public final OMSVGStringList getRequiredExtensions()
Corresponds to attribute ISVGTests.getRequiredExtensions() on the given element.


getSystemLanguage

public final OMSVGStringList getSystemLanguage()
Corresponds to attribute ISVGTests.getSystemLanguage() on the given element.


hasExtension

public final boolean hasExtension(String extension)
Returns true if the user agent supports the given extension, specified by a URI.

Parameters:
extension - The name of the extension, expressed as a URI.
Returns:
True or false, depending on whether the given extension is supported.


Copyright © 2012. All Rights Reserved.