Interface ISvgTextPath
interface ISvgTextPath
Extends ISvgTextContainer
Represents an SVG textPath element, which lays out its text content along the shape of a referenced path.
A textPath is valid only as a direct child of a text element. Text content,
nested tspan styling, and font and spacing presentation attributes are inherited from
ISvgTextContainer.
Glyph positioning on a textPath is governed by the referenced path together with
::setStartOffset and text-anchor. The positioning attributes setX, setY, setDx,
setDy, setRotate on the textPath element itself are ignored.
More details: https://svgwg.org/svg2-draft/text.html#TextPathElement
See also - ISvgTextContainer.
Methods
setHref()
Sets the href reference to the path the text is laid out along. This overrides any path previously set on this textPath — whether a priorvoidsetHref(SvgIRI*href)
::setHref reference or an inline
path set via ::setInlinePath.
Only SvgIRIType::LOCAL references are supported as of now: a same-document element id
such as “myPath”, given as the SvgIRI::value with SvgIRI::IRItype set to
SvgIRIType::LOCAL. SvgIRIType::NON_LOCAL and SvgIRIType::DATA_URI are not
resolved. An empty or unknown id results in nothing being rendered.
Parameters
href
SvgIRI* — Required
the SvgIRI reference to the path.
setInlinePath()
Sets the inline path the text is laid out along, taken from the given path node, and clears any href previously set viavoidsetInlinePath(ISvgPathNode*path)
::setHref.
The path source is mutually exclusive with the href: the most recently set of
::setHref / setInlinePath is the one used. Calling this replaces any previously
set inline path.
The path geometry is captured when this is called; later changes to the passed
ISvgPathNode (for example via ISvgPathNode::setPath) do not propagate to
this textPath — call this again with the updated node to apply a new path.
Parameters
path
ISvgPathNode* — Required
the ISvgPathNode whose geometry the text is laid out along.
setStartOffset()
Sets the startOffset attribute. Specifies the distance from the start of the path to the start of the text. Accepts avoidsetStartOffset(SvgLengthstartOffset)
SvgLength in user units (SvgUnit::Number / SvgUnit::PX), a percentage
(SvgUnit::Percentage) of the total path length, or an absolute unit
(SvgUnit::CM, SvgUnit::MM, SvgUnit::IN, SvgUnit::PT,
SvgUnit::PC); the font-relative units SvgUnit::EMS and SvgUnit::EXS
are not supported. Default value is 0, placing the text at the start of the path. Negative
values and values beyond the path length (including percentages outside 0%-100%) are
permitted; glyphs whose midpoint falls outside the path are not rendered.
Parameters
startOffset
SvgLength — Required
SvgLength to set as the starting offset.
setSide()
Sets the side attribute. Attribute determines which side of the path the text is rendered on, relative to the path direction. Default value isvoidsetSide(SvgTextPathSideside)
SvgTextPathSide::LEFT
Parameters
side
SvgTextPathSide — Required
SvgTextPathSide to set.

