import { CanvasLike, GlobalRuntime } from '..'; import type { ParsedTextStyleProps } from '../display-objects'; import { Rectangle } from '../shapes'; export interface TextMetrics { font: string; width: number; height: number; lines: string[]; lineWidths: number[]; lineHeight: number; maxLineWidth: number; fontProperties: IFontMetrics; lineMetrics: Rectangle[]; } interface IFontMetrics { ascent: number; descent: number; fontSize: number; } /** * Borrow from pixi/packages/text/src/TextMetrics.ts */ export declare class TextService { private runtime; constructor(runtime: GlobalRuntime); /** * font metrics cache */ private fontMetricsCache; /** * Calculates the ascent, descent and fontSize of a given font-style. */ measureFont(font: string, offscreenCanvas: CanvasLike): IFontMetrics; measureText(text: string, parsedStyle: ParsedTextStyleProps, offscreenCanvas: CanvasLike): TextMetrics; private setGraphemeOnPath; private wordWrap; private isBreakingSpace; private isNewline; private trimToBreakable; private shouldBreakByKinsokuShorui; private trimByKinsokuShorui; private canBreakInLastChar; private sumTextWidthByCache; private findBreakableIndex; private getFromCache; } export {}; //# sourceMappingURL=TextService.d.ts.map