Skip to main content

Class: TextPathElement

Hierarchy​

Constructors​

constructor​

• new TextPathElement(document, node, captureTextNodes?)

Parameters​

NameType
documentDocument
nodeHTMLElement
captureTextNodes?boolean

Overrides​

TextElement.constructor

Defined in​

src/Document/TextPathElement.ts:60

Properties​

ignoreChildTypes​

â–ª Static Readonly ignoreChildTypes: string[]

Inherited from​

TextElement.ignoreChildTypes

Defined in​

src/Document/Element.ts:11


attributes​

• Readonly attributes: Record<string, Property<unknown>> = {}

Inherited from​

TextElement.attributes

Defined in​

src/Document/Element.ts:14


styles​

• Readonly styles: Record<string, Property<unknown>> = {}

Inherited from​

TextElement.styles

Defined in​

src/Document/Element.ts:15


stylesSpecificity​

• Readonly stylesSpecificity: Record<string, string> = {}

Inherited from​

TextElement.stylesSpecificity

Defined in​

src/Document/Element.ts:16


animationFrozen​

• animationFrozen: boolean = false

Inherited from​

TextElement.animationFrozen

Defined in​

src/Document/Element.ts:17


animationFrozenValue​

• animationFrozenValue: string = ''

Inherited from​

TextElement.animationFrozenValue

Defined in​

src/Document/Element.ts:18


parent​

• parent: Element = null

Inherited from​

TextElement.parent

Defined in​

src/Document/Element.ts:19


children​

• children: Element[] = []

Inherited from​

TextElement.children

Defined in​

src/Document/Element.ts:20


document​

• Protected Readonly document: Document

Inherited from​

TextElement.document

Defined in​

src/Document/Element.ts:23


node​

• Protected Optional Readonly node: HTMLElement

Inherited from​

TextElement.node

Defined in​

src/Document/Element.ts:24


captureTextNodes​

• Protected Readonly captureTextNodes: boolean = false

Inherited from​

TextElement.captureTextNodes

Defined in​

src/Document/Element.ts:25


x​

• Protected x: number = 0

Inherited from​

TextElement.x

Defined in​

src/Document/TextElement.ts:18


y​

• Protected y: number = 0

Inherited from​

TextElement.y

Defined in​

src/Document/TextElement.ts:19


type​

• type: string = 'textPath'

Overrides​

TextElement.type

Defined in​

src/Document/TextPathElement.ts:49


textWidth​

• Protected textWidth: number = 0

Defined in​

src/Document/TextPathElement.ts:50


textHeight​

• Protected textHeight: number = 0

Defined in​

src/Document/TextPathElement.ts:51


pathLength​

• Protected pathLength: number = -1

Defined in​

src/Document/TextPathElement.ts:52


glyphInfo​

• Protected glyphInfo: IGlyphInfo[] = null

Defined in​

src/Document/TextPathElement.ts:53


text​

• Protected Readonly text: string

Defined in​

src/Document/TextPathElement.ts:54


dataArray​

• Protected Readonly dataArray: IPathCommand[]

Defined in​

src/Document/TextPathElement.ts:55


letterSpacingCache​

• Private letterSpacingCache: number[] = []

Defined in​

src/Document/TextPathElement.ts:56


equidistantCache​

• Private equidistantCache: IEquidistantCache

Defined in​

src/Document/TextPathElement.ts:57


measuresCache​

• Private Readonly measuresCache: Map<string, number>

Defined in​

src/Document/TextPathElement.ts:58

Methods​

getAttribute​

â–¸ getAttribute(name, createIfNotExists?): Property<unknown>

Parameters​

NameTypeDefault value
namestringundefined
createIfNotExistsbooleanfalse

Returns​

Property<unknown>

Inherited from​

TextElement.getAttribute

Defined in​

src/Document/Element.ts:87


getHrefAttribute​

â–¸ getHrefAttribute(): Property<unknown>

Returns​

Property<unknown>

Inherited from​

TextElement.getHrefAttribute

Defined in​

src/Document/Element.ts:101


getStyle​

â–¸ getStyle(name, createIfNotExists?, skipAncestors?): Property<unknown>

Parameters​

NameTypeDefault value
namestringundefined
createIfNotExistsbooleanfalse
skipAncestorsbooleanfalse

Returns​

Property<unknown>

Inherited from​

TextElement.getStyle

Defined in​

src/Document/Element.ts:114


render​

â–¸ render(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Inherited from​

TextElement.render

Defined in​

src/Document/Element.ts:151


applyEffects​

â–¸ Protected applyEffects(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Inherited from​

TextElement.applyEffects

Defined in​

src/Document/Element.ts:190


addChild​

â–¸ Protected addChild(childNode): void

Parameters​

NameType
childNodeHTMLElement | Element

Returns​

void

Inherited from​

TextElement.addChild

Defined in​

src/Document/Element.ts:220


matchesSelector​

â–¸ Protected matchesSelector(selector): boolean

Parameters​

NameType
selectorstring

Returns​

boolean

Inherited from​

TextElement.matchesSelector

Defined in​

src/Document/Element.ts:232


addStylesFromStyleDefinition​

â–¸ addStylesFromStyleDefinition(): void

Returns​

void

Inherited from​

TextElement.addStylesFromStyleDefinition

Defined in​

src/Document/Element.ts:248


removeStyles​

â–¸ Protected removeStyles(element, ignoreStyles): [string, string][]

Parameters​

NameType
elementElement
ignoreStylesstring[]

Returns​

[string, string][]

Inherited from​

TextElement.removeStyles

Defined in​

src/Document/Element.ts:283


restoreStyles​

â–¸ Protected restoreStyles(element, styles): void

Parameters​

NameType
elementElement
styles[string, string][]

Returns​

void

Inherited from​

TextElement.restoreStyles

Defined in​

src/Document/Element.ts:301


isFirstChild​

â–¸ isFirstChild(): boolean

Returns​

boolean

Inherited from​

TextElement.isFirstChild

Defined in​

src/Document/Element.ts:307


calculateOpacity​

â–¸ Protected calculateOpacity(): number

Returns​

number

Inherited from​

TextElement.calculateOpacity

Defined in​

src/Document/RenderedElement.ts:13


clearContext​

â–¸ clearContext(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Inherited from​

TextElement.clearContext

Defined in​

src/Document/RenderedElement.ts:215


setContext​

â–¸ setContext(ctx, fromMeasure?): void

Parameters​

NameTypeDefault value
ctxRenderingContext2Dundefined
fromMeasurebooleanfalse

Returns​

void

Inherited from​

TextElement.setContext

Defined in​

src/Document/TextElement.ts:40


initializeCoordinates​

â–¸ Protected initializeCoordinates(): void

Returns​

void

Inherited from​

TextElement.initializeCoordinates

Defined in​

src/Document/TextElement.ts:51


getBoundingBox​

â–¸ getBoundingBox(ctx): BoundingBox

Parameters​

NameType
ctxRenderingContext2D

Returns​

BoundingBox

Inherited from​

TextElement.getBoundingBox

Defined in​

src/Document/TextElement.ts:60


getFontSize​

â–¸ Protected getFontSize(): number

Returns​

number

Inherited from​

TextElement.getFontSize

Defined in​

src/Document/TextElement.ts:85


getTElementBoundingBox​

â–¸ Protected getTElementBoundingBox(ctx): BoundingBox

Parameters​

NameType
ctxRenderingContext2D

Returns​

BoundingBox

Inherited from​

TextElement.getTElementBoundingBox

Defined in​

src/Document/TextElement.ts:96


getGlyph​

â–¸ getGlyph(font, text, i): GlyphElement

Parameters​

NameType
fontFontElement
textstring
inumber

Returns​

GlyphElement

Inherited from​

TextElement.getGlyph

Defined in​

src/Document/TextElement.ts:107


getTextFromNode​

â–¸ Protected getTextFromNode(node?): string

Parameters​

NameType
node?ChildNode

Returns​

string

Inherited from​

TextElement.getTextFromNode

Defined in​

src/Document/TextElement.ts:149


renderTElementChildren​

â–¸ Protected renderTElementChildren(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Inherited from​

TextElement.renderTElementChildren

Defined in​

src/Document/TextElement.ts:198


applyAnchoring​

â–¸ Protected applyAnchoring(): void

Returns​

void

Inherited from​

TextElement.applyAnchoring

Defined in​

src/Document/TextElement.ts:277


adjustChildCoordinatesRecursive​

â–¸ Protected adjustChildCoordinatesRecursive(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Inherited from​

TextElement.adjustChildCoordinatesRecursive

Defined in​

src/Document/TextElement.ts:309


adjustChildCoordinatesRecursiveCore​

â–¸ Protected adjustChildCoordinatesRecursiveCore(ctx, textParent, parent, i): void

Parameters​

NameType
ctxRenderingContext2D
textParentTextElement
parentElement
inumber

Returns​

void

Inherited from​

TextElement.adjustChildCoordinatesRecursiveCore

Defined in​

src/Document/TextElement.ts:316


adjustChildCoordinates​

â–¸ Protected adjustChildCoordinates(ctx, textParent, parent, i): TextElement

Parameters​

NameType
ctxRenderingContext2D
textParentTextElement
parentElement
inumber

Returns​

TextElement

Inherited from​

TextElement.adjustChildCoordinates

Defined in​

src/Document/TextElement.ts:334


getChildBoundingBox​

â–¸ Protected getChildBoundingBox(ctx, textParent, parent, i): BoundingBox

Parameters​

NameType
ctxRenderingContext2D
textParentTextElement
parentElement
inumber

Returns​

BoundingBox

Inherited from​

TextElement.getChildBoundingBox

Defined in​

src/Document/TextElement.ts:432


renderChild​

â–¸ Protected renderChild(ctx, textParent, parent, i): void

Parameters​

NameType
ctxRenderingContext2D
textParentTextElement
parentElement
inumber

Returns​

void

Inherited from​

TextElement.renderChild

Defined in​

src/Document/TextElement.ts:458


measureTargetText​

â–¸ Protected measureTargetText(ctx, targetText): number

Parameters​

NameType
ctxRenderingContext2D
targetTextstring

Returns​

number

Inherited from​

TextElement.measureTargetText

Defined in​

src/Document/TextElement.ts:487


getInheritedAttribute​

â–¸ Protected getInheritedAttribute(name): string

Inherits positional attributes from TextElement parent(s). Attributes are only inherited from a parent to its first child.

Parameters​

NameTypeDescription
namestringThe attribute name.

Returns​

string

The attribute value or null.

Inherited from​

TextElement.getInheritedAttribute

Defined in​

src/Document/TextElement.ts:544


getText​

â–¸ getText(): string

Returns​

string

Overrides​

TextElement.getText

Defined in​

src/Document/TextPathElement.ts:73


path​

â–¸ path(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Defined in​

src/Document/TextPathElement.ts:77


renderChildren​

â–¸ renderChildren(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Overrides​

TextElement.renderChildren

Defined in​

src/Document/TextPathElement.ts:174


getLetterSpacingAt​

â–¸ Protected getLetterSpacingAt(idx?): number

Parameters​

NameTypeDefault value
idxnumber0

Returns​

number

Defined in​

src/Document/TextPathElement.ts:240


findSegmentToFitChar​

â–¸ Protected findSegmentToFitChar(ctx, anchor, textFullWidth, fullPathWidth, spacesNumber, inputOffset, dy, c, charI): Object

Parameters​

NameType
ctxRenderingContext2D
anchorstring
textFullWidthnumber
fullPathWidthnumber
spacesNumbernumber
inputOffsetnumber
dynumber
cstring
charInumber

Returns​

Object

NameType
offsetnumber
segment{ p0: ICachedPoint ; p1: ICachedPoint }
segment.p0ICachedPoint
segment.p1ICachedPoint
rotationnumber

Defined in​

src/Document/TextPathElement.ts:244


measureText​

â–¸ Protected measureText(ctx, text?): number

Parameters​

NameType
ctxRenderingContext2D
text?string

Returns​

number

Overrides​

TextElement.measureText

Defined in​

src/Document/TextPathElement.ts:308


setTextData​

â–¸ Protected setTextData(ctx): void

Parameters​

NameType
ctxRenderingContext2D

Returns​

void

Defined in​

src/Document/TextPathElement.ts:329


parsePathData​

â–¸ Protected parsePathData(path): IPathCommand[]

Parameters​

NameType
pathPathElement

Returns​

IPathCommand[]

Defined in​

src/Document/TextPathElement.ts:455


pathM​

â–¸ Protected pathM(pathParser, points): void

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

void

Defined in​

src/Document/TextPathElement.ts:542


pathL​

â–¸ Protected pathL(pathParser, points): 16

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

16

Defined in​

src/Document/TextPathElement.ts:554


pathH​

â–¸ Protected pathH(pathParser, points): 16

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

16

Defined in​

src/Document/TextPathElement.ts:568


pathV​

â–¸ Protected pathV(pathParser, points): 16

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

16

Defined in​

src/Document/TextPathElement.ts:582


pathC​

â–¸ Protected pathC(pathParser, points): void

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

void

Defined in​

src/Document/TextPathElement.ts:596


pathS​

â–¸ Protected pathS(pathParser, points): 32

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

32

Defined in​

src/Document/TextPathElement.ts:616


pathQ​

â–¸ Protected pathQ(pathParser, points): void

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

void

Defined in​

src/Document/TextPathElement.ts:638


pathT​

â–¸ Protected pathT(pathParser, points): 128

Parameters​

NameType
pathParserPathParser
pointsnumber[]

Returns​

128

Defined in​

src/Document/TextPathElement.ts:655


pathA​

â–¸ Protected pathA(pathParser): number[]

Parameters​

NameType
pathParserPathParser

Returns​

number[]

Defined in​

src/Document/TextPathElement.ts:674


calcLength​

â–¸ Protected calcLength(x, y, commandType, points): number

Parameters​

NameType
xnumber
ynumber
commandType1 | 2 | 4 | 16 | 8 | 128 | 256 | 32 | 64 | 512
pointsnumber[]

Returns​

number

Defined in​

src/Document/TextPathElement.ts:707


getPointOnLine​

â–¸ Protected getPointOnLine(dist, p1x, p1y, p2x, p2y, fromX?, fromY?): IPoint

Parameters​

NameTypeDefault value
distnumberundefined
p1xnumberundefined
p1ynumberundefined
p2xnumberundefined
p2ynumberundefined
fromXnumberp1x
fromYnumberp1y

Returns​

IPoint

Defined in​

src/Document/TextPathElement.ts:862


getPointOnPath​

â–¸ Protected getPointOnPath(distance): IPoint

Parameters​

NameType
distancenumber

Returns​

IPoint

Defined in​

src/Document/TextPathElement.ts:928


getLineLength​

â–¸ Protected getLineLength(x1, y1, x2, y2): number

Parameters​

NameType
x1number
y1number
x2number
y2number

Returns​

number

Defined in​

src/Document/TextPathElement.ts:1047


getPathLength​

â–¸ Protected getPathLength(): number

Returns​

number

Defined in​

src/Document/TextPathElement.ts:1059


getPointOnCubicBezier​

â–¸ Protected getPointOnCubicBezier(pct, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y): IPoint

Parameters​

NameType
pctnumber
p1xnumber
p1ynumber
p2xnumber
p2ynumber
p3xnumber
p3ynumber
p4xnumber
p4ynumber

Returns​

IPoint

Defined in​

src/Document/TextPathElement.ts:1074


getPointOnQuadraticBezier​

â–¸ Protected getPointOnQuadraticBezier(pct, p1x, p1y, p2x, p2y, p3x, p3y): IPoint

Parameters​

NameType
pctnumber
p1xnumber
p1ynumber
p2xnumber
p2ynumber
p3xnumber
p3ynumber

Returns​

IPoint

Defined in​

src/Document/TextPathElement.ts:1094


getPointOnEllipticalArc​

â–¸ Protected getPointOnEllipticalArc(cx, cy, rx, ry, theta, psi): IPoint

Parameters​

NameType
cxnumber
cynumber
rxnumber
rynumber
thetanumber
psinumber

Returns​

IPoint

Defined in​

src/Document/TextPathElement.ts:1112


buildEquidistantCache​

â–¸ Protected buildEquidistantCache(inputStep, inputPrecision): void

Parameters​

NameType
inputStepnumber
inputPrecisionnumber

Returns​

void

Defined in​

src/Document/TextPathElement.ts:1134


getEquidistantPointOnPath​

â–¸ Protected getEquidistantPointOnPath(targetDistance, step?, precision?): ICachedPoint

Parameters​

NameType
targetDistancenumber
step?number
precision?number

Returns​

ICachedPoint

Defined in​

src/Document/TextPathElement.ts:1178