import { ParsedTtf } from './ttf-parser.js'; /** A font style slot: regular, bold, italic or bold-italic. */ export type FontVariant = 'regular' | 'bold' | 'italic' | 'boldItalic'; /** * The single owner of face fallback (oop-design §8, A4): the candidate cascade a * missing variant degrades through (`boldItalic → bold → italic → regular`), * shared by the registry and every font provider. * * @param has Predicate — does a given variant exist? * @param bold Whether bold was requested. * @param italic Whether italic was requested. * @returns The best available variant, or `undefined` when even `regular` is missing. */ export declare function pickVariant(has: (variant: FontVariant) => boolean, bold: boolean, italic: boolean): FontVariant | undefined; /** Raw TTF/OTF bytes per style variant; only `regular` is required. */ export interface FontBytesByVariant { /** The regular (upright, normal-weight) face — required. */ readonly regular: Uint8Array; /** The bold face, if available. */ readonly bold?: Uint8Array; /** The italic face, if available. */ readonly italic?: Uint8Array; /** The bold-italic face, if available. */ readonly boldItalic?: Uint8Array; } /** * A registry of parsed font variants. The renderer resolves a `(bold, italic)` * request to the closest available face via {@link pickVariant}, degrading * through `bold → italic → regular` when an exact match is missing. */ export declare class FontRegistry { private readonly fonts; private constructor(); /** * Parse a set of font bytes into a registry. * * @param input The bytes per variant (`regular` required). * @returns A registry holding the parsed faces. */ static fromBytes(input: FontBytesByVariant): FontRegistry; /** * Resolve a style request to the closest available face. * * @param bold Whether bold was requested. * @param italic Whether italic was requested. * @returns The chosen variant and its parsed font. * @throws Error when the registry has no usable (regular) font. */ resolveByStyle(bold: boolean, italic: boolean): { variant: FontVariant; parsed: ParsedTtf; }; /** Iterate the `[variant, parsed font]` pairs the registry holds. */ entries(): IterableIterator<[FontVariant, ParsedTtf]>; /** Whether a given variant is present. */ hasVariant(v: FontVariant): boolean; }