import { OpcPackage } from '../core/opc/index.js'; import { FontRegistry } from '../core/font/index.js'; type EmbedVariant = 'regular' | 'bold' | 'italic' | 'boldItalic'; interface EmbedRef { readonly rId: string; readonly fontKey: string; } interface FontTableEntry { readonly name: string; readonly embeds: Partial>; } /** * §17.8.1 — restore an obfuscated embedded font by XOR-ing its first 32 bytes * with the `fontKey` GUID bytes in reverse order, recovering a normal sfnt. * * @param data The obfuscated `.odttf` bytes. * @param fontKey The 16-byte `w:fontKey` GUID (with or without braces/dashes). * @returns The de-obfuscated bytes, or `data` unchanged when `fontKey` is not a GUID. */ export declare function deobfuscateEmbeddedFont(data: Uint8Array, fontKey: string): Uint8Array; /** * Parse `word/fontTable.xml` for its embedded-font references (§17.8). Returns * one `FontTableEntry` per `w:font` that carries at least one `w:embed*` child, * each naming the relationship id + `w:fontKey` for a Regular/Bold/Italic/ * BoldItalic face. A regex pass, not a full XML parse — only the embed refs matter. */ export declare function parseFontTable(data: Uint8Array): Array; /** * De-obfuscate and load every embedded font in the package, building one * {@link FontRegistry} per font keyed by its normalized (trimmed, lower-cased) * name so a run's `w:ascii` can match it. Each candidate face is validated * against the sfnt signature; a font lacking a usable Regular face, or whose * faces fail to parse, is skipped (the family then falls back to substitution). * * @param pkg The opened OPC package for the `.docx`. * @returns A map from normalized font name to its registry (empty when nothing embeds). */ export declare function loadEmbeddedFonts(pkg: OpcPackage): Map; export {};