Class: TextPathElement
Hierarchy​
↳
TextPathElement
Constructors​
constructor​
• new TextPathElement(document
, node
, captureTextNodes?
)
Parameters​
Name | Type |
---|---|
document | Document |
node | HTMLElement |
captureTextNodes? | boolean |
Overrides​
Defined in​
src/Document/TextPathElement.ts:60
Properties​
ignoreChildTypes​
â–ª Static
Readonly
ignoreChildTypes: string
[]
Inherited from​
Defined in​
attributes​
• Readonly
attributes: Record
<string
, Property
<unknown
>> = {}
Inherited from​
Defined in​
styles​
• Readonly
styles: Record
<string
, Property
<unknown
>> = {}
Inherited from​
Defined in​
stylesSpecificity​
• Readonly
stylesSpecificity: Record
<string
, string
> = {}
Inherited from​
Defined in​
animationFrozen​
• animationFrozen: boolean
= false
Inherited from​
Defined in​
animationFrozenValue​
• animationFrozenValue: string
= ''
Inherited from​
TextElement.animationFrozenValue
Defined in​
parent​
• parent: Element
= null
Inherited from​
Defined in​
children​
• children: Element
[] = []
Inherited from​
Defined in​
document​
• Protected
Readonly
document: Document
Inherited from​
Defined in​
node​
• Protected
Optional
Readonly
node: HTMLElement
Inherited from​
Defined in​
captureTextNodes​
• Protected
Readonly
captureTextNodes: boolean
= false
Inherited from​
Defined in​
x​
• Protected
x: number
= 0
Inherited from​
Defined in​
src/Document/TextElement.ts:18
y​
• Protected
y: number
= 0
Inherited from​
Defined in​
src/Document/TextElement.ts:19
type​
• type: string
= 'textPath'
Overrides​
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​
Name | Type | Default value |
---|---|---|
name | string | undefined |
createIfNotExists | boolean | false |
Returns​
Property
<unknown
>
Inherited from​
Defined in​
getHrefAttribute​
â–¸ getHrefAttribute(): Property
<unknown
>
Returns​
Property
<unknown
>
Inherited from​
Defined in​
getStyle​
â–¸ getStyle(name
, createIfNotExists?
, skipAncestors?
): Property
<unknown
>
Parameters​
Name | Type | Default value |
---|---|---|
name | string | undefined |
createIfNotExists | boolean | false |
skipAncestors | boolean | false |
Returns​
Property
<unknown
>
Inherited from​
Defined in​
render​
â–¸ render(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Inherited from​
Defined in​
applyEffects​
â–¸ Protected
applyEffects(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Inherited from​
Defined in​
addChild​
â–¸ Protected
addChild(childNode
): void
Parameters​
Name | Type |
---|---|
childNode | HTMLElement | Element |
Returns​
void
Inherited from​
Defined in​
matchesSelector​
â–¸ Protected
matchesSelector(selector
): boolean
Parameters​
Name | Type |
---|---|
selector | string |
Returns​
boolean
Inherited from​
Defined in​
addStylesFromStyleDefinition​
â–¸ addStylesFromStyleDefinition(): void
Returns​
void
Inherited from​
TextElement.addStylesFromStyleDefinition
Defined in​
removeStyles​
â–¸ Protected
removeStyles(element
, ignoreStyles
): [string
, string
][]
Parameters​
Name | Type |
---|---|
element | Element |
ignoreStyles | string [] |
Returns​
[string
, string
][]
Inherited from​
Defined in​
restoreStyles​
â–¸ Protected
restoreStyles(element
, styles
): void
Parameters​
Name | Type |
---|---|
element | Element |
styles | [string , string ][] |
Returns​
void
Inherited from​
Defined in​
isFirstChild​
â–¸ isFirstChild(): boolean
Returns​
boolean
Inherited from​
Defined in​
calculateOpacity​
â–¸ Protected
calculateOpacity(): number
Returns​
number
Inherited from​
Defined in​
src/Document/RenderedElement.ts:13
clearContext​
â–¸ clearContext(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Inherited from​
Defined in​
src/Document/RenderedElement.ts:215
setContext​
â–¸ setContext(ctx
, fromMeasure?
): void
Parameters​
Name | Type | Default value |
---|---|---|
ctx | RenderingContext2D | undefined |
fromMeasure | boolean | false |
Returns​
void
Inherited from​
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​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
Inherited from​
Defined in​
src/Document/TextElement.ts:60
getFontSize​
â–¸ Protected
getFontSize(): number
Returns​
number
Inherited from​
Defined in​
src/Document/TextElement.ts:85
getTElementBoundingBox​
â–¸ Protected
getTElementBoundingBox(ctx
): BoundingBox
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
Inherited from​
TextElement.getTElementBoundingBox
Defined in​
src/Document/TextElement.ts:96
getGlyph​
â–¸ getGlyph(font
, text
, i
): GlyphElement
Parameters​
Name | Type |
---|---|
font | FontElement |
text | string |
i | number |
Returns​
Inherited from​
Defined in​
src/Document/TextElement.ts:107
getTextFromNode​
â–¸ Protected
getTextFromNode(node?
): string
Parameters​
Name | Type |
---|---|
node? | ChildNode |
Returns​
string
Inherited from​
Defined in​
src/Document/TextElement.ts:149
renderTElementChildren​
â–¸ Protected
renderTElementChildren(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Inherited from​
TextElement.renderTElementChildren
Defined in​
src/Document/TextElement.ts:198
applyAnchoring​
â–¸ Protected
applyAnchoring(): void
Returns​
void
Inherited from​
Defined in​
src/Document/TextElement.ts:277
adjustChildCoordinatesRecursive​
â–¸ Protected
adjustChildCoordinatesRecursive(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Inherited from​
TextElement.adjustChildCoordinatesRecursive
Defined in​
src/Document/TextElement.ts:309
adjustChildCoordinatesRecursiveCore​
â–¸ Protected
adjustChildCoordinatesRecursiveCore(ctx
, textParent
, parent
, i
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
textParent | TextElement |
parent | Element |
i | number |
Returns​
void
Inherited from​
TextElement.adjustChildCoordinatesRecursiveCore
Defined in​
src/Document/TextElement.ts:316
adjustChildCoordinates​
â–¸ Protected
adjustChildCoordinates(ctx
, textParent
, parent
, i
): TextElement
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
textParent | TextElement |
parent | Element |
i | number |
Returns​
Inherited from​
TextElement.adjustChildCoordinates
Defined in​
src/Document/TextElement.ts:334
getChildBoundingBox​
â–¸ Protected
getChildBoundingBox(ctx
, textParent
, parent
, i
): BoundingBox
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
textParent | TextElement |
parent | Element |
i | number |
Returns​
Inherited from​
TextElement.getChildBoundingBox
Defined in​
src/Document/TextElement.ts:432
renderChild​
â–¸ Protected
renderChild(ctx
, textParent
, parent
, i
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
textParent | TextElement |
parent | Element |
i | number |
Returns​
void
Inherited from​
Defined in​
src/Document/TextElement.ts:458
measureTargetText​
â–¸ Protected
measureTargetText(ctx
, targetText
): number
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
targetText | string |
Returns​
number
Inherited from​
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​
Name | Type | Description |
---|---|---|
name | string | The 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​
Defined in​
src/Document/TextPathElement.ts:73
path​
â–¸ path(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Defined in​
src/Document/TextPathElement.ts:77
renderChildren​
â–¸ renderChildren(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Overrides​
Defined in​
src/Document/TextPathElement.ts:174
getLetterSpacingAt​
â–¸ Protected
getLetterSpacingAt(idx?
): number
Parameters​
Name | Type | Default value |
---|---|---|
idx | number | 0 |
Returns​
number
Defined in​
src/Document/TextPathElement.ts:240
findSegmentToFitChar​
â–¸ Protected
findSegmentToFitChar(ctx
, anchor
, textFullWidth
, fullPathWidth
, spacesNumber
, inputOffset
, dy
, c
, charI
): Object
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
anchor | string |
textFullWidth | number |
fullPathWidth | number |
spacesNumber | number |
inputOffset | number |
dy | number |
c | string |
charI | number |
Returns​
Object
Name | Type |
---|---|
offset | number |
segment | { p0 : ICachedPoint ; p1 : ICachedPoint } |
segment.p0 | ICachedPoint |
segment.p1 | ICachedPoint |
rotation | number |
Defined in​
src/Document/TextPathElement.ts:244
measureText​
â–¸ Protected
measureText(ctx
, text?
): number
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
text? | string |
Returns​
number
Overrides​
Defined in​
src/Document/TextPathElement.ts:308
setTextData​
â–¸ Protected
setTextData(ctx
): void
Parameters​
Name | Type |
---|---|
ctx | RenderingContext2D |
Returns​
void
Defined in​
src/Document/TextPathElement.ts:329
parsePathData​
â–¸ Protected
parsePathData(path
): IPathCommand
[]
Parameters​
Name | Type |
---|---|
path | PathElement |
Returns​
IPathCommand
[]
Defined in​
src/Document/TextPathElement.ts:455
pathM​
â–¸ Protected
pathM(pathParser
, points
): void
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
void
Defined in​
src/Document/TextPathElement.ts:542
pathL​
â–¸ Protected
pathL(pathParser
, points
): 16
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
16
Defined in​
src/Document/TextPathElement.ts:554
pathH​
â–¸ Protected
pathH(pathParser
, points
): 16
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
16
Defined in​
src/Document/TextPathElement.ts:568
pathV​
â–¸ Protected
pathV(pathParser
, points
): 16
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
16
Defined in​
src/Document/TextPathElement.ts:582
pathC​
â–¸ Protected
pathC(pathParser
, points
): void
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
void
Defined in​
src/Document/TextPathElement.ts:596
pathS​
â–¸ Protected
pathS(pathParser
, points
): 32
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
32
Defined in​
src/Document/TextPathElement.ts:616
pathQ​
â–¸ Protected
pathQ(pathParser
, points
): void
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
void
Defined in​
src/Document/TextPathElement.ts:638
pathT​
â–¸ Protected
pathT(pathParser
, points
): 128
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
points | number [] |
Returns​
128
Defined in​
src/Document/TextPathElement.ts:655
pathA​
â–¸ Protected
pathA(pathParser
): number
[]
Parameters​
Name | Type |
---|---|
pathParser | PathParser |
Returns​
number
[]
Defined in​
src/Document/TextPathElement.ts:674
calcLength​
â–¸ Protected
calcLength(x
, y
, commandType
, points
): number
Parameters​
Name | Type |
---|---|
x | number |
y | number |
commandType | 1 | 2 | 4 | 16 | 8 | 128 | 256 | 32 | 64 | 512 |
points | number [] |
Returns​
number
Defined in​
src/Document/TextPathElement.ts:707
getPointOnLine​
â–¸ Protected
getPointOnLine(dist
, p1x
, p1y
, p2x
, p2y
, fromX?
, fromY?
): IPoint
Parameters​
Name | Type | Default value |
---|---|---|
dist | number | undefined |
p1x | number | undefined |
p1y | number | undefined |
p2x | number | undefined |
p2y | number | undefined |
fromX | number | p1x |
fromY | number | p1y |
Returns​
IPoint
Defined in​
src/Document/TextPathElement.ts:862
getPointOnPath​
â–¸ Protected
getPointOnPath(distance
): IPoint
Parameters​
Name | Type |
---|---|
distance | number |
Returns​
IPoint
Defined in​
src/Document/TextPathElement.ts:928
getLineLength​
â–¸ Protected
getLineLength(x1
, y1
, x2
, y2
): number
Parameters​
Name | Type |
---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
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​
Name | Type |
---|---|
pct | number |
p1x | number |
p1y | number |
p2x | number |
p2y | number |
p3x | number |
p3y | number |
p4x | number |
p4y | number |
Returns​
IPoint
Defined in​
src/Document/TextPathElement.ts:1074
getPointOnQuadraticBezier​
â–¸ Protected
getPointOnQuadraticBezier(pct
, p1x
, p1y
, p2x
, p2y
, p3x
, p3y
): IPoint
Parameters​
Name | Type |
---|---|
pct | number |
p1x | number |
p1y | number |
p2x | number |
p2y | number |
p3x | number |
p3y | number |
Returns​
IPoint
Defined in​
src/Document/TextPathElement.ts:1094
getPointOnEllipticalArc​
â–¸ Protected
getPointOnEllipticalArc(cx
, cy
, rx
, ry
, theta
, psi
): IPoint
Parameters​
Name | Type |
---|---|
cx | number |
cy | number |
rx | number |
ry | number |
theta | number |
psi | number |
Returns​
IPoint
Defined in​
src/Document/TextPathElement.ts:1112
buildEquidistantCache​
â–¸ Protected
buildEquidistantCache(inputStep
, inputPrecision
): void
Parameters​
Name | Type |
---|---|
inputStep | number |
inputPrecision | number |
Returns​
void
Defined in​
src/Document/TextPathElement.ts:1134
getEquidistantPointOnPath​
â–¸ Protected
getEquidistantPointOnPath(targetDistance
, step?
, precision?
): ICachedPoint
Parameters​
Name | Type |
---|---|
targetDistance | number |
step? | number |
precision? | number |
Returns​
ICachedPoint