/** * WinAnsiEncoding mapping for PDF Type 1 built-in fonts. * * WinAnsiEncoding is the standard encoding for non-embedded PDF fonts. It * differs from Latin-1 (ISO 8859-1) in the 0x80-0x9F range, where Latin-1 * has control characters but WinAnsiEncoding maps typographic glyphs. * * Reference: PDF specification, Annex D, Table D.1. */ /** * Convert a Unicode code point to its WinAnsiEncoding byte value. * Returns undefined if the character cannot be encoded. */ export declare function unicodeToWinAnsi(codePoint: number): number | undefined; export interface WinAnsiUnmappable { /** The original character that could not be encoded. */ char: string; /** Unicode code point of the offending character. */ codePoint: number; /** Zero-based offset of the character within the input string. */ index: number; /** ASCII substitution that would render correctly with the standard-14 fonts. */ suggestion: string; } /** * Encode a Unicode string as WinAnsiEncoding bytes for use with PDF built-in fonts. * Characters that cannot be mapped are replaced with '?' (0x3F). * * When `onUnmappable` is supplied, every unmappable character is reported with * its index, code point, and an ASCII suggestion. This lets callers surface * actionable warnings (e.g. via `PdfInputWarning`) instead of silently emitting * `?` glyphs — the failure mode flagged in * `docs/0428-claude-test-based-directive2.md` §"@paperjsx/json-to-pdf" item 4. */ export declare function encodeWinAnsi(text: string, onUnmappable?: (warning: WinAnsiUnmappable) => void): Buffer; /** * Escape a WinAnsiEncoding byte buffer for use in a PDF literal string: ( ... ) * Escapes backslash, parens, CR, LF. Uses octal escapes for bytes >= 0x80 * to prevent UTF-8 encoding corruption in the output. */ export declare function escapeWinAnsiBytes(bytes: Buffer): string;