This commit is contained in:
Akko
2025-08-04 18:57:35 +02:00
parent 8cf6e78a79
commit 9495868c2e
5030 changed files with 518594 additions and 17609 deletions

View File

@@ -0,0 +1,36 @@
import { AbstractText, ensureOptions } from '../text/AbstractText.mjs';
import { TextStyle } from '../text/TextStyle.mjs';
import { BitmapFontManager } from './BitmapFontManager.mjs';
"use strict";
class BitmapText extends AbstractText {
constructor(...args) {
var _a;
const options = ensureOptions(args, "BitmapText");
options.style ?? (options.style = options.style || {});
(_a = options.style).fill ?? (_a.fill = 16777215);
super(options, TextStyle);
this.renderPipeId = "bitmapText";
}
_updateBounds() {
const bounds = this._bounds;
const anchor = this._anchor;
const bitmapMeasurement = BitmapFontManager.measureText(this.text, this._style);
const scale = bitmapMeasurement.scale;
const offset = bitmapMeasurement.offsetY * scale;
let width = bitmapMeasurement.width * scale;
let height = bitmapMeasurement.height * scale;
const stroke = this._style._stroke;
if (stroke) {
width += stroke.width;
height += stroke.width;
}
bounds.minX = -anchor._x * width;
bounds.maxX = bounds.minX + width;
bounds.minY = -anchor._y * (height + offset);
bounds.maxY = bounds.minY + height;
}
}
export { BitmapText };
//# sourceMappingURL=BitmapText.mjs.map