//#region src/generated/fontmin_wasm_core.d.ts type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; //#endregion //#region src/runtime.d.ts declare function isWasmInitialized(): boolean; declare function initWasm(input?: InitInput): Promise; //#endregion //#region ../../packages/fontmin/src/runtime-neutral/diagnostics.d.ts /** * Normalizes Rust bridge diagnostics without depending on a concrete runtime. * Native and WASM adapters use this module to expose the same error contract. */ type FontminDiagnosticCode = 'fontmin::config' | 'fontmin::convert_failed' | 'fontmin::invalid_font' | 'fontmin::io' | 'fontmin::missing_glyph' | 'fontmin::napi_bridge_failed' | 'fontmin::plugin_failed' | 'fontmin::unsupported_format'; declare class FontminDiagnosticError extends Error { readonly name = "FontminDiagnosticError"; readonly code: FontminDiagnosticCode; constructor(code: FontminDiagnosticCode, message: string, options?: ErrorOptions); } //#endregion //#region types.d.ts type FontFormat = 'ttf' | 'otf' | 'woff' | 'woff2' | 'eot' | 'svg' | 'css' | 'unknown'; type OutputFormat = 'ttf' | 'woff' | 'woff2' | 'eot' | 'svg' | 'css'; type LayoutSubsetMode = 'drop' | 'conservative' | 'preserve'; type MissingGlyphPolicy = 'ignore' | 'warn' | 'error'; interface CoverageOptions { basicText?: boolean; text?: string; unicodeRanges?: string[]; unicodes?: number[]; } interface CoverageReport { coveragePercent: number; missing: number[]; requested: number[]; supported: number[]; } interface FontMetadata { ascender: number; descender: number; familyName?: string; fullName?: string; glyphCount: number; postScriptName?: string; subfamilyName?: string; tables: string[]; unitsPerEm: number; } interface FontInfo { format: FontFormat; metadata: FontMetadata; size: number; } interface FontCollectionFaceInfo extends FontInfo { capabilities: FontCapabilityReport; /** Zero-based face index used by extractCollectionFace. */ index: number; /** Absolute SFNT directory offset in the collection. */ offset: number; } type CapabilitySupport = 'subset' | 'passthrough' | 'unsupported'; type ColorFontTechnology = 'colr-cpal' | 'cbdt-cblc' | 'sbix' | 'svg'; interface ColorFontTechnologyCapability { detail: string; subsetSupport: CapabilitySupport; tables: string[]; technology: ColorFontTechnology; version?: number; } interface ColorFontCapabilityReport { isColorFont: boolean; subsetSupport?: CapabilitySupport; technologies: ColorFontTechnologyCapability[]; } interface FontCapabilityReport { color: ColorFontCapabilityReport; format: FontFormat; } interface FontCollectionInfo { faces: FontCollectionFaceInfo[]; majorVersion: number; minorVersion: number; size: number; } interface SubsetOptions extends CoverageOptions { /** Original glyph IDs to retain in addition to Unicode selection. */ gids?: number[]; /** PostScript glyph names to retain in addition to other selectors. */ glyphNames?: string[]; /** Retain the original glyph-zero outline; false emits the required empty glyph-zero slot. */ keepNotdef?: boolean; /** Preserve original glyph IDs and leave null entries for empty mapping slots. */ retainGids?: boolean; /** Retain PostScript glyph names in a rewritten version 2 `post` table. */ retainGlyphNames?: boolean; /** Retain non-Unicode, non-symbol cmap records after remapping. */ retainLegacyCmap?: boolean; /** Retain the Windows symbol cmap record after remapping. */ retainSymbolCmap?: boolean; /** Drop layout, remap supported data, or reject known contextual loss. */ layout?: LayoutSubsetMode; /** Four-byte OpenType feature tags to retain, or all features when omitted. */ layoutFeatures?: string[]; /** Four-byte OpenType script tags to retain, or all scripts when omitted. */ layoutScripts?: string[]; /** OpenType language tags to retain; `default` selects DefaultLangSys. */ layoutLanguages?: string[]; /** OpenType name IDs to retain, or all name IDs when omitted. */ nameIds?: number[]; /** Platform-specific name language IDs to retain, or all languages when omitted. */ nameLanguages?: number[]; /** Optional OpenType tables to remove after subsetting. */ dropTables?: string[]; /** Optional source tables to copy verbatim into the subset. */ passThroughTables?: string[]; missingGlyphs?: MissingGlyphPolicy; /** Retain the cvt, fpgm, and prep TrueType program tables while trimming. */ preserveHinting?: boolean; /** Skip subsetting and return the validated source bytes unchanged when false. */ trim?: boolean; } interface GidMapping { newGid: number; oldGid: number; } interface UnicodeGidMapping { oldGid: number; unicode: number; } interface GlyphNameGidMapping { glyphName: string; oldGid: number; } interface SubsetReport { cffCharstringsVerbatim: boolean; droppedContextSubtables: number; glyphsRetained: number; glyphNameToOldGid: GlyphNameGidMapping[]; missingGids: number[]; missingGlyphNames: string[]; newToOld: (number | null)[]; oldToNew: GidMapping[]; originalSize: number; requestedGids: number[]; requestedGlyphNames: string[]; subsetSize: number; supportedGids: number[]; supportedGlyphNames: string[]; tablesRetained: string[]; unicodeToOldGid: UnicodeGidMapping[]; } interface SubsetResult { data: Uint8Array; report: SubsetReport; } /** Resolved selectors bound to one source font by SHA-256. */ interface SubsetPlan { coverage: CoverageReport; glyphNameToOldGid: GlyphNameGidMapping[]; missingGids: number[]; missingGlyphNames: string[]; options: SubsetOptions; /** SHA-256 integrity digest of the canonical plan payload. */ planSha256: string; requestedGids: number[]; requestedGlyphNames: string[]; schemaVersion: number; /** Original glyph IDs used to seed glyph and layout closure. */ seedGids: number[]; sourceGlyphs: number; sourceSha256: string; sourceSize: number; supportedGids: number[]; supportedGlyphNames: string[]; unicodeToOldGid: UnicodeGidMapping[]; } interface WoffOptions { compressionLevel?: number; deflate?: boolean; metadata?: string; privateData?: Uint8Array; } interface Ttf2Woff2Options { quality?: number; } interface Ttf2EotOptions { version?: number; } interface Ttf2SvgOptions { fontFamily?: string; } interface Otf2TtfOptions { /** Compatibility option: Type 2 hinting cannot be translated to TrueType and is discarded. */ preserveHinting?: boolean; variationCoordinates?: Record; } interface InstanceOptions { /** Axis values in fvar user units. Unspecified axes use their defaults. */ variationCoordinates?: Record; } interface AxisRange { /** Inclusive lower bound in fvar user units. */ min: number; /** Inclusive upper bound in fvar user units. */ max: number; /** New default, or the original default clamped into the range when omitted. */ default?: number; } type AxisSetting = number | AxisRange; interface VariationSpaceOptions { /** Axis tags mapped to a pin or retained range. Unlisted axes stay variable. */ axes: Record; /** Convert fully pinned CFF2 outlines to CFF1 for older renderers. */ downgradeCff2?: boolean; } interface Svg2TtfOptions { /** Compatibility option accepted without generating TrueType hint instructions. */ hinting?: boolean; normalize?: boolean; } interface SvgIcon { contents: string; name: string; unicode?: number; } interface Svgs2TtfOptions { ascent?: number; descent?: number; fontName?: string; normalize?: boolean; startUnicode?: number; } interface CssGlyph { name?: string; unicode: number; } interface CssFontSource { contents?: Uint8Array; fileName: string; format: Exclude; glyphs?: CssGlyph[]; unicodeRanges?: string[]; } interface CssOptions { asFileName?: boolean; base64?: boolean; fontDisplay?: 'auto' | 'block' | 'swap' | 'fallback' | 'optional'; fontFamily?: string; fontPath?: string; glyph?: boolean; iconPrefix?: string; local?: boolean; target?: 'css' | 'scss' | 'less'; unicodeRanges?: string[]; } //#endregion //#region src/native.d.ts declare function subsetTtf(input: Uint8Array, options?: SubsetOptions): Promise; declare function subsetTtfWithReport(input: Uint8Array, options?: SubsetOptions): Promise; declare function createTtfSubsetPlan(input: Uint8Array, options?: SubsetOptions): Promise; declare function subsetTtfWithPlan(input: Uint8Array, plan: SubsetPlan): Promise; declare function analyzeCoverage(input: Uint8Array, options?: CoverageOptions): Promise; declare function instantiateFont(input: Uint8Array, options?: InstanceOptions): Promise; declare function reduceVariationSpace(input: Uint8Array, options: VariationSpaceOptions): Promise; declare function ttfToWoff(input: Uint8Array, options?: WoffOptions): Promise; declare function woffToTtf(input: Uint8Array): Promise; declare function ttfToWoff2(input: Uint8Array, options?: Ttf2Woff2Options): Promise; declare function woff2ToTtf(input: Uint8Array): Promise; declare function validateWoff2(input: Uint8Array): Promise; declare function ttfToEot(input: Uint8Array, options?: Ttf2EotOptions): Promise; declare function eotToTtf(input: Uint8Array): Promise; declare function ttfToSvg(input: Uint8Array, options?: Ttf2SvgOptions): Promise; declare function svgFontToTtf(input: string, options?: Svg2TtfOptions): Promise; declare function svgsToTtf(inputs: SvgIcon[], options?: Svgs2TtfOptions): Promise; declare function otfToTtf(input: Uint8Array, options?: Otf2TtfOptions): Promise; declare function inspect(input: Uint8Array): Promise; declare function inspectCapabilities(input: Uint8Array): Promise; declare function inspectCollection(input: Uint8Array): Promise; declare function extractCollectionFace(input: Uint8Array, faceIndex: number): Promise; declare function generateFontFaceCss(sources: CssFontSource[], options?: CssOptions): Promise; //#endregion //#region ../../packages/fontmin/src/runtime-neutral/auto-delivery.d.ts type DeliveryLanguagePreset = 'ar' | 'el' | 'en' | 'hi' | 'ja' | 'ko' | 'ru' | 'zh-Hans' | 'zh-Hant'; interface AutoDeliveryPlanOptions { frequencyText?: string; languages?: DeliveryLanguagePreset[]; maxSlices?: number; targetBytes?: number; tolerance?: number; } interface AutoDeliveryPlanSlice { codePoints: number[]; estimatedBytes: number; name: string; unicodeRanges: string[]; } interface AutoDeliveryPlan { codePointCount: number; languages: DeliveryLanguagePreset[]; slices: AutoDeliveryPlanSlice[]; targetBytes: number; tolerance: number; } /** * Detect supported delivery-language presets from representative page text. * * @param text - Static or frequency-weighted business text. * @returns Presets in first-observed order, with Han assigned to a detected * Japanese, Korean, or Traditional Chinese context before Simplified Chinese. */ declare function detectDeliveryLanguages(text: string): DeliveryLanguagePreset[]; /** * Compact code points into canonical CSS Unicode ranges. * * @param codePoints - Unicode scalar values in any order. * @returns Sorted `U+XXXX[-YYYY]` ranges. */ declare function unicodeRangesFromCodePoints(codePoints: readonly number[]): string[]; //#endregion //#region src/plugins.d.ts type MaybePromise = T | Promise; interface DeliverySlice { name: string; unicodeRanges: string[]; } interface DeliverySlicesOptions { slices: DeliverySlice[]; } interface AutoDeliveryPluginOptions extends AutoDeliveryPlanOptions { measureFormat?: 'ttf' | 'woff' | 'woff2'; subset?: SubsetOptions; woff2Quality?: number; woffCompressionLevel?: number; } interface GlyphOptions extends SubsetOptions { clone?: boolean; } interface Ttf2WoffPluginOptions extends WoffOptions { clone?: boolean; } interface Ttf2Woff2PluginOptions extends Ttf2Woff2Options { clone?: boolean; } interface Ttf2EotPluginOptions extends Ttf2EotOptions { clone?: boolean; } interface Ttf2SvgPluginOptions extends Ttf2SvgOptions { clone?: boolean; } interface Otf2TtfPluginOptions extends Otf2TtfOptions { clone?: boolean; } interface VariationSpacePluginOptions extends VariationSpaceOptions { clone?: boolean; } interface Svg2TtfPluginOptions extends Svg2TtfOptions { clone?: boolean; } interface Svgs2TtfPluginOptions extends Svgs2TtfOptions { clone?: boolean; } interface ModernWebOptions extends GlyphOptions, Otf2TtfPluginOptions, Ttf2WoffPluginOptions, Ttf2Woff2PluginOptions { fontDisplay?: CssOptions['fontDisplay']; fontFamily?: string; fontPath?: string; local?: boolean; variationAxes?: VariationSpaceOptions['axes']; downgradeCff2?: boolean; } interface FontminCompatPresetOptions extends GlyphOptions, Otf2TtfPluginOptions, Ttf2EotPluginOptions, Ttf2SvgPluginOptions, Ttf2WoffPluginOptions, Ttf2Woff2PluginOptions { fontDisplay?: CssOptions['fontDisplay']; fontPath?: string; local?: boolean; } interface BrowserPluginContext { diagnostics: { level: 'warn'; message: string; }[]; emitFile(asset: BrowserAsset): void; warn(message: string | Error): void; } interface BrowserPlugin { name: string; options?: Options; transform?(asset: BrowserAsset, context: BrowserPluginContext): MaybePromise; } declare function glyph(options?: GlyphOptions): BrowserPlugin; declare function deliverySlices(slices: DeliverySlice[]): BrowserPlugin; declare function autoDeliverySlices(options?: AutoDeliveryPluginOptions): BrowserPlugin; declare function ttf2woff(options?: Ttf2WoffPluginOptions): BrowserPlugin; declare function ttf2woff2(options?: Ttf2Woff2PluginOptions): BrowserPlugin; declare function ttf2eot(options?: Ttf2EotPluginOptions): BrowserPlugin; declare function ttf2svg(options?: Ttf2SvgPluginOptions): BrowserPlugin; declare function otf2ttf(options?: Otf2TtfPluginOptions): BrowserPlugin; declare function variationSpace(options: VariationSpacePluginOptions): BrowserPlugin; declare function svg2ttf(options?: Svg2TtfPluginOptions): BrowserPlugin; declare function svgs2ttf(options?: Svgs2TtfPluginOptions): BrowserPlugin; declare function css(options?: CssOptions): BrowserPlugin; declare function modernWeb(options?: ModernWebOptions): BrowserPlugin[]; declare function fontminCompatPreset(options?: FontminCompatPresetOptions): BrowserPlugin[]; //#endregion //#region src/optimize.d.ts interface BrowserAsset { contents: Uint8Array; fileName: string; format?: string; unicodeRanges?: string[]; } interface BrowserOptimizeConfig { assets: BrowserAsset[]; plugins?: BrowserPlugin[]; } declare function optimizeBrowser(config: BrowserOptimizeConfig): Promise; //#endregion export { type AutoDeliveryPlan, type AutoDeliveryPlanOptions, type AutoDeliveryPlanSlice, type AutoDeliveryPluginOptions, type AxisRange, type AxisSetting, type BrowserAsset, type BrowserOptimizeConfig, type BrowserPlugin, type BrowserPluginContext, type CapabilitySupport, type ColorFontCapabilityReport, type ColorFontTechnology, type ColorFontTechnologyCapability, type CoverageOptions, type CoverageReport, type CssFontSource, type CssGlyph, type CssOptions, type DeliveryLanguagePreset, type DeliverySlice, type DeliverySlicesOptions, type FontCapabilityReport, type FontCollectionFaceInfo, type FontCollectionInfo, type FontFormat, type FontInfo, type FontMetadata, type FontminCompatPresetOptions, type FontminDiagnosticCode, FontminDiagnosticError, type GidMapping, type GlyphNameGidMapping, type GlyphOptions, type InstanceOptions, type LayoutSubsetMode, type MaybePromise, type MissingGlyphPolicy, type ModernWebOptions, type Otf2TtfOptions, type Otf2TtfPluginOptions, type OutputFormat, type SubsetOptions, type SubsetPlan, type SubsetReport, type SubsetResult, type Svg2TtfOptions, type Svg2TtfPluginOptions, type SvgIcon, type Svgs2TtfOptions, type Svgs2TtfPluginOptions, type Ttf2EotOptions, type Ttf2EotPluginOptions, type Ttf2SvgOptions, type Ttf2SvgPluginOptions, type Ttf2Woff2Options, type Ttf2Woff2PluginOptions, type Ttf2WoffPluginOptions, type UnicodeGidMapping, type VariationSpaceOptions, type VariationSpacePluginOptions, type WoffOptions, analyzeCoverage, autoDeliverySlices, createTtfSubsetPlan, css, deliverySlices, detectDeliveryLanguages, eotToTtf, extractCollectionFace, fontminCompatPreset, generateFontFaceCss, glyph, initWasm, inspect, inspectCapabilities, inspectCollection, instantiateFont, isWasmInitialized, modernWeb, optimizeBrowser, otf2ttf, otfToTtf, reduceVariationSpace, subsetTtf, subsetTtfWithPlan, subsetTtfWithReport, svg2ttf, svgFontToTtf, svgs2ttf, svgsToTtf, ttf2eot, ttf2svg, ttf2woff, ttf2woff2, ttfToEot, ttfToSvg, ttfToWoff, ttfToWoff2, unicodeRangesFromCodePoints, validateWoff2, variationSpace, woff2ToTtf, woffToTtf };