import { type DataWriter } from '../data-writer.ts'; import { TableBuilder } from '../table-builder.ts'; import { type LocaTable } from './loca.ts'; import { type MaxpTable } from './maxp.ts'; /** * Represents a simple glyph in the 'glyf' table. */ export type SimpleGlyph = { /** The type of the glyph, either 'simple' or 'composite'. */ readonly type: 'simple'; /** The raw glyph data. */ readonly data: DataView; }; /** * Represents a compound glyph in the 'glyf' table. */ export type CompoundGlyph = { /** The type of the glyph, either 'simple' or 'composite'. */ readonly type: 'composite'; /** The IDs of the component glyphs. */ readonly glyphIds: ReadonlyArray; /** The raw glyph data. */ readonly data: DataView; }; export type Glyph = SimpleGlyph | CompoundGlyph; /** * The 'glyf' table contains the outline data for TrueType glyphs. */ export declare class GlyfTable { private readonly data; private readonly offsets; /** * The number of glyphs in the 'glyf' table. */ readonly numGlyphs: number; /** * Reads a 'glyf' table from the given DataView. */ static read(data: DataView, maxp: MaxpTable, loca: LocaTable): GlyfTable; private constructor(); /** * Retrieves the glyph data for the specified glyph ID. */ readGlyph(glyphId: number): Glyph; } /** * Builder for the 'glyf' table. */ export declare class GlyfTableBuilder extends TableBuilder { private readonly glyphs; private readonly glyphIdMap; private readonly skipInstructions; private _writtenOffsets; /** * Creates a new GlyfTableBuilder for the given glyphs. */ constructor(glyphs: ReadonlyArray, opts?: { glyphIdMap?: ReadonlyMap; skipInstructions?: boolean; }); /** * The number of glyphs in the 'glyf' table. */ get numGlyphs(): number; /** * The array of offsets for each glyph, including an extra entry for * the end of the table. Only valid after writing the table. */ get writtenOffsets(): readonly number[]; writeTable(writer: DataWriter): void; } /** * Reads a glyph from the given DataView. */ export declare function readGlyph(data: DataView): Glyph; /** * Writes a glyph to the given DataWriter. */ export declare function writeGlyph(glyph: Glyph, writer: DataWriter, opts?: { glyphIdMap?: ReadonlyMap; skipInstructions?: boolean; }): void;