Files
il/resources/public/js/cljs-runtime/module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$BitmapFont.js
2026-07-01 22:38:29 -06:00

47 lines
2.4 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$BitmapFont = function(global, require, module, exports) {
var groupD8 = require("module$node_modules$pixi_DOT_js$lib$maths$matrix$groupD8"), Rectangle = require("module$node_modules$pixi_DOT_js$lib$maths$shapes$Rectangle"), Texture = require("module$node_modules$pixi_DOT_js$lib$rendering$renderers$shared$texture$Texture");
global = require("module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$AbstractBitmapFont");
var BitmapFontManager = require("module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$BitmapFontManager");
"use strict";
class BitmapFont extends global.AbstractBitmapFont {
constructor(options, url) {
super();
const {textures, data} = options;
Object.keys(data.pages).forEach(key => {
key = data.pages[parseInt(key, 10)];
this.pages.push({texture:textures[key.id]});
});
Object.keys(data.chars).forEach(key => {
const charData = data.chars[key], {frame:textureFrame, source:textureSource, rotate:textureRotate} = textures[charData.page];
var frame = groupD8.groupD8.transformRectCoords(charData, textureFrame, textureRotate, new Rectangle.Rectangle());
frame = new Texture.Texture({frame, orig:new Rectangle.Rectangle(0, 0, charData.width, charData.height), source:textureSource, rotate:textureRotate});
this.chars[key] = {id:key.codePointAt(0), xOffset:charData.xOffset, yOffset:charData.yOffset, xAdvance:charData.xAdvance, kerning:charData.kerning ?? {}, texture:frame};
});
this.baseMeasurementFontSize = this.baseRenderedFontSize = data.fontSize;
this.fontMetrics = {ascent:0, descent:0, fontSize:data.fontSize};
this.baseLineOffset = data.baseLineOffset;
this.lineHeight = data.lineHeight;
this.fontFamily = data.fontFamily;
this.distanceField = data.distanceField ?? {type:"none", range:0};
this.url = url;
}
destroy() {
super.destroy();
for (let i = 0; i < this.pages.length; i++) {
const {texture} = this.pages[i];
texture.destroy(!0);
}
this.pages = null;
}
static install(options) {
BitmapFontManager.BitmapFontManager.install(options);
}
static uninstall(name) {
BitmapFontManager.BitmapFontManager.uninstall(name);
}
}
exports.BitmapFont = BitmapFont;
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$BitmapFont.js.map