import type { Reader } from "../../font/binary/reader.ts"; import type { int16, uint16 } from "../../types.ts"; /** * Device table - pixel-level adjustments for different PPEM sizes * Used in GPOS for fine-tuning positioning at specific sizes */ export interface DeviceTable { startSize: uint16; endSize: uint16; deltaFormat: uint16; /** Delta values indexed by (ppem - startSize) */ deltaValues: int16[]; } /** VariationIndex table for variable fonts (shares format with Device) */ export interface VariationIndexTable { deltaSetOuterIndex: uint16; deltaSetInnerIndex: uint16; } /** Combined type - can be either Device or VariationIndex */ export type DeviceOrVariationIndex = DeviceTable | VariationIndexTable; /** * Check if this is a VariationIndex table * @param table - The device or variation index table to check * @returns True if the table is a VariationIndex table, false if it's a Device table */ export declare function isVariationIndexTable(table: DeviceOrVariationIndex): table is VariationIndexTable; /** * Parse Device or VariationIndex table at offset * @param reader - Binary reader positioned at the parent table * @param offset - Offset from reader's current position to the device table * @returns Parsed device or variation index table, or null if offset is 0 */ export declare function parseDeviceAt(reader: Reader, offset: number): DeviceOrVariationIndex | null; /** * Parse Device or VariationIndex table * @param reader - Binary reader positioned at the device table start * @returns Parsed device or variation index table */ export declare function parseDevice(reader: Reader): DeviceOrVariationIndex; /** * Get delta adjustment for a specific PPEM size * @param device - The device table to query * @param ppem - Pixels per em size to get delta for * @returns Delta adjustment value, or 0 if PPEM is outside the table's range */ export declare function getDeviceDelta(device: DeviceTable, ppem: number): int16; /** * Apply Device table adjustment to a value * @param device - The device or variation index table, or null * @param value - The base value to adjust * @param ppem - Pixels per em size for device table lookup * @returns Adjusted value (for Device tables) or unchanged value (for VariationIndex tables or null) */ export declare function applyDeviceAdjustment(device: DeviceOrVariationIndex | null, value: number, ppem: number): number; /** * Parsed value record with resolved Device tables */ export interface ResolvedValueRecord { xPlacement: number; yPlacement: number; xAdvance: number; yAdvance: number; xPlaDevice: DeviceOrVariationIndex | null; yPlaDevice: DeviceOrVariationIndex | null; xAdvDevice: DeviceOrVariationIndex | null; yAdvDevice: DeviceOrVariationIndex | null; } /** * Apply all Device adjustments to a resolved value record * @param record - The value record containing placement and advance values with device tables * @param ppem - Pixels per em size for device table lookups * @returns Object containing adjusted xPlacement, yPlacement, xAdvance, and yAdvance values */ export declare function applyDeviceAdjustments(record: ResolvedValueRecord, ppem: number): { xPlacement: number; yPlacement: number; xAdvance: number; yAdvance: number; };