import { DataReader } from '../data-reader.ts'; import { type DataWriter } from '../data-writer.ts'; import { TableBuilder } from '../table-builder.ts'; /** * An encoding record in the 'cmap' table. */ export type EncodingRecord = { /** The platform ID for this encoding record. */ readonly platformID: number; /** The encoding ID for this encoding record. */ readonly encodingID: number; /** Reads the subtable for this encoding record. */ readonly readSubtable: () => CmapSubtable; }; /** * A subtable in the 'cmap' table. */ export type CmapSubtable = { /** The format of this cmap subtable. */ readonly format: number; /** The language of this cmap subtable. */ readonly language: number; /** Reads the mapping of character codes to glyph indices. */ readonly readGlyphMapping: () => ReadonlyMap; }; /** * The 'cmap' table maps character codes to glyph indices. */ export declare class CmapTable { /** The encoding records in this 'cmap' table. */ readonly encodingRecords: ReadonlyArray; /** * Reads a 'cmap' table from the given DataView. */ static read(data: DataView): CmapTable; private constructor(); } /** * Returns the most appropriate cmap subtable for Unicode text. */ export declare function selectBestCmapSubtable(cmapTable: CmapTable): CmapSubtable | undefined; declare abstract class CmapSubtableWriter { readonly platformID: number; readonly encodingID: number; abstract writeSubtable(writer: DataWriter): void; constructor(platformID: number, encodingID: number); } export declare class CmapTableWriter { subtables: CmapSubtableWriter[]; addSubtable(subtable: CmapSubtableWriter): void; writeTable(writer: DataWriter): void; } export declare function readCmapSubtableFormat0(reader: DataReader): CmapSubtable; export declare function readCmapSubtableFormat4(reader: DataReader): CmapSubtable; type CmapFormat4Segment = { startCode: number; endCode: number; idDelta?: number; glyphIdOffset?: number; }; export declare class CmapSubtable4Writer extends CmapSubtableWriter { language: number; segments: CmapFormat4Segment[]; glyphIds: number[]; constructor(platformID: number, encodingID: number, segments: CmapFormat4Segment[], glyphIds: number[]); writeSubtable(writer: DataWriter): void; } export declare function readCmapSubtableFormat6(reader: DataReader): CmapSubtable; export declare function readCmapSubtableFormat10(reader: DataReader): CmapSubtable; export declare function readCmapSubtableFormat12Or13(reader: DataReader, format: 12 | 13): CmapSubtable; export type CmapFormat12Group = { startCharCode: number; endCharCode: number; startGlyphID: number; }; export declare class CmapSubtable12Writer extends CmapSubtableWriter { readonly groups: CmapFormat12Group[]; language: number; constructor(platformID: number, encodingID: number, groups: CmapFormat12Group[]); writeSubtable(writer: DataWriter): void; } /** * Builder for the 'cmap' table. */ export declare class CmapTableBuilder extends TableBuilder { private readonly writer; constructor(); /** * Adds a format 4 subtable to the cmap table. */ addSubtable4(platformID: number, encodingID: number, segments: CmapFormat4Segment[], glyphIds: number[]): void; /** * Adds a format 12 subtable to the cmap table. */ addSubtable12(platformID: number, encodingID: number, groups: CmapFormat12Group[]): void; writeTable(writer: DataWriter): void; } export {};