@manifold-studio/typeface
Version:
Font loading and text-to-3D conversion for Manifold Studio
73 lines • 1.94 kB
TypeScript
/**
* Font Registry - Central font storage and management
*
* This module provides centralized font storage with lazy loading support.
* It maintains a registry of available fonts and handles loading them on demand.
*/
import type { LoadedFont, FontInfo } from './font-resolver.js';
/**
* Default fonts available in the registry (TTF format only for Node.js compatibility)
*/
export declare const DEFAULT_FONTS: FontInfo[];
/**
* Font Registry manages font loading and storage
*/
export declare class FontRegistry {
private fontResolver;
private customFonts;
private loadedFonts;
private initializationPromise;
constructor();
/**
* Register a custom font
*/
registerFont(name: string, url: string, options?: {
family?: string;
weight?: string;
style?: string;
fallbackUrls?: string[];
}): void;
/**
* Initialize fonts by loading all default and registered custom fonts
*/
initialize(): Promise<void>;
/**
* Ensure fonts are ready (same as initialize - idempotent)
*/
ensureReady(): Promise<void>;
/**
* Check if fonts have been initialized
*/
isReady(): boolean;
/**
* Get list of available font names
*/
list(): string[];
/**
* Get a loaded font by name
*/
getFont(name: string): LoadedFont | null;
/**
* Check if a specific font is loaded
*/
isFontLoaded(name: string): boolean;
/**
* Load all fonts (default + custom)
*/
private loadAllFonts;
/**
* Clear all loaded fonts and reset initialization
*/
reset(): void;
/**
* Get registry status for debugging
*/
getStatus(): {
isReady: boolean;
loadedFonts: string[];
availableFonts: string[];
customFonts: string[];
};
}
export declare const fontRegistry: FontRegistry;
//# sourceMappingURL=font-registry.d.ts.map