import type { LocaleTag } from '../types.js'; import { type HyphenationRules } from '../hyphenate.js'; import type { MeasurementCache } from './types.js'; /** * Build a CSS font shorthand string for canvas / pretext. * Example: "75px EB Garamond" */ export declare function buildFontString(fontFamily: string, fontSizePx: number, weight?: string, style?: string): string; /** Whether a `fontFamily` value is a CSS font stack (`'EB Garamond', * Georgia, serif`) rather than one family: it has a comma outside quotes. */ export declare function isFontStack(fontFamily: string): boolean; /** * The one family a `fontFamily` value sets text in. A `fontFamily` names a * single family: canvas, HTML and PDF must measure and paint the same face, * and the PDF embeds a font per family, with no fallback chain. A CSS font * stack is therefore cut to its first family (`'EB Garamond', serif` → * `EB Garamond`) instead of being read as one family whose name has a * comma in it — which matched no face and measured with a fallback font. * Any other value comes back unchanged (a comma inside quotes is part of * the name). */ export declare function primaryFontFamily(fontFamily: string): string; /** * A family name the CSS font shorthand would not take bare — a word that * starts with a digit ("Optima 105", "DIN Pro 120"), a character outside * letters, digits, spaces, hyphens and underscores — goes in double quotes; * canvas silently ignores the whole shorthand otherwise. Plain names stay * bare (the existing font-string cache keys), and a name already quoted is * left alone. A font stack sets in its first family (see * {@link primaryFontFamily}). */ export declare function quoteFamily(fontFamily: string): string; /** * Initializes the hyphenator for a given locale (any BCP 47 tag; see * `matchHyphenationLocale`). Must be called before measureBlock is used with * hyphenation. */ export declare function initHyphenator(locale: LocaleTag, rules?: HyphenationRules): void; /** * Clear pretext's internal measurement caches and the engine's own * text-width cache. Call this after fonts finish loading (or are removed) * to ensure accurate measurements. */ export declare function clearMeasurementCache(): void; /** * Drop what was measured in `families` (#629): the engine's widths of * those families and, at the next lookup, the blocks of every * `MeasurementCache` that set text in them. Pretext's own cache holds no * family index and is cleared whole. Called when faces of these families * arrive or leave; {@link clearMeasurementCache} drops every family. */ export declare function evictFontFamilies(families: Iterable): void; export declare function createMeasurementCache(): MeasurementCache; //# sourceMappingURL=font.d.ts.map