import type { PdfAssetPolicy } from "./phase9-types.js"; import { PDFRef, type PDFValue } from "./pdf-objects.js"; import type { HbGlyph } from "./vendor-types.js"; interface FontkitGlyph { advanceWidth: number; id?: number; } interface FontkitBBox { maxX: number; maxY: number; minX: number; minY: number; } interface FontkitOs2 { usWeightClass?: number; } interface FontkitFont { "OS/2"?: FontkitOs2; ascent: number; bbox?: FontkitBBox; capHeight?: number; descent: number; directory?: { tables?: Record; }; glyphForCodePoint?(codePoint: number): FontkitGlyph | null; getGlyph(glyphId: number): FontkitGlyph; isMonospace?: boolean; italicAngle?: number; postscriptName?: string; type: string; unitsPerEm: number; } export interface PdfEmbeddedFontInput { family: string; postscriptName?: string; source: Buffer | Uint8Array | string; } export type PdfBuiltInFont = "Helvetica" | "Helvetica-Bold"; export type PdfFontInput = PdfBuiltInFont | PdfEmbeddedFontInput; export interface PreparedEmbeddedFont { alias: string; family: string; font: FontkitFont; glyphCidByKey: Map; cidToGid: Map; fontKey: string; glyphToUnicode: Map; glyphWidths: Map; nextCid: number; postscriptName: string; sourceHash: string; sourceKey: string; subsetBuffer: Buffer; subsetName: string; unitsPerEm: number; /** * Per-document HarfBuzz shape-result cache. Keyed on * `${text}\0${direction}` — fontSize is irrelevant to HB (positioning * is computed in `shapeEmbeddedText` from the cached HB output, not * re-shaped). Reused across measurement-and-positioning calls within * the same render, which can call `shapeEmbeddedText` for identical * runs multiple times in a row (M7). */ hbShapeCache: Map; } export declare function preparedFontSupportsText(prepared: PreparedEmbeddedFont, text: string): boolean; export interface ShapedGlyphRun { content: string; direction: "ltr" | "rtl"; glyphs: Array<{ advanceWidth: number; dx: number; dy: number; gid: number; hex: string; }>; totalAdvancePoints: number; usesPerGlyphPositioning: boolean; } export interface PrepareEmbeddedFontOptions { assetPolicy?: PdfAssetPolicy; subset?: boolean; } export declare function buildFontInputKey(font: PdfEmbeddedFontInput): string; export declare function prepareEmbeddedFonts(fonts: Array<{ alias: string; font: PdfEmbeddedFontInput; samples: string[]; }>, options?: PrepareEmbeddedFontOptions): Promise>; export declare function shapeEmbeddedText(prepared: PreparedEmbeddedFont, text: string, fontSize: number, x: number, y: number, direction?: "auto" | "ltr" | "rtl", wordSpacing?: number): Promise; export declare function buildEmbeddedFontObjects(prepared: PreparedEmbeddedFont, refs: { cidSet: PDFRef; cidToGidMap: PDFRef; cidFont: PDFRef; descriptor: PDFRef; fontFile: PDFRef; toUnicode: PDFRef; type0: PDFRef; }): Array<{ ref: PDFRef; value: PDFValue; }>; export declare function formatPdfNumber(value: number): string; export {}; //# sourceMappingURL=font-embedding.d.ts.map