import { _FontStructure } from './font-structure'; /** * Parser for Compact Font Format data used to extract font * structures, encodings and glyph charstrings. * * @private */ export declare class _PdfCompactFontParser { /** * Raw bytes of the compact font file. * * @private */ _bytes: Uint8Array; /** * External properties passed in during parsing. * * @private */ _properties: any; /** * When true, additional analysis (e.g., standardCharacter detection) * will be performed while parsing. * * @private */ _isAnalysisEnabled: boolean; /** * Resulting compact font structure built by the parser. * * @private */ _compactFontFormat: _PdfCompactFormatFont; /** * Temporary storage used during parsing. * * @private */ _values: any; /** * Validation table for Type1/Type2 charstring operators. * * @private */ _characterValidationData: any; /** * Extended validation table for Type2 charstring “12” escape operators. * * @private */ _characterValidationData12: any; /** * Predefined CFF charset types. * * @private */ _compactCharSetPredefinedTypes: any; /** * Standard PostScript character set. * * @private */ _standardCharSet: string[]; /** * Expert PostScript character set. * * @private */ _expertCharSet: string[]; /** * Expert subset PostScript charset. * * @private */ _expertSubsetCharSet: string[]; /** * Temporary list of encoding glyph names. * * @private */ _standardEncodingChars: any; /** * Width array parsed from font data. * * @private */ _widths: any; /** * Internal read position used during font parsing. * * @private */ _pos: number; /** * Initializes the compact font parser with a file-like object and * parsing options. * * @private * @param {any} file Source file object exposing `getBytes()`. * @param {any} properties External properties for parsing/context. * @param {boolean} isAnalysisEnabled Enable deeper analysis during parsing. * @returns {void} nothing. */ constructor(file: any, properties: any, isAnalysisEnabled: boolean); /** * Parse and attach the private dictionary from the top-level dictionary * if present, otherwise create an empty private dictionary. * * @private * @param {any} parentDictionary Parent dictionary object to inspect/attach to. * @returns {void} nothing. */ _parsePrivateDictionary(parentDictionary: any): any; /** * Parse the entire compact font and return a structured font object. * * @private * @param {any} [properties] Optional properties passed through parsing. * @returns {_PdfCompactFormatFont} The parsed compact font structure. */ _parse(properties?: any): _PdfCompactFormatFont; /** * Parse the CharStrings index and populate widths and standard encoding * character arrays. * * @private * @param {any} charStrings Index object of charstrings. * @param {any} localSubroutineIndex Local subroutines index to use. * @param {any} globalSubroutineIndex Global subroutines index. * @param {any} fontDictionarySelect Optional FDSelect structure. * @param {any} fontDictionaryArray Array of font dictionaries when CID fonts used. * @param {any} privateDictionary Private dictionary object used as fallback. * @returns {any} Object containing `charStrings`, `this` (standardEncodingChars) and `widths`. */ _parseCharStrings(charStrings: any, localSubroutineIndex: any, globalSubroutineIndex: any, fontDictionarySelect: any, fontDictionaryArray: any, //eslint-disable-line privateDictionary: any): any; /** * Parse an FDSelect structure which maps glyph ranges to font dictionary indices. * * @private * @param {number} pos Offset into the bytes where FDSelect begins. * @param {number} length Number of glyphs expected. * @returns {any} A `_PdfCompactFontSelect` instance representing the FDSelect. */ _parseFontDictionarySelect(pos: number, length: number): any; /** * Parse the charsets table returning a character set descriptor. * * @private * @param {any} pos Byte offset or predefined id for charsets. * @param {any} length Number of glyphs expected. * @param {any} strings String index for resolving SIDs. * @param {any} characterIdentifier Whether this font uses CIDs. * @returns {any} A `_PdfCompactFontCharacterSet` describing the charSet. */ _parseCharSets(pos: any, length: any, strings: any, characterIdentifier: any): any; /** * Read extra supplement entries for an encoding and apply them. * * @private * @param {Uint8Array} bytes Raw bytes buffer. * @param {number} pos Current offset into `bytes` where supplements start. * @param {any} encoding Encoding map to update. * @param {any} charSet The charSet to reference SIDs. * @param {any} strings String index used to resolve SIDs. * @returns {any} The updated encoding map. */ _readSupplement(bytes: any, pos: number, encoding: any, charSet: any, strings: any): any; /** * Parse the encoding table for the compact font returning an encoding * descriptor object. * * @private * @param {any} pos Position or predefined id of the encoding. * @param {any} properties Properties passed during parsing. * @param {any} strings String index for SID lookup. * @param {any} charSet Character set used for this font. * @returns {any} A `_PdfCompactFontEncoding` describing the encoding. */ _parseEncoding(pos: any, properties: any, strings: any, charSet: any): any; /** * Find and parse the compact font header at the beginning of the byte stream. * * @private * @returns {any} Object with parsed header instance and end position. */ private _parseHeader; /** * Parse a single operand value from the CFF operand encoding. * * @private * @param {any} dictionary Array of operand bytes to read from. * @returns {number} Parsed operand (integer or NaN for invalid types). */ _parseOperand(dictionary: any): number; /** * Parse a floating point operand encoded in CFF nibble-pairs. * * @private * @param {any} dictionary Byte array holding the float operand. * @returns {number} Parsed floating-point value. */ _parseFloatOperand(dictionary: any): number; /** * Parse a CFF dictionary (sequence of key/operands pairs) into entries. * * @private * @param {any} dictionary Raw dictionary bytes. * @returns {[number, number[]][]} Array of entries with opcode and operands. */ _parseDictionary(dictionary: any): [number, number[]][]; /** * Parse a CFF index structure at the given position. * * @private * @param {number} pos Offset where the index begins. * @returns {{ obj: _PdfCompactFontIndex; endPos: number }} Parsed index and end offset. */ _parseIndex(pos: number): { obj: _PdfCompactFontIndex; endPos: number; }; /** * Convert a name index into an array of string names. * * @private * @param {any} index Name index object. * @returns {string[]} Array of name strings. */ _parseNameIndex(index: { count: number; _get: (i: number) => Uint8Array; }): string[]; /** * Convert a string index into a `_PdfCompactFontStrings` helper. * * @private * @param {any} index String index object. * @returns {_PdfCompactFontStrings} Helper wrapping the parsed strings. */ _parseStringIndex(index: { count: number; _get: (i: number) => Uint8Array; }): _PdfCompactFontStrings; /** * Create a compact-font dictionary wrapper from parsed entries. * * @private * @param {any} type Constructor function for the dictionary wrapper. * @param {[number, number[]][]} dictionary Parsed entries to set. * @param {_PdfCompactFontStrings} strings String table used for SID lookups. * @returns {any} An instance of the requested dictionary wrapper type. */ _createDictionary(type: any, dictionary: [number, number[]][], strings: _PdfCompactFontStrings): any; /** * Parse a single charstring sequence validating stack behaviour and * optionally extracting metrics and standard character sequences. * * @private * @param {any} state Parser state object tracking stack and hints. * @param {number[]} data Array of charstring bytes to parse. * @param {any} localSubroutineIndex Local subr index. * @param {any} globalSubroutineIndex Global subr index. * @returns {any} True when successfully parsed otherwise false. */ _parseCharString(state: any, data: number[], localSubroutineIndex: { count: number; get: (index: number) => number[]; }, globalSubroutineIndex: { count: number; get: (index: number) => number[]; }): any; /** * Create and attach an empty private dictionary when none is present. * * @private * @param {any} parentDictionary Parent dictionary to modify. * @returns {void} nothing. */ _emptyPrivateDictionary(parentDictionary: any): void; } /** * In-memory representation of a parsed Compact Font (CFF) used by the parser * and subsequent consumers. Holds header, name/table indices, charstrings, * encodings and helper structures. * * @private */ export declare class _PdfCompactFormatFont { /** Parsed header object. @private */ header: any; /** Name strings parsed from the name index. @private */ names: any; /** Top-level dictionary describing the font. @private */ topDictionary: any; /** String table helper for resolving SIDs. @private */ strings: _PdfCompactFontStrings; /** Global subroutine index. @private */ globalSubroutineIndex: any; /** Parsed encoding descriptor. @private */ encoding: any; /** Parsed charset descriptor. @private */ charSet: any; /** Parsed charStrings table. @private */ charStrings: any; /** Font dictionary array for CID fonts. @private */ fontDictionaryArray: any; /** FDSelect structure when CID fonts are used. @private */ fontDictionarySelect: any; /** True when font uses CIDs rather than glyph names. @private */ isCharacterIdentifierFont: boolean; /** Standard encoding characters discovered while parsing. @private */ standardEncodingChars: any; /** Glyph widths parsed from private dictionaries. @private */ widths: any; constructor(); /** * Duplicate the first glyph to work around fonts that index glyphs starting * at 1 instead of 0. Ensures charStrings count stays within limits. * * @private * @returns {void} nothing. */ _duplicateFirstGlyph(): void; /** * Check whether a glyph id exists in the parsed charStrings table. * * @param {any} id - Glyph id to test. * @returns {boolean} True if glyph exists and contains data. * @private */ _hasGlyphId(id: any): boolean; } /** * Compact font header descriptor. * * @private */ export declare class _PdfCompactFontHeader { /** Major version number. @private */ major: any; /** Minor version number. @private */ minor: any; /** Size of the header block. @private */ headerSize: any; /** Offset size field. @private */ offSize: any; constructor(major: any, minor: any, headerSize: any, offSize: any); } /** * Helper storing standard and extra string table entries for CFF fonts. * Provides SID resolution and insertion utilities. * * @private */ export declare class _PdfCompactFontStrings { /** Custom strings appended after standard names. @private */ strings: any; /** Number of predefined standard strings. @private */ _numberOfStandardCompactFontStrings: number; /** Array containing the standard CFF strings. @private */ _compactFontStandardStrings: string[]; constructor(); /** * Retrieve a string by SID. * * @private * @param {number} index - SID index to resolve. * @returns {any} The resolved string. */ _get(index: number): any; /** * Return the SID for a given text, searching standard then custom strings. * * @private * @param {any} text - The string to find. * @returns {number} SID index or -1 when not found. */ _fetchStringIdentifier(text: any): number; /** * Append a new custom string to the string table. * * @private * @param {any} value - String value to add. * @returns {void} nothing. */ _add(value: any): void; readonly count: number; } /** * Represents the pdf compact font index. * * @private */ export declare class _PdfCompactFontIndex { objects: any; length: number; constructor(); /** * Append a new object to the index. * * @private * @param {any} data - Raw bytes for the object. * @returns {void} nothing. */ add(data: any): void; /** * Replace an existing index entry. * * @private * @param {number} index - Entry index to replace. * @param {any} data - New raw bytes for the entry. * @returns {void} nothing. */ set(index: number, data: any): void; /** * Retrieve an object by index. * * @private * @param {number} index - Object index to return. * @returns {any} The raw object bytes. */ _get(index: number): any; /** Number of objects in the index. * * @private * @returns {number} as number of objects in the index. */ readonly count: number; } /** * Represents mapping dictionaries for compact font entries. * * @private */ export declare class _PdfCompactFontDictionary { keyToNameMap: any; nameToKeyMap: any; defaults: any; types: any; opcodes: any; order: any; strings: any; values: any; constructor(tables: any, strings: any); /** * Set a dictionary entry by numeric key using parsed operand values. * * @private * @param {any} key - Numeric key opcode for the dictionary entry. * @param {any} value - Operand array to set for the key. * @returns {boolean} True when the value was accepted. */ _setByKey(key: any, value: any): boolean; /** * Set a dictionary value by its human-readable name. * * @private * @param {any} name - Dictionary entry name. * @param {any} value - Value to set for the named entry. * @returns {void} nothing. */ _setByName(name: any, value: any): void; /** * Test whether a named dictionary entry is present. * * @private * @param {any} name - Name to test for. * @returns {any} True when the name exists in the values. */ _hasName(name: any): any; /** * Get a dictionary value by name, returning defaults when missing. * * @private * @param {string} name - Name of the entry to retrieve. * @returns {any} The stored value or the configured default. */ _getByName(name: string): any; /** * Remove an entry by its name. * * @private * @param {any} name - Entry name to remove. * @returns {any} returns font after removing entry. */ _removeByName(name: any): any; /** * Build lookup tables from a layout description. * * @private * @param {any} layout - Array describing dictionary layout entries. * @returns {any} The constructed tables object. */ _createTables(layout: any): any; } /** * Represents the top-level compact font dictionary used internally. * * @private */ export declare class _PdfCompactFontTopDictionary extends _PdfCompactFontDictionary { privateDictionary: any; static readonly _tables: any; constructor(strings?: any); /** * It creates table for the font. * * @private * @returns {any} returns any values. */ static _createTables(): any; } export declare class _PdfCompactFontPrivateDictionary extends _PdfCompactFontDictionary { strings: any; subroutineIndex: any; tables: any; constructor(strings?: string); } export declare class _PdfCompactFontCharacterSet { predefined: any; format: any; charSet: any; raw: any; constructor(predefined: any, format: any, charSet: any, raw?: any); } export declare class _PdfCompactFontEncoding { predefined: any; format: any; charSet: any; raw: any; encoding: any; constructor(predefined: any, format: any, encoding: any, raw: any); } export declare class _PdfCompactFontSelect { format: any; fontDictionarySelect: any; constructor(format: any, fontDictionarySelect: any); /** * Return the FDArray index for a glyph. * * @private * @param {number} glyphIndex - Glyph id to query. * @returns {any} Font dictionary index or -1 when out of range. */ _getFontDictionaryIndex(glyphIndex: number): any; } /** * Compact font offset tracker for text. * * @private */ export declare class _PdfCompactFontOffsetTracker { offsets: any; constructor(); /** * Check whether a named entry is currently being tracked. * * @param {any} key - Name/key being tracked. * @returns {boolean} True when tracking exists. * @private */ _isTracking(key: any): boolean; /** * Begin tracking an entry location for later patching. * * @private * @param {any} key - Entry name to track. * @param {any} location - Location index to track. * @returns {void} nothing. */ _track(key: any, location: any): void; /** * Add a delta to all tracked offsets. * * @private * @param {any} value - Amount to add to each tracked offset. * @returns {void} nothing. */ _offset(value: any): void; /** * Write the actual offset entries into an output buffer for a tracked key. * * @private * @param {any} key - Tracked entry name. * @param {any} values - Array of numeric offsets to write. * @param {any} output - Output object containing `data` and `length`. * @returns {void} nothing. */ _setEntryLocation(key: any, values: any, output: any): void; } /** * Compiler for producing serialized CFF data from a parsed compact-font. * All methods are internal implementation details used when emitting a CFF. * * @private */ export declare class _PdfCompactFontCompiler { compactFont: any; constructor(compactFont: any); /** * Compile the in-memory compact font into a byte array. * * @private * @returns {any} Compiled byte array of the CFF font. */ compile(): any; /** * Multiply two 2x3 font matrices. * * @private * @param {any} m1 - Left matrix. * @param {any} m2 - Right matrix. * @returns {any} The transformed matrix. */ _transform(m1: any, m2: any): any; /** * Encode a numeric operand as CFF bytes. * * @private * @param {any} value - Numeric value to encode. * @returns {any} Encoded byte sequence for the operand. */ _encodeNumber(value: any): any; /** * Encode a floating-point number to CFF float nibble encoding. * * @private * @param {any} count - Floating point value to encode. * @returns {number} Byte array for the float operand. */ _encodeFloat(count: any): number[]; /** * Encode an integer using compact CFF integer encoding. * * @private * @param {number} value - Integer value. * @returns {number} Encoded byte array for the integer. */ _encodeInteger(value: number): number[]; /** * Compile the CFF header for the font. * * @private * @param {any} header - Parsed header object. * @returns {any} Header byte array. */ _compileHeader(header: any): any; /** * Compile the name index for the font. * * @private * @param {any} names - Array of font name strings. * @returns {any} Compiled name index bytes. */ _compileNameIndex(names: any): any; /** * Compile one or more top-level font dictionaries into an index. * * @private * @param {any} dictionary - Array of font dictionary wrappers. * @param {any} length - Current output length used for offset adjustments. * @param {any} removeCidKeys - Remove CID-specific keys when true. * @returns {any} Object with trackers and compiled output. */ _compileTopDictionary(dictionary: any, length: any, removeCidKeys: any): any; /** * Compile private dictionaries and patch their offsets into trackers. * * @private * @param {any} dictionary - Array of font dictionaries with `privateDictionary` fields. * @param {any} trackers - Array of offset trackers to update. * @param {any} output - Output buffer object used for writing compiled bytes. * @returns {void} nothing. */ _compilePrivateDictionary(dictionary: any, trackers: any, output: any): void; /** * Compile a single dictionary into operator/operand byte sequences. * * @private * @param {any} dictionary - Dictionary wrapper instance. * @param {any} offsetTracker - Offset tracker used for deferred offsets. * @returns {any} Array of bytes representing the compiled dictionary. */ _compileDictionary(dictionary: any, offsetTracker: any): any; /** * Compile a string index from an array of JavaScript strings. * * @private * @param {any} strings - Array of string values. * @returns {void} Compiled string index bytes. */ _compileStringIndex(strings: any): any; /** * Compile the charStrings index from parsed glyph byte arrays. * * @private * @param {any} charStrings - Container with glyph byte arrays. * @returns {any} Compiled charStrings index bytes. */ _compileCharStrings(charStrings: any): any; /** * Compile the charSet table for the font. * * @private * @param {any} charSet - CharSet descriptor. * @param {any} glyphCount - Number of glyphs to encode. * @param {any} strings - String table helper for SID resolution. * @param {any} isCharacterIdentifierFont - True for CID-keyed fonts. * @returns {any} Compiled charSet bytes. */ _compileCharSet(charSet: any, glyphCount: any, strings: any, isCharacterIdentifierFont: any): any; /** * Compile encoding data into bytes. * * @private * @param {any} encoding - Encoding descriptor. * @returns {void} Compiled encoding bytes. */ _compileEncoding(encoding: any): any; /** * Compile FDSelect structure used for CID fonts. * * @private * @param {any} fontDictionarySelect - FDSelect descriptor. * @returns {void} nothing. */ _compileFontDictionarySelect(fontDictionarySelect: any): any; /** * Convert a typed array to a normal array of bytes. * * @private * @param {any} data - Typed array to convert. * @returns {any} Array of bytes. */ _compileTypedArray(data: any): any; /** * Compile a generic CFF INDEX object. * * @private * @param {any} index - _PdfCompactFontIndex instance. * @param {any} trackers - Optional array of trackers to patch offsets. * @returns {any} Compiled index bytes. */ _compileIndex(index: any, trackers?: any): any; } /** * Wrapper around a parsed compact (CFF) font providing convenient access to * glyph counts, mappings and compiled font data. * * @private */ export declare class _PdfCompactFont { /** External runtime font properties. * * @private */ properties: _FontStructure; /** Parsed compact font structure. * * @private */ compactFont: any; /** Standard character mapping discovered during parsing. @private */ standardCharacter: any; /** Compiled font data or original input when compilation fails. @private */ data: any; /** Built-in encoding map (charCode -> glyphName) when available. * * @private */ _builtInEncoding: any; /** * Create a compact font wrapper by parsing/compiling the provided font. * * @param {any} file - Font source to parse. * @param {any} properties - External properties used during parsing (contains fontStructure). * * @private */ constructor(file: any, properties: any); /** * Number of glyphs contained in the compact font. * * @private * @returns {number} Glyph count. */ readonly _glyphCount: number; /** * Get the character set array used by the compact font. * * @private * @returns {any} Array of glyph names or CIDs depending on font type. */ _getCharSet(): any; /** * Build a mapping from character codes to glyph ids suitable for text extraction. * @returns {[key: number]: number} Object mapping character codes to glyph id numbers. * * @private */ _getGlyphMapping(): { [key: number]: number; }; /** * Check whether the compact font contains the given glyph id. * * @param {number} id - Glyph id to check. * @returns {boolean} True when the glyph exists. * * @private */ _hasGlyphId(id: number): boolean; /** * Build a charCode glyphId mapping for Type1-like fonts including * handling differences and base encodings. * * @private * @param {any} properties - Parsing properties containing font flags and differences. * @param {any} builtInEncoding - Built-in encoding map from the font or external source. * @param {any} glyphNames - Array of glyph names present in the charstrings table. * @returns {any} Mapping object charCode. */ _type1FontGlyphMapping(properties: any, builtInEncoding: any, glyphNames: any): any; /** * Build a built-in encoding map from parsed charSet/encoding information. * Populates `_builtInEncoding` when mapping entries are found. * * @private * @returns {void} nothing. */ _createBuiltInEncoding(): void; }