reagraph
Version:
WebGL Node-based Graph for React
38 lines (37 loc) • 912 B
TypeScript
export interface TextDimensions {
width: number;
height: number;
}
export interface TextMeasurementOptions {
text: string;
fontSize: number;
/**
* Font weight used when measuring the text.
*
* @default 400
*/
fontWeight?: number;
/**
* Font family used when measuring the text.
*
* @default 'sans-serif'
*/
fontFamily?: string;
}
/**
* Measure text dimensions using Canvas API.
* Results are cached for performance.
*
* @param options - Text measurement options
* @returns Text dimensions (width and height)
*/
export declare function measureText(options: TextMeasurementOptions): TextDimensions;
/**
* Clear the measurement cache.
* Useful for testing or memory management.
*/
export declare function clearMeasurementCache(): void;
/**
* Get the current cache size.
*/
export declare function getMeasurementCacheSize(): number;