import * as i0 from '@angular/core';
import { Injectable } from '@angular/core';

class TextMeasurementService {
    textDiv;
    constructor() {
        const lDiv = document.createElement('div');
        document.body.appendChild(lDiv);
        lDiv.style.color = 'transparent';
        lDiv.style.position = 'absolute';
        lDiv.style.left = '-1000';
        lDiv.style.top = '-1000';
        this.textDiv = lDiv;
    }
    calculateTextWidth(text, fontSize, fontFamily) {
        this.textDiv.textContent = text;
        this.textDiv.style.fontSize = fontSize + 'px';
        this.textDiv.style.fontFamily = fontFamily;
        return this.textDiv.getBoundingClientRect().width;
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TextMeasurementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
    static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TextMeasurementService, providedIn: 'root' });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: TextMeasurementService, decorators: [{
            type: Injectable,
            args: [{
                    providedIn: 'root',
                }]
        }], ctorParameters: () => [] });

/**
 * Generated bundle index. Do not edit.
 */

export { TextMeasurementService };
//# sourceMappingURL=agorapulse-ui-components-text-measurement.mjs.map
