[79a0317] | 1 | import { RenderingContext2D } from '../types';
|
---|
| 2 | import PathParser, { CommandType } from '../PathParser';
|
---|
| 3 | import Document from './Document';
|
---|
| 4 | import TextElement from './TextElement';
|
---|
| 5 | import PathElement from './PathElement';
|
---|
| 6 | export interface IPoint {
|
---|
| 7 | x: number;
|
---|
| 8 | y: number;
|
---|
| 9 | }
|
---|
| 10 | export interface IPathCommand {
|
---|
| 11 | type: CommandType;
|
---|
| 12 | points: number[];
|
---|
| 13 | start?: IPoint;
|
---|
| 14 | pathLength: number;
|
---|
| 15 | }
|
---|
| 16 | interface ICachedPoint extends IPoint {
|
---|
| 17 | distance: number;
|
---|
| 18 | }
|
---|
| 19 | interface IGlyphInfo {
|
---|
| 20 | text: string;
|
---|
| 21 | rotation: number;
|
---|
| 22 | p0: ICachedPoint;
|
---|
| 23 | p1: ICachedPoint;
|
---|
| 24 | }
|
---|
| 25 | export default class TextPathElement extends TextElement {
|
---|
| 26 | type: string;
|
---|
| 27 | protected textWidth: number;
|
---|
| 28 | protected textHeight: number;
|
---|
| 29 | protected pathLength: number;
|
---|
| 30 | protected glyphInfo: IGlyphInfo[];
|
---|
| 31 | protected readonly text: string;
|
---|
| 32 | protected readonly dataArray: IPathCommand[];
|
---|
| 33 | private letterSpacingCache;
|
---|
| 34 | private equidistantCache;
|
---|
| 35 | private readonly measuresCache;
|
---|
| 36 | constructor(document: Document, node: HTMLElement, captureTextNodes?: boolean);
|
---|
| 37 | getText(): string;
|
---|
| 38 | path(ctx: RenderingContext2D): void;
|
---|
| 39 | renderChildren(ctx: RenderingContext2D): void;
|
---|
| 40 | protected getLetterSpacingAt(idx?: number): number;
|
---|
| 41 | protected findSegmentToFitChar(ctx: RenderingContext2D, anchor: string, textFullWidth: number, fullPathWidth: number, spacesNumber: number, inputOffset: number, dy: number, c: string, charI: number): {
|
---|
| 42 | offset: number;
|
---|
| 43 | segment: {
|
---|
| 44 | p0: ICachedPoint;
|
---|
| 45 | p1: ICachedPoint;
|
---|
| 46 | };
|
---|
| 47 | rotation: number;
|
---|
| 48 | };
|
---|
| 49 | protected measureText(ctx: RenderingContext2D, text?: string): number;
|
---|
| 50 | protected setTextData(ctx: RenderingContext2D): void;
|
---|
| 51 | protected parsePathData(path: PathElement): IPathCommand[];
|
---|
| 52 | protected pathM(pathParser: PathParser, points: number[]): void;
|
---|
| 53 | protected pathL(pathParser: PathParser, points: number[]): 16;
|
---|
| 54 | protected pathH(pathParser: PathParser, points: number[]): 16;
|
---|
| 55 | protected pathV(pathParser: PathParser, points: number[]): 16;
|
---|
| 56 | protected pathC(pathParser: PathParser, points: number[]): void;
|
---|
| 57 | protected pathS(pathParser: PathParser, points: number[]): 32;
|
---|
| 58 | protected pathQ(pathParser: PathParser, points: number[]): void;
|
---|
| 59 | protected pathT(pathParser: PathParser, points: number[]): 128;
|
---|
| 60 | protected pathA(pathParser: PathParser): number[];
|
---|
| 61 | protected calcLength(x: number, y: number, commandType: CommandType, points: number[]): number;
|
---|
| 62 | protected getPointOnLine(dist: number, p1x: number, p1y: number, p2x: number, p2y: number, fromX?: number, fromY?: number): IPoint;
|
---|
| 63 | protected getPointOnPath(distance: number): IPoint;
|
---|
| 64 | protected getLineLength(x1: number, y1: number, x2: number, y2: number): number;
|
---|
| 65 | protected getPathLength(): number;
|
---|
| 66 | protected getPointOnCubicBezier(pct: number, p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number, p4x: number, p4y: number): IPoint;
|
---|
| 67 | protected getPointOnQuadraticBezier(pct: number, p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number): IPoint;
|
---|
| 68 | protected getPointOnEllipticalArc(cx: number, cy: number, rx: number, ry: number, theta: number, psi: number): IPoint;
|
---|
| 69 | protected buildEquidistantCache(inputStep: number, inputPrecision: number): void;
|
---|
| 70 | protected getEquidistantPointOnPath(targetDistance: number, step?: number, precision?: number): ICachedPoint;
|
---|
| 71 | }
|
---|
| 72 | export {};
|
---|
| 73 | //# sourceMappingURL=TextPathElement.d.ts.map |
---|