import type { BinaryData, Line, HzLine, InitInput, LayoutOptions } from "./types"; /** * Initialize the WASM module. Must be called (and awaited) before * {@link layoutParagraph} or {@link measureWord}. * * The wasm-pack generated loader handles all input types: when called * without arguments it loads `kp_break_wasm_bg.wasm` from the same * directory via `import.meta.url`. You can override this by passing * a URL string, `URL` object, `Request`, `Response`, or * `Promise`. * * @param input - Optional override for the `.wasm` binary location. * * @example * ```ts * // Default — loads .wasm from the package directory * await init(); * * // Custom URL (self-hosted, CDN, etc.) * await init("https://cdn.example.com/kp_break_wasm_bg.wasm"); * * // Fetch response * await init(fetch("/my-path/kp_break_wasm_bg.wasm")); * ``` */ export declare function init(input?: InitInput): Promise; /** Returns `true` if the WASM module has been initialized. */ export declare function isReady(): boolean; /** * Lay out a paragraph of text using the Knuth-Plass algorithm with * HarfBuzz-accurate glyph measurement. * * The entire pipeline — text measurement, tokenization, hyphenation, * optimal line breaking, and line construction — runs in a single * WASM call for maximum performance. * * @param fontData - Raw TTF/OTF font binary. * @param options - Layout parameters (text, fontSize, lineWidth, etc.). * @returns An array of {@link Line} objects (or {@link HzLine} when Hz is enabled). * * @throws If {@link init} has not been called. * * @example * ```ts * await init(); * const fontData = await fetch("/fonts/Inter.ttf").then(r => r.arrayBuffer()); * const lines = layoutParagraph(fontData, { * text: "The problem of breaking a paragraph into lines...", * fontSize: 17, * lineWidth: 400, * }); * ``` */ export declare function layoutParagraph(fontData: BinaryData, options: LayoutOptions): Line[] | HzLine[]; /** * Register a font binary once and reuse the returned handle for repeated * layouts. This lets the WASM engine reuse parsed font state and shaping * caches across calls. */ export declare function registerLayoutFont(fontData: BinaryData): number; /** Release a font handle previously returned by {@link registerLayoutFont}. */ export declare function unregisterLayoutFont(fontHandle: number): boolean; /** * Lay out a paragraph with a registered font handle. */ export declare function layoutParagraphWithFont(fontHandle: number, options: LayoutOptions): Line[] | HzLine[]; /** * Measure the advance width of a single word using HarfBuzz shaping. * Useful for debugging or building custom layout logic. * * @param fontData - Raw TTF/OTF font binary. * @param fontSize - Font size in CSS pixels. * @param word - The text to measure. * @param liga - Enable standard ligatures. Default: `true`. * @param fontWeight - CSS font-weight. Default: `400`. * @param opsz - Optical sizing axis value. Defaults to `fontSize`. * @param ital - Italic/slant axis value. Default: `0`. * @param wdth - Width axis value (100 = normal). Default: `100`. * @returns Width in CSS pixels. * * @throws If {@link init} has not been called. */ export declare function measureWord(fontData: BinaryData, fontSize: number, word: string, liga?: boolean, fontWeight?: number, opsz?: number, ital?: number, wdth?: number): number; //# sourceMappingURL=wasm.d.ts.map