import type { Reader } from "../../font/binary/reader.ts"; import type { Tag, uint16 } from "../../types.ts"; /** Language system record */ export interface LangSysRecord { langSysTag: Tag; langSys: LangSys; } /** Language system table */ export interface LangSys { /** Required feature index (0xFFFF if none) */ requiredFeatureIndex: uint16; /** Feature indices */ featureIndices: uint16[]; } /** Script record */ export interface ScriptRecord { scriptTag: Tag; script: Script; } /** Script table */ export interface Script { /** Default language system (may be null) */ defaultLangSys: LangSys | null; /** Language system records */ langSysRecords: LangSysRecord[]; } /** Script list table */ export interface ScriptList { scripts: ScriptRecord[]; } /** Feature record */ export interface FeatureRecord { featureTag: Tag; feature: Feature; } /** Feature table */ export interface Feature { /** Feature parameters offset (usually 0) */ featureParamsOffset: uint16; /** Lookup indices */ lookupListIndices: uint16[]; } /** Feature list table */ export interface FeatureList { features: FeatureRecord[]; } /** Lookup table header */ export interface LookupHeader { lookupType: uint16; lookupFlag: uint16; subtableOffsets: uint16[]; /** Mark filtering set (if UseMarkFilteringSet flag is set) */ markFilteringSet?: uint16; } /** Lookup flags */ export declare const LookupFlag: { readonly RightToLeft: 1; readonly IgnoreBaseGlyphs: 2; readonly IgnoreLigatures: 4; readonly IgnoreMarks: 8; readonly UseMarkFilteringSet: 16; readonly MarkAttachmentTypeMask: 65280; }; /** Extract mark attachment type from lookup flag */ export declare function getMarkAttachmentType(lookupFlag: uint16): number; /** Parse ScriptList */ export declare function parseScriptList(reader: Reader): ScriptList; /** Parse FeatureList */ export declare function parseFeatureList(reader: Reader): FeatureList; /** Parse lookup headers (does not parse subtables) */ export declare function parseLookupHeaders(reader: Reader): LookupHeader[]; /** * Find script in script list by tag * @param scriptList - The script list to search * @param scriptTag - The script tag to find (e.g., 'latn', 'arab') * @returns The script table if found, null otherwise */ export declare function findScript(scriptList: ScriptList, scriptTag: Tag): Script | null; /** * Find language system in script by tag * @param script - The script table to search * @param langSysTag - The language system tag to find (e.g., 'ENG', 'ARA'), or null for default * @returns The language system table if found, or the default language system if langSysTag is null or not found */ export declare function findLangSys(script: Script, langSysTag: Tag | null): LangSys | null; /** * Get feature by index from feature list * @param featureList - The feature list to retrieve from * @param index - The zero-based feature index * @returns The feature record at the specified index, or null if index is out of bounds */ export declare function getFeature(featureList: FeatureList, index: number): FeatureRecord | null;