kinetic-slider
Version:
A WebGL-powered kinetic slider component using PIXI.js
53 lines (52 loc) • 1.88 kB
TypeScript
/**
* Extract font names from a CSS font-family string
*
* @param fontStack - CSS font-family value
* @returns Array of individual font names
*/
export declare function parseFontStack(fontStack: string): string[];
/**
* Identify which fonts in a font stack are likely custom fonts
*
* @param parsedFonts - Array of font names
* @returns Array of potential custom fonts
*/
export declare function identifyCustomFonts(parsedFonts: string[]): string[];
/**
* Check if a font file exists in the fonts directory
* This is a simplified implementation for client-side
*
* @param fontName - Name of the font to check
* @param extensions - File extensions to try
* @returns Path to the font file if found, null otherwise
*/
export declare function findFontFile(fontName: string, extensions?: string[]): Promise<string | null>;
/**
* Load custom fonts for use with Pixi.js
*
* @param fontStack - CSS font-family value
* @returns Promise resolving to an array of successfully loaded font paths
*/
export declare function loadCustomFonts(fontStack: string): Promise<string[]>;
/**
* Create @font-face CSS rules for custom fonts
* This is needed for proper text rendering in Pixi.js
*
* @param fontPaths - Array of paths to font files
* @returns CSS string with @font-face rules
*/
export declare function createFontFaceCSS(fontPaths: string[]): string;
/**
* Add @font-face rules to the document head
*
* @param css - CSS string with @font-face rules
*/
export declare function injectFontFaceCSS(css: string): void;
/**
* Main function to handle custom font loading for KineticSlider
*
* @param titleFontStack - Title font-family value
* @param subtitleFontStack - Subtitle font-family value
* @returns Promise resolving when fonts are loaded
*/
export declare function setupCustomFonts(titleFontStack?: string, subtitleFontStack?: string): Promise<void>;