import type { FontFamilyConfig, FontConfig, DiagramConfig } from "@hylimo/diagram-common"; import type { FontFamily, SubsettedFont } from "./fontFamily.js"; import type { SubsetConfig } from "./subsetCollector.js"; import type { LayoutCache } from "../engine/layoutCache.js"; /** * Handles retrieving fonts from an url */ export declare class FontManager { private readonly subsetFontCache; /** * Id counter for fetched buffers */ private fetchIdCounter; /** * Cache used to store download results based on the url */ private readonly fetchCache; /** * Cache for font families */ private readonly fontFamilyCache; /** * Handles font subsetting */ private readonly subsetManager; /** * Creates a new font manager * * @param subsetFontCache cache for subsetted fonts */ constructor(subsetFontCache: LayoutCache>); /** * Gets a font family, caches results if possible * * @param config the config of the font family * @param subsetConfig defines which subset to use * @param fontLoadingConfig the font config, used to determine if font subsetting is enabled and if external fonts are enabled * @returns the created font family, and a boolean indicating if the font family was cached */ getFontFamily(config: FontFamilyConfig, subsetConfig: SubsetConfig, fontLoadingConfig: FontLoadingConfig): Promise<{ fontFamily: FontFamily; cacheHit: boolean; }>; /** * Gets a font, uses the caches to provent unnecessary fetches * * @param config config necessary for collection font types and variation font types * @param subset the subset to use * @param fontLoadingConfig the font config, used to determine if font subsetting is enabled and if external fonts are enabled * @returns the font */ private getFont; /** * Fetches a font from the cache or the url * * @param fontLoadingConfig the font config, used to determine if font subsetting is enabled and if external fonts are enabled * @param config the config of the font * @returns the fetched font buffer and its id */ private fetchFont; } /** * Configuration for font loading * Defines if font subsetting is enabled and if external fonts are enabled */ type FontLoadingConfig = Pick; /** * Key used to store subsetted fonts in the cache */ export interface SubsetFontKey extends Omit { /** * The id of the fetched buffer */ id: number; /** * The subset to use */ subset: string | undefined; } export {}; //# sourceMappingURL=fontManager.d.ts.map