@thi.ng/text-canvas
Version:
Text based canvas, drawing, plotting, tables with arbitrary formatting (incl. ANSI/HTML)
46 lines • 1.58 kB
TypeScript
import type { TextBoxOpts } from "./api.js";
import { type Canvas } from "./canvas.js";
/**
* Writes given string at position `x`,`y`, taking the current clip rect
* and format into account. The string MUST not include linebreaks or
* other control chars.
*
* @param canvas -
* @param x -
* @param y -
* @param line -
*/
export declare const textLine: (canvas: Canvas, x: number, y: number, line: string, format?: number) => void;
export declare const textLines: (canvas: Canvas, x: number, y: number, lines: string[], format?: number) => number;
/**
* Writes multiline string at position `x`,`y` and using column `width`,
* also taking the current clip rect and format into account. Applies
* word wrapping.
*
* @param canvas -
* @param x -
* @param y -
* @param width -
* @param txt -
* @param format -
* @param hardWrap -
*/
export declare const textColumn: (canvas: Canvas, x: number, y: number, width: number, txt: string, format?: number, hard?: boolean) => number;
/**
* Draws a text box at given position and dimension. If `height < 0`, the inner
* box height will be set to the number of lines required to fit the given (word
* wrapped) text.
*
* @remarks
* The width and height will include any configured padding and the box frame.
*
* @param canvas -
* @param x -
* @param y -
* @param width -
* @param height -
* @param txt -
* @param opts -
*/
export declare const textBox: (canvas: Canvas, x: number, y: number, width: number, height: number, txt: string, opts?: Partial<TextBoxOpts>) => number;
//# sourceMappingURL=text.d.ts.map