"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.measureText = void 0;
function measureText(ctx, str, fontSize) {
    ctx.font = `${Math.ceil(fontSize)}px Inconsolata`;
    const textMetrics = ctx.measureText(str);
    const { width: _width, actualBoundingBoxLeft, actualBoundingBoxRight, fontBoundingBoxAscent, fontBoundingBoxDescent, } = textMetrics;
    const width = _width + 4;
    // const width = Math.abs(actualBoundingBoxLeft) + Math.abs(actualBoundingBoxRight) + 4
    const height = 
    // Math.abs(fontBoundingBoxAscent) + Math.abs(fontBoundingBoxDescent) + 4
    Math.abs(fontBoundingBoxAscent) + Math.abs(fontBoundingBoxDescent);
    return {
        width,
        height,
    };
}
exports.measureText = measureText;
//# sourceMappingURL=measureText.js.map