import type { VDTDocument } from '../vdt.js'; import { type FontFaceRequest } from '../measure/fontString.js'; import { GLYPH_PROBE_FAMILY, type FontFaceLike, type FontFaceSetLike } from './faces.js'; import { type CodePointRanges } from './cmap.js'; /** Characters of one face that another face drew. */ export interface GlyphFallback extends FontFaceRequest { /** The characters, each once, in the order the text first sets them; * at most {@link GLYPH_FALLBACK_LISTED} of them. */ characters: string[]; /** How many characters in all. */ count: number; /** The family of the font list that has every one of them (the next * family after the face, or a generic family such as `serif`), or * undefined when none has them all: a face the system picks draws them. */ supplier?: string; } /** How many characters a warning lists. */ export declare const GLYPH_FALLBACK_LISTED = 24; /** The family of the glyph probe face. */ export { GLYPH_PROBE_FAMILY }; type FontFaceConstructor = new (family: string, source: ArrayBuffer | ArrayBufferView, descriptors?: FontFaceDescriptors) => FontFaceLike; /** * Declare the glyph probe in `fontSet` (by default the one the engine * measures with: `document.fonts`, a worker's `self.fonts`), once. Resolves * true when it is there. Where there is no `FontFace` (Node) it does * nothing and resolves false. */ export declare function installGlyphProbe(fontSet?: FontFaceSetLike | null, FontFaceCtor?: FontFaceConstructor): Promise; /** * Register what a file of a face covers: its bytes (TrueType or OpenType, * whose `cmap` is read) or the code points as intervals, and, for a slice * of a family, its `unicode-range`. A face's files add up. Returns false * when the bytes could not be read (a WOFF or WOFF2 file: pass the * decompressed bytes). */ export declare function registerFontCoverage(family: string, weight: number | string, style: 'normal' | 'italic' | string, file: Uint8Array | ArrayBuffer | CodePointRanges, unicodeRange?: string): boolean; /** Forget the coverage registered for `families` (all of it without). */ export declare function forgetFontCoverage(families?: Iterable): void; /** The characters a laid-out document sets in each font shorthand: its * lines (paragraphs, headings, list items, captions, notes, table cells, * figure labels) and the texts the pages set beside them. */ export declare function documentFontTexts(doc: VDTDocument): Map>; type HasGlyph = (family: string, weight: number, style: 'normal' | 'italic', ch: string) => boolean | undefined; type SupplierOf = (face: FontFaceRequest, ch: string) => string | undefined; export interface GlyphFallbackOptions { /** Whether a family (a generic one too) draws a character itself: * true, false, or undefined when it is not known. Default: the glyph * probe where it is declared, else the registered coverage. */ hasGlyph?: HasGlyph; /** The family that drew a character `face` lacks, when the font list * names none that has it. Default, with the probe: the generic family * (`serif`, `sans-serif`, `monospace`) that has the character and * draws it at the width the face's text got. */ supplierOf?: SupplierOf; /** Faces left out (a face the font set could not give at all is * reported as a `fontFallback`, not character by character). */ skip?: ReadonlySet; } /** * The faces of `docs` some of whose characters another face drew (see the * module comment), one entry per face whatever document or font list set * them. Generic families and the faces in `options.skip` are not checked. */ export declare function glyphFallbacks(docs: VDTDocument | readonly VDTDocument[], options?: GlyphFallbackOptions): GlyphFallback[]; //# sourceMappingURL=glyphFallback.d.ts.map