import type { Line, HzLine } from "../core/types"; /** * Options for {@link useKnuthPlassWrap}. */ export interface UseKnuthPlassWrapOptions { /** The paragraph text to lay out. */ text: string; /** Raw TTF/OTF font binary. Pass `null` while loading. */ fontData: ArrayBuffer | null; /** Font size in CSS pixels. */ fontSize: number; /** Target line width in CSS pixels. */ lineWidth: number; /** CSS font-weight. Passed to HarfBuzz for variable font shaping. Default: `400`. */ fontWeight?: number; /** Enable standard ligatures in HarfBuzz shaping. Default: `true`. */ liga?: boolean; /** Optical sizing axis value for HarfBuzz shaping. * - positive number: set opsz to that value * - 0: disable opsz (matches CSS `font-optical-sizing: none`) * Defaults to `fontSize` (matches CSS `font-optical-sizing: auto`). */ opsz?: number; /** Enable automatic hyphenation. Default: `false`. */ hyphenate?: boolean; /** ISO 639-1 language code for hyphenation (e.g. `"en"`, `"de"`, `"fr"`). * Also passed through for language-sensitive shaping. Default: `"en"`. */ lang?: string; /** Text direction metadata. Default: `"auto"`. */ dir?: "auto" | "ltr" | "rtl"; /** CSS writing-mode metadata. KP optimization is horizontal-width based. */ writingMode?: "horizontal-tb" | "vertical-rl" | "vertical-lr"; /** Apply similarity demerits for adjacent line tightness. Default: `true`. */ similarity?: boolean; /** Hz-program justification using the font's `wdth` axis. */ hz?: { min: number; max: number; }; } /** * Result of {@link useKnuthPlassWrap}. */ export interface UseKnuthPlassWrapResult { /** Laid-out lines (or HzLines when `hz` is set). */ lines: Line[] | HzLine[]; /** `true` while WASM is initializing or font is loading. */ isLoading: boolean; } /** * React hook for Knuth-Plass optimal line breaking. Wraps the WASM layout * engine for use in components that want custom rendering. Does not handle * font fetching — the component must provide `fontData` when ready. * * Must be used inside a `` boundary — suspends while WASM * initialises. * * @param options - Layout parameters (text, fontData, fontSize, lineWidth, etc.). * @returns Laid-out lines and loading state. */ export declare function useKnuthPlassWrap(options: UseKnuthPlassWrapOptions): UseKnuthPlassWrapResult; //# sourceMappingURL=useKnuthPlassWrap.d.ts.map