import type { Tag, uint16 } from "../../types.ts"; import type { Reader } from "../binary/reader.ts"; /** * Style Attributes table (STAT) * Provides style information for variable fonts * Used for font selection and naming */ export interface StatTable { majorVersion: uint16; minorVersion: uint16; designAxisCount: uint16; designAxes: AxisRecord[]; axisValueCount: uint16; axisValues: AxisValue[]; elidedFallbackNameID?: uint16; } /** * Design axis record */ export interface AxisRecord { axisTag: Tag; axisNameID: uint16; axisOrdering: uint16; } /** * Axis value flags */ export declare const AxisValueFlags: { readonly OlderSiblingFontAttribute: 1; readonly ElidableAxisValueName: 2; }; /** * Base axis value */ export interface AxisValueBase { format: number; axisIndex: uint16; flags: uint16; valueNameID: uint16; } /** * Format 1: Single axis value */ export interface AxisValueFormat1 extends AxisValueBase { format: 1; value: number; } /** * Format 2: Axis value range */ export interface AxisValueFormat2 extends AxisValueBase { format: 2; nominalValue: number; rangeMinValue: number; rangeMaxValue: number; } /** * Format 3: Linked axis value */ export interface AxisValueFormat3 extends AxisValueBase { format: 3; value: number; linkedValue: number; } /** * Format 4: Multiple axis values */ export interface AxisValueFormat4 { format: 4; axisCount: uint16; flags: uint16; valueNameID: uint16; axisValues: { axisIndex: uint16; value: number; }[]; } export type AxisValue = AxisValueFormat1 | AxisValueFormat2 | AxisValueFormat3 | AxisValueFormat4; /** * Parse STAT table */ export declare function parseStat(reader: Reader): StatTable; /** * Get axis record by tag */ export declare function getAxisRecord(stat: StatTable, axisTag: Tag): AxisRecord | null; /** * Get axis index by tag */ export declare function getAxisIndex(stat: StatTable, axisTag: Tag): number; /** * Get axis values for a specific axis */ export declare function getAxisValuesForAxis(stat: StatTable, axisIndex: number): AxisValue[]; /** * Find axis value by name ID */ export declare function findAxisValueByNameId(stat: StatTable, nameId: uint16): AxisValue | null; /** * Check if axis value is elidable */ export declare function isElidableAxisValue(axisValue: AxisValue): boolean; /** * Check if axis value represents an older sibling font */ export declare function isOlderSiblingFont(axisValue: AxisValue): boolean; /** * Get the value for a format 1-3 axis value */ export declare function getAxisValueNumber(axisValue: AxisValue): number | null; /** * Match axis value to coordinates * Returns true if the axis value matches the given coordinates */ export declare function matchAxisValue(axisValue: AxisValue, coords: Map): boolean;