@ogs-gmbh/ngx-utils
Version:
A lightweight collection of utility functions and helpers for Angular applications
20 lines • 866 B
TypeScript
import * as i0 from "@angular/core";
export declare class CanvasMeasurerService {
private _canvas;
private get canvas();
private _canvasContext;
private _stringWidthCache;
/**
* Measures text width for a given element style and string,
* caching results per font configuration.
*
* @param style - Computed CSS style of the element (font info).
* @param text - The string to measure.
* @returns The width in pixels, or undefined if measurement failed.
*/
getRenderedStringWidth(elementStyle: CSSStyleDeclaration | undefined, stringToMeasure: string): number | undefined;
private setCanvasFont;
static ɵfac: i0.ɵɵFactoryDeclaration<CanvasMeasurerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CanvasMeasurerService>;
}
//# sourceMappingURL=canvas-measurer-service.service.d.ts.map