UNPKG

2.31 kBTypeScriptView Raw
1import { RenderingContext2D } from '../types';
2import { BoundingBox } from '../BoundingBox';
3import { Document } from './Document';
4import { Element } from './Element';
5import { FontElement } from './FontElement';
6import { GlyphElement } from './GlyphElement';
7import { RenderedElement } from './RenderedElement';
8export declare class TextElement extends RenderedElement {
9 type: string;
10 protected x: number;
11 protected y: number;
12 private leafTexts;
13 private textChunkStart;
14 private minX;
15 private maxX;
16 private measureCache;
17 constructor(document: Document, node: HTMLElement, captureTextNodes?: boolean);
18 setContext(ctx: RenderingContext2D, fromMeasure?: boolean): void;
19 protected initializeCoordinates(): void;
20 getBoundingBox(ctx: RenderingContext2D): BoundingBox;
21 protected getFontSize(): number;
22 protected getTElementBoundingBox(ctx: RenderingContext2D): BoundingBox;
23 getGlyph(font: FontElement, text: string, i: number): GlyphElement;
24 getText(): string;
25 protected getTextFromNode(node?: ChildNode): string;
26 renderChildren(ctx: RenderingContext2D): void;
27 protected renderTElementChildren(ctx: RenderingContext2D): void;
28 protected applyAnchoring(): void;
29 protected adjustChildCoordinatesRecursive(ctx: RenderingContext2D): void;
30 protected adjustChildCoordinatesRecursiveCore(ctx: RenderingContext2D, textParent: TextElement, parent: Element, i: number): void;
31 protected adjustChildCoordinates(ctx: RenderingContext2D, textParent: TextElement, parent: Element, i: number): TextElement;
32 protected getChildBoundingBox(ctx: RenderingContext2D, textParent: TextElement, parent: Element, i: number): BoundingBox;
33 protected renderChild(ctx: RenderingContext2D, textParent: TextElement, parent: Element, i: number): void;
34 protected measureText(ctx: RenderingContext2D): number;
35 protected measureTargetText(ctx: RenderingContext2D, targetText: string): number;
36 /**
37 * Inherits positional attributes from {@link TextElement} parent(s). Attributes
38 * are only inherited from a parent to its first child.
39 * @param name - The attribute name.
40 * @returns The attribute value or null.
41 */
42 protected getInheritedAttribute(name: string): string | null;
43}
44//# sourceMappingURL=TextElement.d.ts.map
\No newline at end of file