export default TextMetrics; /** * a Text Metrics object that contains helper for text manipulation */ declare class TextMetrics extends Bounds { /** * @param {Text|BitmapText} ancestor - the parent object that contains this TextMetrics object */ constructor(ancestor: Text | BitmapText); /** * a reference to the parent object that contains this TextMetrics object * @type {Renderable} * @default undefined */ ancestor: Renderable; /** * Returns the height of a segment of inline text in CSS pixels. * @returns {number} the height of a segment of inline text in CSS pixels. */ lineHeight(): number; /** * Returns the width of the given segment of inline text in CSS pixels. * @param {string} text - the text to be measured * @param {CanvasRenderingContext2D} [context] - reference to an active 2d context for canvas rendering * @returns {number} the width of the given segment of inline text in CSS pixels. */ lineWidth(text: string, context?: CanvasRenderingContext2D): number; /** * measure the given text size in CSS pixels * @param {string} text - the text to be measured * @param {CanvasRenderingContext2D} [context] - reference to an active 2d context for canvas rendering * @returns {TextMetrics} this */ measureText(text: string, context?: CanvasRenderingContext2D): TextMetrics; glyphYOffset: number | undefined; glyphMaxBottom: number | undefined; /** * wrap the given text based on the given width * @param {string|string[]} text - the text to be wrapped * @param {number} width - maximum width of one segment of text in css pixel * @param {CanvasRenderingContext2D} [context] - reference to an active 2d context for canvas rendering * @returns {string[]} an array of string representing wrapped text */ wordWrap(text: string | string[], width: number, context?: CanvasRenderingContext2D): string[]; } import { Bounds } from "../../physics/bounds.ts"; import Text from "./text.js"; //# sourceMappingURL=textmetrics.d.ts.map