import type { Reader } from "../../font/binary/reader.ts"; import type { GlyphId, uint16 } from "../../types.ts"; /** Range record for Format 2 */ interface RangeRecord { startGlyphId: GlyphId; endGlyphId: GlyphId; startCoverageIndex: uint16; } /** * Coverage table - maps glyph IDs to coverage indices. * * IMPORTANT: This is a unified class (not interface + implementations) to ensure * monomorphic call sites in V8. Polymorphic calls can be 7-8x slower! */ export declare class Coverage { private readonly glyphMap; private readonly ranges; private readonly glyphArray; readonly size: number; private constructor(); /** * Create Format 1 coverage (individual glyphs) * @param glyphArray - Array of glyph IDs to cover * @returns Coverage instance using hash map for O(1) lookup */ static format1(glyphArray: Uint16Array): Coverage; /** * Create Format 2 coverage (ranges) * @param ranges - Array of range records defining covered glyph ranges * @returns Coverage instance using binary search for range lookup */ static format2(ranges: RangeRecord[]): Coverage; /** * Get coverage index for a glyph ID * @param glyphId - The glyph ID to look up * @returns Coverage index (0-based) if glyph is covered, null otherwise */ get(glyphId: GlyphId): number | null; /** * Check if glyph is covered * @param glyphId - The glyph ID to check * @returns True if the glyph is in this coverage table */ covers(glyphId: GlyphId): boolean; /** * Get all covered glyph IDs * @returns Array of all glyph IDs in this coverage table */ glyphs(): GlyphId[]; } /** * Parse a Coverage table from binary data * @param reader - Binary reader positioned at coverage table start * @returns Parsed coverage instance (Format 1 or Format 2) */ export declare function parseCoverage(reader: Reader): Coverage; /** * Parse Coverage from offset (creates sub-reader) * @param reader - Binary reader positioned at parent table * @param offset - Offset from reader's current position to coverage table * @returns Parsed coverage instance */ export declare function parseCoverageAt(reader: Reader, offset: number): Coverage; export {};