/** size, really */ export interface Metrics { width: number; height: number; } export declare class Measurement { /** canvas used for color measurement */ private static color_measurement_canvas; /** * node used for text metrics. this has to be added to * the DOM, so it's fixed and shifted off screen. */ private static text_measurement_node; /** cache for color lookups */ private static color_cache; static MeasureColorARGB(color: string): string; /** * measure a color. turns symbolic or rgb colors into rgb values. * * UPDATE: prefill with #fff. that prevents it from randomly returning * the last value, if the color doesn't work for some reason. */ static MeasureColor(color: string): Uint8ClampedArray; static EnsureMeasurementNode(): void; /** * check if font is loaded, based on the theory that the alternatives * will be different sizes. note that this probably doesn't test weights * or italics properly, as those can be emulated without the specific face. * * I guess the thing to do in that case would be to load the alternate faces * first, and assume they are loaded serially (they're not). * * @param font_face * @param italic * @param bold */ static FontLoaded(font_face: string, italic?: boolean, weight?: number): boolean; /** * measure width, height of text, accounting for rotation */ static MeasureText(font: string, text: string, angle?: number): Metrics; }