Initial
This commit is contained in:
227
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.js
generated
vendored
Normal file
227
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
"use strict";
|
||||
var core = require("@pixi/core"), text = require("@pixi/text"), BitmapFontData = require("./BitmapFontData.js"), index = require("./formats/index.js");
|
||||
require("./utils/index.js");
|
||||
var resolveCharacters = require("./utils/resolveCharacters.js"), drawGlyph = require("./utils/drawGlyph.js"), extractCharCode = require("./utils/extractCharCode.js");
|
||||
const _BitmapFont = class _BitmapFont2 {
|
||||
/**
|
||||
* @param data
|
||||
* @param textures
|
||||
* @param ownsTextures - Setting to `true` will destroy page textures
|
||||
* when the font is uninstalled.
|
||||
*/
|
||||
constructor(data, textures, ownsTextures) {
|
||||
const [info] = data.info, [common] = data.common, [page] = data.page, [distanceField] = data.distanceField, res = core.utils.getResolutionOfUrl(page.file), pageTextures = {};
|
||||
this._ownsTextures = ownsTextures, this.font = info.face, this.size = info.size, this.lineHeight = common.lineHeight / res, this.chars = {}, this.pageTextures = pageTextures;
|
||||
for (let i = 0; i < data.page.length; i++) {
|
||||
const { id, file } = data.page[i];
|
||||
pageTextures[id] = textures instanceof Array ? textures[i] : textures[file], distanceField?.fieldType && distanceField.fieldType !== "none" && (pageTextures[id].baseTexture.alphaMode = core.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA, pageTextures[id].baseTexture.mipmap = core.MIPMAP_MODES.OFF);
|
||||
}
|
||||
for (let i = 0; i < data.char.length; i++) {
|
||||
const { id, page: page2 } = data.char[i];
|
||||
let { x, y, width, height, xoffset, yoffset, xadvance } = data.char[i];
|
||||
x /= res, y /= res, width /= res, height /= res, xoffset /= res, yoffset /= res, xadvance /= res;
|
||||
const rect = new core.Rectangle(
|
||||
x + pageTextures[page2].frame.x / res,
|
||||
y + pageTextures[page2].frame.y / res,
|
||||
width,
|
||||
height
|
||||
);
|
||||
this.chars[id] = {
|
||||
xOffset: xoffset,
|
||||
yOffset: yoffset,
|
||||
xAdvance: xadvance,
|
||||
kerning: {},
|
||||
texture: new core.Texture(
|
||||
pageTextures[page2].baseTexture,
|
||||
rect
|
||||
),
|
||||
page: page2
|
||||
};
|
||||
}
|
||||
for (let i = 0; i < data.kerning.length; i++) {
|
||||
let { first, second, amount } = data.kerning[i];
|
||||
first /= res, second /= res, amount /= res, this.chars[second] && (this.chars[second].kerning[first] = amount);
|
||||
}
|
||||
this.distanceFieldRange = distanceField?.distanceRange, this.distanceFieldType = distanceField?.fieldType?.toLowerCase() ?? "none";
|
||||
}
|
||||
/** Remove references to created glyph textures. */
|
||||
destroy() {
|
||||
for (const id in this.chars)
|
||||
this.chars[id].texture.destroy(), this.chars[id].texture = null;
|
||||
for (const id in this.pageTextures)
|
||||
this._ownsTextures && this.pageTextures[id].destroy(!0), this.pageTextures[id] = null;
|
||||
this.chars = null, this.pageTextures = null;
|
||||
}
|
||||
/**
|
||||
* Register a new bitmap font.
|
||||
* @param data - The
|
||||
* characters map that could be provided as xml or raw string.
|
||||
* @param textures - List of textures for each page.
|
||||
* @param ownsTextures - Set to `true` to destroy page textures
|
||||
* when the font is uninstalled. By default fonts created with
|
||||
* `BitmapFont.from` or from the `BitmapFontLoader` are `true`.
|
||||
* @returns {PIXI.BitmapFont} Result font object with font, size, lineHeight
|
||||
* and char fields.
|
||||
*/
|
||||
static install(data, textures, ownsTextures) {
|
||||
let fontData;
|
||||
if (data instanceof BitmapFontData.BitmapFontData)
|
||||
fontData = data;
|
||||
else {
|
||||
const format = index.autoDetectFormat(data);
|
||||
if (!format)
|
||||
throw new Error("Unrecognized data format for font.");
|
||||
fontData = format.parse(data);
|
||||
}
|
||||
textures instanceof core.Texture && (textures = [textures]);
|
||||
const font = new _BitmapFont2(fontData, textures, ownsTextures);
|
||||
return _BitmapFont2.available[font.font] = font, font;
|
||||
}
|
||||
/**
|
||||
* Remove bitmap font by name.
|
||||
* @param name - Name of the font to uninstall.
|
||||
*/
|
||||
static uninstall(name) {
|
||||
const font = _BitmapFont2.available[name];
|
||||
if (!font)
|
||||
throw new Error(`No font found named '${name}'`);
|
||||
font.destroy(), delete _BitmapFont2.available[name];
|
||||
}
|
||||
/**
|
||||
* Generates a bitmap-font for the given style and character set. This does not support
|
||||
* kernings yet. With `style` properties, only the following non-layout properties are used:
|
||||
*
|
||||
* - {@link PIXI.TextStyle#dropShadow|dropShadow}
|
||||
* - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}
|
||||
* - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}
|
||||
* - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}
|
||||
* - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}
|
||||
* - {@link PIXI.TextStyle#fill|fill}
|
||||
* - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}
|
||||
* - {@link PIXI.TextStyle#fillGradientType|fillGradientType}
|
||||
* - {@link PIXI.TextStyle#fontFamily|fontFamily}
|
||||
* - {@link PIXI.TextStyle#fontSize|fontSize}
|
||||
* - {@link PIXI.TextStyle#fontVariant|fontVariant}
|
||||
* - {@link PIXI.TextStyle#fontWeight|fontWeight}
|
||||
* - {@link PIXI.TextStyle#lineJoin|lineJoin}
|
||||
* - {@link PIXI.TextStyle#miterLimit|miterLimit}
|
||||
* - {@link PIXI.TextStyle#stroke|stroke}
|
||||
* - {@link PIXI.TextStyle#strokeThickness|strokeThickness}
|
||||
* - {@link PIXI.TextStyle#textBaseline|textBaseline}
|
||||
* @param name - The name of the custom font to use with BitmapText.
|
||||
* @param textStyle - Style options to render with BitmapFont.
|
||||
* @param options - Setup options for font or name of the font.
|
||||
* @returns Font generated by style options.
|
||||
* @example
|
||||
* import { BitmapFont, BitmapText } from 'pixi.js';
|
||||
*
|
||||
* BitmapFont.from('TitleFont', {
|
||||
* fontFamily: 'Arial',
|
||||
* fontSize: 12,
|
||||
* strokeThickness: 2,
|
||||
* fill: 'purple',
|
||||
* });
|
||||
*
|
||||
* const title = new BitmapText('This is the title', { fontName: 'TitleFont' });
|
||||
*/
|
||||
static from(name, textStyle, options) {
|
||||
if (!name)
|
||||
throw new Error("[BitmapFont] Property `name` is required.");
|
||||
const {
|
||||
chars,
|
||||
padding,
|
||||
resolution,
|
||||
textureWidth,
|
||||
textureHeight,
|
||||
...baseOptions
|
||||
} = Object.assign({}, _BitmapFont2.defaultOptions, options), charsList = resolveCharacters.resolveCharacters(chars), style = textStyle instanceof text.TextStyle ? textStyle : new text.TextStyle(textStyle), lineWidth = textureWidth, fontData = new BitmapFontData.BitmapFontData();
|
||||
fontData.info[0] = {
|
||||
face: style.fontFamily,
|
||||
size: style.fontSize
|
||||
}, fontData.common[0] = {
|
||||
lineHeight: style.fontSize
|
||||
};
|
||||
let positionX = 0, positionY = 0, canvas, context, baseTexture, maxCharHeight = 0;
|
||||
const baseTextures = [], textures = [];
|
||||
for (let i = 0; i < charsList.length; i++) {
|
||||
canvas || (canvas = core.settings.ADAPTER.createCanvas(), canvas.width = textureWidth, canvas.height = textureHeight, context = canvas.getContext("2d"), baseTexture = new core.BaseTexture(canvas, { resolution, ...baseOptions }), baseTextures.push(baseTexture), textures.push(new core.Texture(baseTexture)), fontData.page.push({
|
||||
id: textures.length - 1,
|
||||
file: ""
|
||||
}));
|
||||
const character = charsList[i], metrics = text.TextMetrics.measureText(character, style, !1, canvas), width = metrics.width, height = Math.ceil(metrics.height), textureGlyphWidth = Math.ceil((style.fontStyle === "italic" ? 2 : 1) * width);
|
||||
if (positionY >= textureHeight - height * resolution) {
|
||||
if (positionY === 0)
|
||||
throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is too small (fontFamily: '${style.fontFamily}', fontSize: ${style.fontSize}px, char: '${character}')`);
|
||||
--i, canvas = null, context = null, baseTexture = null, positionY = 0, positionX = 0, maxCharHeight = 0;
|
||||
continue;
|
||||
}
|
||||
if (maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight), textureGlyphWidth * resolution + positionX >= lineWidth) {
|
||||
if (positionX === 0)
|
||||
throw new Error(`[BitmapFont] textureWidth ${textureWidth}px is too small (fontFamily: '${style.fontFamily}', fontSize: ${style.fontSize}px, char: '${character}')`);
|
||||
--i, positionY += maxCharHeight * resolution, positionY = Math.ceil(positionY), positionX = 0, maxCharHeight = 0;
|
||||
continue;
|
||||
}
|
||||
drawGlyph.drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);
|
||||
const id = extractCharCode.extractCharCode(metrics.text);
|
||||
fontData.char.push({
|
||||
id,
|
||||
page: textures.length - 1,
|
||||
x: positionX / resolution,
|
||||
y: positionY / resolution,
|
||||
width: textureGlyphWidth,
|
||||
height,
|
||||
xoffset: 0,
|
||||
yoffset: 0,
|
||||
xadvance: width - (style.dropShadow ? style.dropShadowDistance : 0) - (style.stroke ? style.strokeThickness : 0)
|
||||
}), positionX += (textureGlyphWidth + 2 * padding) * resolution, positionX = Math.ceil(positionX);
|
||||
}
|
||||
if (!options?.skipKerning)
|
||||
for (let i = 0, len = charsList.length; i < len; i++) {
|
||||
const first = charsList[i];
|
||||
for (let j = 0; j < len; j++) {
|
||||
const second = charsList[j], c1 = context.measureText(first).width, c2 = context.measureText(second).width, amount = context.measureText(first + second).width - (c1 + c2);
|
||||
amount && fontData.kerning.push({
|
||||
first: extractCharCode.extractCharCode(first),
|
||||
second: extractCharCode.extractCharCode(second),
|
||||
amount
|
||||
});
|
||||
}
|
||||
}
|
||||
const font = new _BitmapFont2(fontData, textures, !0);
|
||||
return _BitmapFont2.available[name] !== void 0 && _BitmapFont2.uninstall(name), _BitmapFont2.available[name] = font, font;
|
||||
}
|
||||
};
|
||||
_BitmapFont.ALPHA = [["a", "z"], ["A", "Z"], " "], /**
|
||||
* This character set includes all decimal digits (from 0 to 9).
|
||||
* @type {string[][]}
|
||||
* @example
|
||||
* BitmapFont.from('ExampleFont', style, { chars: BitmapFont.NUMERIC })
|
||||
*/
|
||||
_BitmapFont.NUMERIC = [["0", "9"]], /**
|
||||
* This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.
|
||||
* @type {string[][]}
|
||||
*/
|
||||
_BitmapFont.ALPHANUMERIC = [["a", "z"], ["A", "Z"], ["0", "9"], " "], /**
|
||||
* This character set consists of all the ASCII table.
|
||||
* @member {string[][]}
|
||||
* @see http://www.asciitable.com/
|
||||
*/
|
||||
_BitmapFont.ASCII = [[" ", "~"]], /**
|
||||
* Collection of default options when using `BitmapFont.from`.
|
||||
* @property {number} [resolution=1] -
|
||||
* @property {number} [textureWidth=512] -
|
||||
* @property {number} [textureHeight=512] -
|
||||
* @property {number} [padding=4] -
|
||||
* @property {string|string[]|string[][]} chars = PIXI.BitmapFont.ALPHANUMERIC
|
||||
*/
|
||||
_BitmapFont.defaultOptions = {
|
||||
resolution: 1,
|
||||
textureWidth: 512,
|
||||
textureHeight: 512,
|
||||
padding: 4,
|
||||
chars: _BitmapFont.ALPHANUMERIC
|
||||
}, /** Collection of available/installed fonts. */
|
||||
_BitmapFont.available = {};
|
||||
let BitmapFont = _BitmapFont;
|
||||
exports.BitmapFont = BitmapFont;
|
||||
//# sourceMappingURL=BitmapFont.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
233
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.mjs
generated
vendored
Normal file
233
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.mjs
generated
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
import { utils, ALPHA_MODES, MIPMAP_MODES, Rectangle, Texture, settings, BaseTexture } from "@pixi/core";
|
||||
import { TextStyle, TextMetrics } from "@pixi/text";
|
||||
import { BitmapFontData } from "./BitmapFontData.mjs";
|
||||
import { autoDetectFormat } from "./formats/index.mjs";
|
||||
import "./utils/index.mjs";
|
||||
import { resolveCharacters } from "./utils/resolveCharacters.mjs";
|
||||
import { drawGlyph } from "./utils/drawGlyph.mjs";
|
||||
import { extractCharCode } from "./utils/extractCharCode.mjs";
|
||||
const _BitmapFont = class _BitmapFont2 {
|
||||
/**
|
||||
* @param data
|
||||
* @param textures
|
||||
* @param ownsTextures - Setting to `true` will destroy page textures
|
||||
* when the font is uninstalled.
|
||||
*/
|
||||
constructor(data, textures, ownsTextures) {
|
||||
const [info] = data.info, [common] = data.common, [page] = data.page, [distanceField] = data.distanceField, res = utils.getResolutionOfUrl(page.file), pageTextures = {};
|
||||
this._ownsTextures = ownsTextures, this.font = info.face, this.size = info.size, this.lineHeight = common.lineHeight / res, this.chars = {}, this.pageTextures = pageTextures;
|
||||
for (let i = 0; i < data.page.length; i++) {
|
||||
const { id, file } = data.page[i];
|
||||
pageTextures[id] = textures instanceof Array ? textures[i] : textures[file], distanceField?.fieldType && distanceField.fieldType !== "none" && (pageTextures[id].baseTexture.alphaMode = ALPHA_MODES.NO_PREMULTIPLIED_ALPHA, pageTextures[id].baseTexture.mipmap = MIPMAP_MODES.OFF);
|
||||
}
|
||||
for (let i = 0; i < data.char.length; i++) {
|
||||
const { id, page: page2 } = data.char[i];
|
||||
let { x, y, width, height, xoffset, yoffset, xadvance } = data.char[i];
|
||||
x /= res, y /= res, width /= res, height /= res, xoffset /= res, yoffset /= res, xadvance /= res;
|
||||
const rect = new Rectangle(
|
||||
x + pageTextures[page2].frame.x / res,
|
||||
y + pageTextures[page2].frame.y / res,
|
||||
width,
|
||||
height
|
||||
);
|
||||
this.chars[id] = {
|
||||
xOffset: xoffset,
|
||||
yOffset: yoffset,
|
||||
xAdvance: xadvance,
|
||||
kerning: {},
|
||||
texture: new Texture(
|
||||
pageTextures[page2].baseTexture,
|
||||
rect
|
||||
),
|
||||
page: page2
|
||||
};
|
||||
}
|
||||
for (let i = 0; i < data.kerning.length; i++) {
|
||||
let { first, second, amount } = data.kerning[i];
|
||||
first /= res, second /= res, amount /= res, this.chars[second] && (this.chars[second].kerning[first] = amount);
|
||||
}
|
||||
this.distanceFieldRange = distanceField?.distanceRange, this.distanceFieldType = distanceField?.fieldType?.toLowerCase() ?? "none";
|
||||
}
|
||||
/** Remove references to created glyph textures. */
|
||||
destroy() {
|
||||
for (const id in this.chars)
|
||||
this.chars[id].texture.destroy(), this.chars[id].texture = null;
|
||||
for (const id in this.pageTextures)
|
||||
this._ownsTextures && this.pageTextures[id].destroy(!0), this.pageTextures[id] = null;
|
||||
this.chars = null, this.pageTextures = null;
|
||||
}
|
||||
/**
|
||||
* Register a new bitmap font.
|
||||
* @param data - The
|
||||
* characters map that could be provided as xml or raw string.
|
||||
* @param textures - List of textures for each page.
|
||||
* @param ownsTextures - Set to `true` to destroy page textures
|
||||
* when the font is uninstalled. By default fonts created with
|
||||
* `BitmapFont.from` or from the `BitmapFontLoader` are `true`.
|
||||
* @returns {PIXI.BitmapFont} Result font object with font, size, lineHeight
|
||||
* and char fields.
|
||||
*/
|
||||
static install(data, textures, ownsTextures) {
|
||||
let fontData;
|
||||
if (data instanceof BitmapFontData)
|
||||
fontData = data;
|
||||
else {
|
||||
const format = autoDetectFormat(data);
|
||||
if (!format)
|
||||
throw new Error("Unrecognized data format for font.");
|
||||
fontData = format.parse(data);
|
||||
}
|
||||
textures instanceof Texture && (textures = [textures]);
|
||||
const font = new _BitmapFont2(fontData, textures, ownsTextures);
|
||||
return _BitmapFont2.available[font.font] = font, font;
|
||||
}
|
||||
/**
|
||||
* Remove bitmap font by name.
|
||||
* @param name - Name of the font to uninstall.
|
||||
*/
|
||||
static uninstall(name) {
|
||||
const font = _BitmapFont2.available[name];
|
||||
if (!font)
|
||||
throw new Error(`No font found named '${name}'`);
|
||||
font.destroy(), delete _BitmapFont2.available[name];
|
||||
}
|
||||
/**
|
||||
* Generates a bitmap-font for the given style and character set. This does not support
|
||||
* kernings yet. With `style` properties, only the following non-layout properties are used:
|
||||
*
|
||||
* - {@link PIXI.TextStyle#dropShadow|dropShadow}
|
||||
* - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}
|
||||
* - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}
|
||||
* - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}
|
||||
* - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}
|
||||
* - {@link PIXI.TextStyle#fill|fill}
|
||||
* - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}
|
||||
* - {@link PIXI.TextStyle#fillGradientType|fillGradientType}
|
||||
* - {@link PIXI.TextStyle#fontFamily|fontFamily}
|
||||
* - {@link PIXI.TextStyle#fontSize|fontSize}
|
||||
* - {@link PIXI.TextStyle#fontVariant|fontVariant}
|
||||
* - {@link PIXI.TextStyle#fontWeight|fontWeight}
|
||||
* - {@link PIXI.TextStyle#lineJoin|lineJoin}
|
||||
* - {@link PIXI.TextStyle#miterLimit|miterLimit}
|
||||
* - {@link PIXI.TextStyle#stroke|stroke}
|
||||
* - {@link PIXI.TextStyle#strokeThickness|strokeThickness}
|
||||
* - {@link PIXI.TextStyle#textBaseline|textBaseline}
|
||||
* @param name - The name of the custom font to use with BitmapText.
|
||||
* @param textStyle - Style options to render with BitmapFont.
|
||||
* @param options - Setup options for font or name of the font.
|
||||
* @returns Font generated by style options.
|
||||
* @example
|
||||
* import { BitmapFont, BitmapText } from 'pixi.js';
|
||||
*
|
||||
* BitmapFont.from('TitleFont', {
|
||||
* fontFamily: 'Arial',
|
||||
* fontSize: 12,
|
||||
* strokeThickness: 2,
|
||||
* fill: 'purple',
|
||||
* });
|
||||
*
|
||||
* const title = new BitmapText('This is the title', { fontName: 'TitleFont' });
|
||||
*/
|
||||
static from(name, textStyle, options) {
|
||||
if (!name)
|
||||
throw new Error("[BitmapFont] Property `name` is required.");
|
||||
const {
|
||||
chars,
|
||||
padding,
|
||||
resolution,
|
||||
textureWidth,
|
||||
textureHeight,
|
||||
...baseOptions
|
||||
} = Object.assign({}, _BitmapFont2.defaultOptions, options), charsList = resolveCharacters(chars), style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle), lineWidth = textureWidth, fontData = new BitmapFontData();
|
||||
fontData.info[0] = {
|
||||
face: style.fontFamily,
|
||||
size: style.fontSize
|
||||
}, fontData.common[0] = {
|
||||
lineHeight: style.fontSize
|
||||
};
|
||||
let positionX = 0, positionY = 0, canvas, context, baseTexture, maxCharHeight = 0;
|
||||
const baseTextures = [], textures = [];
|
||||
for (let i = 0; i < charsList.length; i++) {
|
||||
canvas || (canvas = settings.ADAPTER.createCanvas(), canvas.width = textureWidth, canvas.height = textureHeight, context = canvas.getContext("2d"), baseTexture = new BaseTexture(canvas, { resolution, ...baseOptions }), baseTextures.push(baseTexture), textures.push(new Texture(baseTexture)), fontData.page.push({
|
||||
id: textures.length - 1,
|
||||
file: ""
|
||||
}));
|
||||
const character = charsList[i], metrics = TextMetrics.measureText(character, style, !1, canvas), width = metrics.width, height = Math.ceil(metrics.height), textureGlyphWidth = Math.ceil((style.fontStyle === "italic" ? 2 : 1) * width);
|
||||
if (positionY >= textureHeight - height * resolution) {
|
||||
if (positionY === 0)
|
||||
throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is too small (fontFamily: '${style.fontFamily}', fontSize: ${style.fontSize}px, char: '${character}')`);
|
||||
--i, canvas = null, context = null, baseTexture = null, positionY = 0, positionX = 0, maxCharHeight = 0;
|
||||
continue;
|
||||
}
|
||||
if (maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight), textureGlyphWidth * resolution + positionX >= lineWidth) {
|
||||
if (positionX === 0)
|
||||
throw new Error(`[BitmapFont] textureWidth ${textureWidth}px is too small (fontFamily: '${style.fontFamily}', fontSize: ${style.fontSize}px, char: '${character}')`);
|
||||
--i, positionY += maxCharHeight * resolution, positionY = Math.ceil(positionY), positionX = 0, maxCharHeight = 0;
|
||||
continue;
|
||||
}
|
||||
drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);
|
||||
const id = extractCharCode(metrics.text);
|
||||
fontData.char.push({
|
||||
id,
|
||||
page: textures.length - 1,
|
||||
x: positionX / resolution,
|
||||
y: positionY / resolution,
|
||||
width: textureGlyphWidth,
|
||||
height,
|
||||
xoffset: 0,
|
||||
yoffset: 0,
|
||||
xadvance: width - (style.dropShadow ? style.dropShadowDistance : 0) - (style.stroke ? style.strokeThickness : 0)
|
||||
}), positionX += (textureGlyphWidth + 2 * padding) * resolution, positionX = Math.ceil(positionX);
|
||||
}
|
||||
if (!options?.skipKerning)
|
||||
for (let i = 0, len = charsList.length; i < len; i++) {
|
||||
const first = charsList[i];
|
||||
for (let j = 0; j < len; j++) {
|
||||
const second = charsList[j], c1 = context.measureText(first).width, c2 = context.measureText(second).width, amount = context.measureText(first + second).width - (c1 + c2);
|
||||
amount && fontData.kerning.push({
|
||||
first: extractCharCode(first),
|
||||
second: extractCharCode(second),
|
||||
amount
|
||||
});
|
||||
}
|
||||
}
|
||||
const font = new _BitmapFont2(fontData, textures, !0);
|
||||
return _BitmapFont2.available[name] !== void 0 && _BitmapFont2.uninstall(name), _BitmapFont2.available[name] = font, font;
|
||||
}
|
||||
};
|
||||
_BitmapFont.ALPHA = [["a", "z"], ["A", "Z"], " "], /**
|
||||
* This character set includes all decimal digits (from 0 to 9).
|
||||
* @type {string[][]}
|
||||
* @example
|
||||
* BitmapFont.from('ExampleFont', style, { chars: BitmapFont.NUMERIC })
|
||||
*/
|
||||
_BitmapFont.NUMERIC = [["0", "9"]], /**
|
||||
* This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.
|
||||
* @type {string[][]}
|
||||
*/
|
||||
_BitmapFont.ALPHANUMERIC = [["a", "z"], ["A", "Z"], ["0", "9"], " "], /**
|
||||
* This character set consists of all the ASCII table.
|
||||
* @member {string[][]}
|
||||
* @see http://www.asciitable.com/
|
||||
*/
|
||||
_BitmapFont.ASCII = [[" ", "~"]], /**
|
||||
* Collection of default options when using `BitmapFont.from`.
|
||||
* @property {number} [resolution=1] -
|
||||
* @property {number} [textureWidth=512] -
|
||||
* @property {number} [textureHeight=512] -
|
||||
* @property {number} [padding=4] -
|
||||
* @property {string|string[]|string[][]} chars = PIXI.BitmapFont.ALPHANUMERIC
|
||||
*/
|
||||
_BitmapFont.defaultOptions = {
|
||||
resolution: 1,
|
||||
textureWidth: 512,
|
||||
textureHeight: 512,
|
||||
padding: 4,
|
||||
chars: _BitmapFont.ALPHANUMERIC
|
||||
}, /** Collection of available/installed fonts. */
|
||||
_BitmapFont.available = {};
|
||||
let BitmapFont = _BitmapFont;
|
||||
export {
|
||||
BitmapFont
|
||||
};
|
||||
//# sourceMappingURL=BitmapFont.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFont.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.js
generated
vendored
Normal file
8
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
class BitmapFontData {
|
||||
constructor() {
|
||||
this.info = [], this.common = [], this.page = [], this.char = [], this.kerning = [], this.distanceField = [];
|
||||
}
|
||||
}
|
||||
exports.BitmapFontData = BitmapFontData;
|
||||
//# sourceMappingURL=BitmapFontData.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BitmapFontData.js","sources":["../src/BitmapFontData.ts"],"sourcesContent":["/* eslint-disable max-len */\n\n/**\n * Normalized parsed data from .fnt files.\n * @memberof PIXI\n */\nexport class BitmapFontData\n{\n /** @readonly */\n public info: IBitmapFontDataInfo[];\n\n /** @readonly */\n public common: IBitmapFontDataCommon[];\n\n /** @readonly */\n public page: IBitmapFontDataPage[];\n\n /** @readonly */\n public char: IBitmapFontDataChar[];\n\n /** @readonly */\n public kerning: IBitmapFontDataKerning[];\n\n /** @readonly */\n public distanceField: IBitmapFontDataDistanceField[];\n\n constructor()\n {\n this.info = [];\n this.common = [];\n this.page = [];\n this.char = [];\n this.kerning = [];\n this.distanceField = [];\n }\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataInfo\n{\n /** Font face */\n face: string;\n\n /** Font size */\n size: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataCommon\n{\n /** Line height, in pixels. */\n lineHeight: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataPage\n{\n /** Unique id for bitmap texture */\n id: number;\n\n /** File name */\n file: string;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataChar\n{\n /** Unique id of character */\n id: number;\n\n /** {@link PIXI.IBitmapFontDataPage} id */\n page: number;\n\n /** x-position of character in page. */\n x: number;\n\n /** y-position of character in page. */\n y: number;\n\n /** Width of character in page. */\n width: number;\n\n /** Height of character in page. */\n height: number;\n\n /** x-offset to apply when rendering character */\n xoffset: number;\n\n /** y-offset to apply when rendering character. */\n yoffset: number;\n\n /** Advancement to apply to next character. */\n xadvance: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataKerning\n{\n /** First character of pair */\n first: number;\n\n /** Second character of pair */\n second: number;\n\n /** x-offset to apply between first & second characters when they are next to each other. */\n amount: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataDistanceField\n{\n /** Type of distance field */\n fieldType: string;\n\n /** Range of distance */\n distanceRange: number;\n}\n"],"names":[],"mappings":";AAMO,MAAM,eACb;AAAA,EAmBI,cACA;AACS,SAAA,OAAO,IACZ,KAAK,SAAS,CAAC,GACf,KAAK,OAAO,CAAA,GACZ,KAAK,OAAO,CACZ,GAAA,KAAK,UAAU,CAAA,GACf,KAAK,gBAAgB;EACzB;AACJ;;"}
|
||||
9
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.mjs
generated
vendored
Normal file
9
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
class BitmapFontData {
|
||||
constructor() {
|
||||
this.info = [], this.common = [], this.page = [], this.char = [], this.kerning = [], this.distanceField = [];
|
||||
}
|
||||
}
|
||||
export {
|
||||
BitmapFontData
|
||||
};
|
||||
//# sourceMappingURL=BitmapFontData.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapFontData.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BitmapFontData.mjs","sources":["../src/BitmapFontData.ts"],"sourcesContent":["/* eslint-disable max-len */\n\n/**\n * Normalized parsed data from .fnt files.\n * @memberof PIXI\n */\nexport class BitmapFontData\n{\n /** @readonly */\n public info: IBitmapFontDataInfo[];\n\n /** @readonly */\n public common: IBitmapFontDataCommon[];\n\n /** @readonly */\n public page: IBitmapFontDataPage[];\n\n /** @readonly */\n public char: IBitmapFontDataChar[];\n\n /** @readonly */\n public kerning: IBitmapFontDataKerning[];\n\n /** @readonly */\n public distanceField: IBitmapFontDataDistanceField[];\n\n constructor()\n {\n this.info = [];\n this.common = [];\n this.page = [];\n this.char = [];\n this.kerning = [];\n this.distanceField = [];\n }\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataInfo\n{\n /** Font face */\n face: string;\n\n /** Font size */\n size: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataCommon\n{\n /** Line height, in pixels. */\n lineHeight: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataPage\n{\n /** Unique id for bitmap texture */\n id: number;\n\n /** File name */\n file: string;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataChar\n{\n /** Unique id of character */\n id: number;\n\n /** {@link PIXI.IBitmapFontDataPage} id */\n page: number;\n\n /** x-position of character in page. */\n x: number;\n\n /** y-position of character in page. */\n y: number;\n\n /** Width of character in page. */\n width: number;\n\n /** Height of character in page. */\n height: number;\n\n /** x-offset to apply when rendering character */\n xoffset: number;\n\n /** y-offset to apply when rendering character. */\n yoffset: number;\n\n /** Advancement to apply to next character. */\n xadvance: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataKerning\n{\n /** First character of pair */\n first: number;\n\n /** Second character of pair */\n second: number;\n\n /** x-offset to apply between first & second characters when they are next to each other. */\n amount: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataDistanceField\n{\n /** Type of distance field */\n fieldType: string;\n\n /** Range of distance */\n distanceRange: number;\n}\n"],"names":[],"mappings":"AAMO,MAAM,eACb;AAAA,EAmBI,cACA;AACS,SAAA,OAAO,IACZ,KAAK,SAAS,CAAC,GACf,KAAK,OAAO,CAAA,GACZ,KAAK,OAAO,CACZ,GAAA,KAAK,UAAU,CAAA,GACf,KAAK,gBAAgB;EACzB;AACJ;"}
|
||||
317
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.js
generated
vendored
Normal file
317
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.js
generated
vendored
Normal file
@@ -0,0 +1,317 @@
|
||||
"use strict";
|
||||
var core = require("@pixi/core"), display = require("@pixi/display"), mesh = require("@pixi/mesh"), BitmapFont = require("./BitmapFont.js"), msdf$1 = require("./shader/msdf.frag.js"), msdf = require("./shader/msdf.vert.js");
|
||||
require("./utils/index.js");
|
||||
var splitTextToCharacters = require("./utils/splitTextToCharacters.js"), extractCharCode = require("./utils/extractCharCode.js");
|
||||
const pageMeshDataDefaultPageMeshData = [], pageMeshDataMSDFPageMeshData = [], charRenderDataPool = [], _BitmapText = class _BitmapText2 extends display.Container {
|
||||
/**
|
||||
* @param text - A string that you would like the text to display.
|
||||
* @param style - The style parameters.
|
||||
* @param {string} style.fontName - The installed BitmapFont name.
|
||||
* @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,
|
||||
*. this will default to the BitmapFont size.
|
||||
* @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center', 'right' or 'justify'),
|
||||
* does not affect single line text.
|
||||
* @param {PIXI.ColorSource} [style.tint=0xFFFFFF] - The tint color.
|
||||
* @param {number} [style.letterSpacing=0] - The amount of spacing between letters.
|
||||
* @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.
|
||||
*/
|
||||
constructor(text, style = {}) {
|
||||
super();
|
||||
const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign(
|
||||
{},
|
||||
_BitmapText2.styleDefaults,
|
||||
style
|
||||
);
|
||||
if (!BitmapFont.BitmapFont.available[fontName])
|
||||
throw new Error(`Missing BitmapFont "${fontName}"`);
|
||||
this._activePagesMeshData = [], this._textWidth = 0, this._textHeight = 0, this._align = align, this._tintColor = new core.Color(tint), this._font = void 0, this._fontName = fontName, this._fontSize = fontSize, this.text = text, this._maxWidth = maxWidth, this._maxLineHeight = 0, this._letterSpacing = letterSpacing, this._anchor = new core.ObservablePoint(() => {
|
||||
this.dirty = !0;
|
||||
}, this, 0, 0), this._roundPixels = core.settings.ROUND_PIXELS, this.dirty = !0, this._resolution = core.settings.RESOLUTION, this._autoResolution = !0, this._textureCache = {};
|
||||
}
|
||||
/** Renders text and updates it when needed. This should only be called if the BitmapFont is regenerated. */
|
||||
updateText() {
|
||||
const data = BitmapFont.BitmapFont.available[this._fontName], fontSize = this.fontSize, scale = fontSize / data.size, pos = new core.Point(), chars = [], lineWidths = [], lineSpaces = [], text = this._text.replace(/(?:\r\n|\r)/g, `
|
||||
`) || " ", charsInput = splitTextToCharacters.splitTextToCharacters(text), maxWidth = this._maxWidth * data.size / fontSize, pageMeshDataPool = data.distanceFieldType === "none" ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;
|
||||
let prevCharCode = null, lastLineWidth = 0, maxLineWidth = 0, line = 0, lastBreakPos = -1, lastBreakWidth = 0, spacesRemoved = 0, maxLineHeight = 0, spaceCount = 0;
|
||||
for (let i = 0; i < charsInput.length; i++) {
|
||||
const char = charsInput[i], charCode = extractCharCode.extractCharCode(char);
|
||||
if (/(?:\s)/.test(char) && (lastBreakPos = i, lastBreakWidth = lastLineWidth, spaceCount++), char === "\r" || char === `
|
||||
`) {
|
||||
lineWidths.push(lastLineWidth), lineSpaces.push(-1), maxLineWidth = Math.max(maxLineWidth, lastLineWidth), ++line, ++spacesRemoved, pos.x = 0, pos.y += data.lineHeight, prevCharCode = null, spaceCount = 0;
|
||||
continue;
|
||||
}
|
||||
const charData = data.chars[charCode];
|
||||
if (!charData)
|
||||
continue;
|
||||
prevCharCode && charData.kerning[prevCharCode] && (pos.x += charData.kerning[prevCharCode]);
|
||||
const charRenderData = charRenderDataPool.pop() || {
|
||||
texture: core.Texture.EMPTY,
|
||||
line: 0,
|
||||
charCode: 0,
|
||||
prevSpaces: 0,
|
||||
position: new core.Point()
|
||||
};
|
||||
charRenderData.texture = charData.texture, charRenderData.line = line, charRenderData.charCode = charCode, charRenderData.position.x = Math.round(pos.x + charData.xOffset + this._letterSpacing / 2), charRenderData.position.y = Math.round(pos.y + charData.yOffset), charRenderData.prevSpaces = spaceCount, chars.push(charRenderData), lastLineWidth = charRenderData.position.x + Math.max(charData.xAdvance - charData.xOffset, charData.texture.orig.width), pos.x += charData.xAdvance + this._letterSpacing, maxLineHeight = Math.max(maxLineHeight, charData.yOffset + charData.texture.height), prevCharCode = charCode, lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth && (++spacesRemoved, core.utils.removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos), i = lastBreakPos, lastBreakPos = -1, lineWidths.push(lastBreakWidth), lineSpaces.push(chars.length > 0 ? chars[chars.length - 1].prevSpaces : 0), maxLineWidth = Math.max(maxLineWidth, lastBreakWidth), line++, pos.x = 0, pos.y += data.lineHeight, prevCharCode = null, spaceCount = 0);
|
||||
}
|
||||
const lastChar = charsInput[charsInput.length - 1];
|
||||
lastChar !== "\r" && lastChar !== `
|
||||
` && (/(?:\s)/.test(lastChar) && (lastLineWidth = lastBreakWidth), lineWidths.push(lastLineWidth), maxLineWidth = Math.max(maxLineWidth, lastLineWidth), lineSpaces.push(-1));
|
||||
const lineAlignOffsets = [];
|
||||
for (let i = 0; i <= line; i++) {
|
||||
let alignOffset = 0;
|
||||
this._align === "right" ? alignOffset = maxLineWidth - lineWidths[i] : this._align === "center" ? alignOffset = (maxLineWidth - lineWidths[i]) / 2 : this._align === "justify" && (alignOffset = lineSpaces[i] < 0 ? 0 : (maxLineWidth - lineWidths[i]) / lineSpaces[i]), lineAlignOffsets.push(alignOffset);
|
||||
}
|
||||
const lenChars = chars.length, pagesMeshData = {}, newPagesMeshData = [], activePagesMeshData = this._activePagesMeshData;
|
||||
pageMeshDataPool.push(...activePagesMeshData);
|
||||
for (let i = 0; i < lenChars; i++) {
|
||||
const texture = chars[i].texture, baseTextureUid = texture.baseTexture.uid;
|
||||
if (!pagesMeshData[baseTextureUid]) {
|
||||
let pageMeshData = pageMeshDataPool.pop();
|
||||
if (!pageMeshData) {
|
||||
const geometry = new mesh.MeshGeometry();
|
||||
let material, meshBlendMode;
|
||||
data.distanceFieldType === "none" ? (material = new mesh.MeshMaterial(core.Texture.EMPTY), meshBlendMode = core.BLEND_MODES.NORMAL) : (material = new mesh.MeshMaterial(
|
||||
core.Texture.EMPTY,
|
||||
{ program: core.Program.from(msdf.default, msdf$1.default), uniforms: { uFWidth: 0 } }
|
||||
), meshBlendMode = core.BLEND_MODES.NORMAL_NPM);
|
||||
const mesh$1 = new mesh.Mesh(geometry, material);
|
||||
mesh$1.blendMode = meshBlendMode, pageMeshData = {
|
||||
index: 0,
|
||||
indexCount: 0,
|
||||
vertexCount: 0,
|
||||
uvsCount: 0,
|
||||
total: 0,
|
||||
mesh: mesh$1,
|
||||
vertices: null,
|
||||
uvs: null,
|
||||
indices: null
|
||||
};
|
||||
}
|
||||
pageMeshData.index = 0, pageMeshData.indexCount = 0, pageMeshData.vertexCount = 0, pageMeshData.uvsCount = 0, pageMeshData.total = 0;
|
||||
const { _textureCache } = this;
|
||||
_textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new core.Texture(texture.baseTexture), pageMeshData.mesh.texture = _textureCache[baseTextureUid], pageMeshData.mesh.tint = this._tintColor.value, newPagesMeshData.push(pageMeshData), pagesMeshData[baseTextureUid] = pageMeshData;
|
||||
}
|
||||
pagesMeshData[baseTextureUid].total++;
|
||||
}
|
||||
for (let i = 0; i < activePagesMeshData.length; i++)
|
||||
newPagesMeshData.includes(activePagesMeshData[i]) || this.removeChild(activePagesMeshData[i].mesh);
|
||||
for (let i = 0; i < newPagesMeshData.length; i++)
|
||||
newPagesMeshData[i].mesh.parent !== this && this.addChild(newPagesMeshData[i].mesh);
|
||||
this._activePagesMeshData = newPagesMeshData;
|
||||
for (const i in pagesMeshData) {
|
||||
const pageMeshData = pagesMeshData[i], total = pageMeshData.total;
|
||||
if (!(pageMeshData.indices?.length > 6 * total) || pageMeshData.vertices.length < mesh.Mesh.BATCHABLE_SIZE * 2)
|
||||
pageMeshData.vertices = new Float32Array(4 * 2 * total), pageMeshData.uvs = new Float32Array(4 * 2 * total), pageMeshData.indices = new Uint16Array(6 * total);
|
||||
else {
|
||||
const total2 = pageMeshData.total, vertices = pageMeshData.vertices;
|
||||
for (let i2 = total2 * 4 * 2; i2 < vertices.length; i2++)
|
||||
vertices[i2] = 0;
|
||||
}
|
||||
pageMeshData.mesh.size = 6 * total;
|
||||
}
|
||||
for (let i = 0; i < lenChars; i++) {
|
||||
const char = chars[i];
|
||||
let offset = char.position.x + lineAlignOffsets[char.line] * (this._align === "justify" ? char.prevSpaces : 1);
|
||||
this._roundPixels && (offset = Math.round(offset));
|
||||
const xPos = offset * scale, yPos = char.position.y * scale, texture = char.texture, pageMesh = pagesMeshData[texture.baseTexture.uid], textureFrame = texture.frame, textureUvs = texture._uvs, index = pageMesh.index++;
|
||||
pageMesh.indices[index * 6 + 0] = 0 + index * 4, pageMesh.indices[index * 6 + 1] = 1 + index * 4, pageMesh.indices[index * 6 + 2] = 2 + index * 4, pageMesh.indices[index * 6 + 3] = 0 + index * 4, pageMesh.indices[index * 6 + 4] = 2 + index * 4, pageMesh.indices[index * 6 + 5] = 3 + index * 4, pageMesh.vertices[index * 8 + 0] = xPos, pageMesh.vertices[index * 8 + 1] = yPos, pageMesh.vertices[index * 8 + 2] = xPos + textureFrame.width * scale, pageMesh.vertices[index * 8 + 3] = yPos, pageMesh.vertices[index * 8 + 4] = xPos + textureFrame.width * scale, pageMesh.vertices[index * 8 + 5] = yPos + textureFrame.height * scale, pageMesh.vertices[index * 8 + 6] = xPos, pageMesh.vertices[index * 8 + 7] = yPos + textureFrame.height * scale, pageMesh.uvs[index * 8 + 0] = textureUvs.x0, pageMesh.uvs[index * 8 + 1] = textureUvs.y0, pageMesh.uvs[index * 8 + 2] = textureUvs.x1, pageMesh.uvs[index * 8 + 3] = textureUvs.y1, pageMesh.uvs[index * 8 + 4] = textureUvs.x2, pageMesh.uvs[index * 8 + 5] = textureUvs.y2, pageMesh.uvs[index * 8 + 6] = textureUvs.x3, pageMesh.uvs[index * 8 + 7] = textureUvs.y3;
|
||||
}
|
||||
this._textWidth = maxLineWidth * scale, this._textHeight = (pos.y + data.lineHeight) * scale;
|
||||
for (const i in pagesMeshData) {
|
||||
const pageMeshData = pagesMeshData[i];
|
||||
if (this.anchor.x !== 0 || this.anchor.y !== 0) {
|
||||
let vertexCount = 0;
|
||||
const anchorOffsetX = this._textWidth * this.anchor.x, anchorOffsetY = this._textHeight * this.anchor.y;
|
||||
for (let i2 = 0; i2 < pageMeshData.total; i2++)
|
||||
pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY, pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY, pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY, pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY;
|
||||
}
|
||||
this._maxLineHeight = maxLineHeight * scale;
|
||||
const vertexBuffer = pageMeshData.mesh.geometry.getBuffer("aVertexPosition"), textureBuffer = pageMeshData.mesh.geometry.getBuffer("aTextureCoord"), indexBuffer = pageMeshData.mesh.geometry.getIndex();
|
||||
vertexBuffer.data = pageMeshData.vertices, textureBuffer.data = pageMeshData.uvs, indexBuffer.data = pageMeshData.indices, vertexBuffer.update(), textureBuffer.update(), indexBuffer.update();
|
||||
}
|
||||
for (let i = 0; i < chars.length; i++)
|
||||
charRenderDataPool.push(chars[i]);
|
||||
this._font = data, this.dirty = !1;
|
||||
}
|
||||
updateTransform() {
|
||||
this.validate(), this.containerUpdateTransform();
|
||||
}
|
||||
_render(renderer) {
|
||||
this._autoResolution && this._resolution !== renderer.resolution && (this._resolution = renderer.resolution, this.dirty = !0);
|
||||
const { distanceFieldRange, distanceFieldType, size } = BitmapFont.BitmapFont.available[this._fontName];
|
||||
if (distanceFieldType !== "none") {
|
||||
const { a, b, c, d } = this.worldTransform, dx = Math.sqrt(a * a + b * b), dy = Math.sqrt(c * c + d * d), worldScale = (Math.abs(dx) + Math.abs(dy)) / 2, fontScale = this.fontSize / size, resolution = renderer._view.resolution;
|
||||
for (const mesh2 of this._activePagesMeshData)
|
||||
mesh2.mesh.shader.uniforms.uFWidth = worldScale * distanceFieldRange * fontScale * resolution;
|
||||
}
|
||||
super._render(renderer);
|
||||
}
|
||||
/**
|
||||
* Validates text before calling parent's getLocalBounds
|
||||
* @returns - The rectangular bounding area
|
||||
*/
|
||||
getLocalBounds() {
|
||||
return this.validate(), super.getLocalBounds();
|
||||
}
|
||||
/**
|
||||
* Updates text when needed
|
||||
* @private
|
||||
*/
|
||||
validate() {
|
||||
const font = BitmapFont.BitmapFont.available[this._fontName];
|
||||
if (!font)
|
||||
throw new Error(`Missing BitmapFont "${this._fontName}"`);
|
||||
this._font !== font && (this.dirty = !0), this.dirty && this.updateText();
|
||||
}
|
||||
/**
|
||||
* The tint of the BitmapText object.
|
||||
* @default 0xffffff
|
||||
*/
|
||||
get tint() {
|
||||
return this._tintColor.value;
|
||||
}
|
||||
set tint(value) {
|
||||
if (this.tint !== value) {
|
||||
this._tintColor.setValue(value);
|
||||
for (let i = 0; i < this._activePagesMeshData.length; i++)
|
||||
this._activePagesMeshData[i].mesh.tint = value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The alignment of the BitmapText object.
|
||||
* @member {string}
|
||||
* @default 'left'
|
||||
*/
|
||||
get align() {
|
||||
return this._align;
|
||||
}
|
||||
set align(value) {
|
||||
this._align !== value && (this._align = value, this.dirty = !0);
|
||||
}
|
||||
/** The name of the BitmapFont. */
|
||||
get fontName() {
|
||||
return this._fontName;
|
||||
}
|
||||
set fontName(value) {
|
||||
if (!BitmapFont.BitmapFont.available[value])
|
||||
throw new Error(`Missing BitmapFont "${value}"`);
|
||||
this._fontName !== value && (this._fontName = value, this.dirty = !0);
|
||||
}
|
||||
/** The size of the font to display. */
|
||||
get fontSize() {
|
||||
return this._fontSize ?? BitmapFont.BitmapFont.available[this._fontName].size;
|
||||
}
|
||||
set fontSize(value) {
|
||||
this._fontSize !== value && (this._fontSize = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The anchor sets the origin point of the text.
|
||||
*
|
||||
* The default is `(0,0)`, this means the text's origin is the top left.
|
||||
*
|
||||
* Setting the anchor to `(0.5,0.5)` means the text's origin is centered.
|
||||
*
|
||||
* Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.
|
||||
*/
|
||||
get anchor() {
|
||||
return this._anchor;
|
||||
}
|
||||
set anchor(value) {
|
||||
typeof value == "number" ? this._anchor.set(value) : this._anchor.copyFrom(value);
|
||||
}
|
||||
/** The text of the BitmapText object. */
|
||||
get text() {
|
||||
return this._text;
|
||||
}
|
||||
set text(text) {
|
||||
text = String(text ?? ""), this._text !== text && (this._text = text, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The max width of this bitmap text in pixels. If the text provided is longer than the
|
||||
* value provided, line breaks will be automatically inserted in the last whitespace.
|
||||
* Disable by setting the value to 0.
|
||||
*/
|
||||
get maxWidth() {
|
||||
return this._maxWidth;
|
||||
}
|
||||
set maxWidth(value) {
|
||||
this._maxWidth !== value && (this._maxWidth = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The max line height. This is useful when trying to use the total height of the Text,
|
||||
* i.e. when trying to vertically align.
|
||||
* @readonly
|
||||
*/
|
||||
get maxLineHeight() {
|
||||
return this.validate(), this._maxLineHeight;
|
||||
}
|
||||
/**
|
||||
* The width of the overall text, different from fontSize,
|
||||
* which is defined in the style object.
|
||||
* @readonly
|
||||
*/
|
||||
get textWidth() {
|
||||
return this.validate(), this._textWidth;
|
||||
}
|
||||
/** Additional space between characters. */
|
||||
get letterSpacing() {
|
||||
return this._letterSpacing;
|
||||
}
|
||||
set letterSpacing(value) {
|
||||
this._letterSpacing !== value && (this._letterSpacing = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
|
||||
* Advantages can include sharper image quality (like text) and faster rendering on canvas.
|
||||
* The main disadvantage is movement of objects may appear less smooth.
|
||||
* To set the global default, change {@link PIXI.settings.ROUND_PIXELS}
|
||||
* @default PIXI.settings.ROUND_PIXELS
|
||||
*/
|
||||
get roundPixels() {
|
||||
return this._roundPixels;
|
||||
}
|
||||
set roundPixels(value) {
|
||||
value !== this._roundPixels && (this._roundPixels = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The height of the overall text, different from fontSize,
|
||||
* which is defined in the style object.
|
||||
* @readonly
|
||||
*/
|
||||
get textHeight() {
|
||||
return this.validate(), this._textHeight;
|
||||
}
|
||||
/**
|
||||
* The resolution / device pixel ratio of the canvas.
|
||||
*
|
||||
* This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
|
||||
* @default 1
|
||||
*/
|
||||
get resolution() {
|
||||
return this._resolution;
|
||||
}
|
||||
set resolution(value) {
|
||||
this._autoResolution = !1, this._resolution !== value && (this._resolution = value, this.dirty = !0);
|
||||
}
|
||||
destroy(options) {
|
||||
const { _textureCache } = this, pageMeshDataPool = BitmapFont.BitmapFont.available[this._fontName].distanceFieldType === "none" ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;
|
||||
pageMeshDataPool.push(...this._activePagesMeshData);
|
||||
for (const pageMeshData of this._activePagesMeshData)
|
||||
this.removeChild(pageMeshData.mesh);
|
||||
this._activePagesMeshData = [], pageMeshDataPool.filter((page) => _textureCache[page.mesh.texture.baseTexture.uid]).forEach((page) => {
|
||||
page.mesh.texture = core.Texture.EMPTY;
|
||||
});
|
||||
for (const id in _textureCache)
|
||||
_textureCache[id].destroy(), delete _textureCache[id];
|
||||
this._font = null, this._tintColor = null, this._textureCache = null, super.destroy(options);
|
||||
}
|
||||
};
|
||||
_BitmapText.styleDefaults = {
|
||||
align: "left",
|
||||
tint: 16777215,
|
||||
maxWidth: 0,
|
||||
letterSpacing: 0
|
||||
};
|
||||
let BitmapText = _BitmapText;
|
||||
exports.BitmapText = BitmapText;
|
||||
//# sourceMappingURL=BitmapText.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
324
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.mjs
generated
vendored
Normal file
324
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.mjs
generated
vendored
Normal file
@@ -0,0 +1,324 @@
|
||||
import { Color, ObservablePoint, settings, Point, Texture, utils, BLEND_MODES, Program } from "@pixi/core";
|
||||
import { Container } from "@pixi/display";
|
||||
import { MeshGeometry, MeshMaterial, Mesh } from "@pixi/mesh";
|
||||
import { BitmapFont } from "./BitmapFont.mjs";
|
||||
import msdfFrag from "./shader/msdf.frag.mjs";
|
||||
import msdfVert from "./shader/msdf.vert.mjs";
|
||||
import "./utils/index.mjs";
|
||||
import { splitTextToCharacters } from "./utils/splitTextToCharacters.mjs";
|
||||
import { extractCharCode } from "./utils/extractCharCode.mjs";
|
||||
const pageMeshDataDefaultPageMeshData = [], pageMeshDataMSDFPageMeshData = [], charRenderDataPool = [], _BitmapText = class _BitmapText2 extends Container {
|
||||
/**
|
||||
* @param text - A string that you would like the text to display.
|
||||
* @param style - The style parameters.
|
||||
* @param {string} style.fontName - The installed BitmapFont name.
|
||||
* @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,
|
||||
*. this will default to the BitmapFont size.
|
||||
* @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center', 'right' or 'justify'),
|
||||
* does not affect single line text.
|
||||
* @param {PIXI.ColorSource} [style.tint=0xFFFFFF] - The tint color.
|
||||
* @param {number} [style.letterSpacing=0] - The amount of spacing between letters.
|
||||
* @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.
|
||||
*/
|
||||
constructor(text, style = {}) {
|
||||
super();
|
||||
const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign(
|
||||
{},
|
||||
_BitmapText2.styleDefaults,
|
||||
style
|
||||
);
|
||||
if (!BitmapFont.available[fontName])
|
||||
throw new Error(`Missing BitmapFont "${fontName}"`);
|
||||
this._activePagesMeshData = [], this._textWidth = 0, this._textHeight = 0, this._align = align, this._tintColor = new Color(tint), this._font = void 0, this._fontName = fontName, this._fontSize = fontSize, this.text = text, this._maxWidth = maxWidth, this._maxLineHeight = 0, this._letterSpacing = letterSpacing, this._anchor = new ObservablePoint(() => {
|
||||
this.dirty = !0;
|
||||
}, this, 0, 0), this._roundPixels = settings.ROUND_PIXELS, this.dirty = !0, this._resolution = settings.RESOLUTION, this._autoResolution = !0, this._textureCache = {};
|
||||
}
|
||||
/** Renders text and updates it when needed. This should only be called if the BitmapFont is regenerated. */
|
||||
updateText() {
|
||||
const data = BitmapFont.available[this._fontName], fontSize = this.fontSize, scale = fontSize / data.size, pos = new Point(), chars = [], lineWidths = [], lineSpaces = [], text = this._text.replace(/(?:\r\n|\r)/g, `
|
||||
`) || " ", charsInput = splitTextToCharacters(text), maxWidth = this._maxWidth * data.size / fontSize, pageMeshDataPool = data.distanceFieldType === "none" ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;
|
||||
let prevCharCode = null, lastLineWidth = 0, maxLineWidth = 0, line = 0, lastBreakPos = -1, lastBreakWidth = 0, spacesRemoved = 0, maxLineHeight = 0, spaceCount = 0;
|
||||
for (let i = 0; i < charsInput.length; i++) {
|
||||
const char = charsInput[i], charCode = extractCharCode(char);
|
||||
if (/(?:\s)/.test(char) && (lastBreakPos = i, lastBreakWidth = lastLineWidth, spaceCount++), char === "\r" || char === `
|
||||
`) {
|
||||
lineWidths.push(lastLineWidth), lineSpaces.push(-1), maxLineWidth = Math.max(maxLineWidth, lastLineWidth), ++line, ++spacesRemoved, pos.x = 0, pos.y += data.lineHeight, prevCharCode = null, spaceCount = 0;
|
||||
continue;
|
||||
}
|
||||
const charData = data.chars[charCode];
|
||||
if (!charData)
|
||||
continue;
|
||||
prevCharCode && charData.kerning[prevCharCode] && (pos.x += charData.kerning[prevCharCode]);
|
||||
const charRenderData = charRenderDataPool.pop() || {
|
||||
texture: Texture.EMPTY,
|
||||
line: 0,
|
||||
charCode: 0,
|
||||
prevSpaces: 0,
|
||||
position: new Point()
|
||||
};
|
||||
charRenderData.texture = charData.texture, charRenderData.line = line, charRenderData.charCode = charCode, charRenderData.position.x = Math.round(pos.x + charData.xOffset + this._letterSpacing / 2), charRenderData.position.y = Math.round(pos.y + charData.yOffset), charRenderData.prevSpaces = spaceCount, chars.push(charRenderData), lastLineWidth = charRenderData.position.x + Math.max(charData.xAdvance - charData.xOffset, charData.texture.orig.width), pos.x += charData.xAdvance + this._letterSpacing, maxLineHeight = Math.max(maxLineHeight, charData.yOffset + charData.texture.height), prevCharCode = charCode, lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth && (++spacesRemoved, utils.removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos), i = lastBreakPos, lastBreakPos = -1, lineWidths.push(lastBreakWidth), lineSpaces.push(chars.length > 0 ? chars[chars.length - 1].prevSpaces : 0), maxLineWidth = Math.max(maxLineWidth, lastBreakWidth), line++, pos.x = 0, pos.y += data.lineHeight, prevCharCode = null, spaceCount = 0);
|
||||
}
|
||||
const lastChar = charsInput[charsInput.length - 1];
|
||||
lastChar !== "\r" && lastChar !== `
|
||||
` && (/(?:\s)/.test(lastChar) && (lastLineWidth = lastBreakWidth), lineWidths.push(lastLineWidth), maxLineWidth = Math.max(maxLineWidth, lastLineWidth), lineSpaces.push(-1));
|
||||
const lineAlignOffsets = [];
|
||||
for (let i = 0; i <= line; i++) {
|
||||
let alignOffset = 0;
|
||||
this._align === "right" ? alignOffset = maxLineWidth - lineWidths[i] : this._align === "center" ? alignOffset = (maxLineWidth - lineWidths[i]) / 2 : this._align === "justify" && (alignOffset = lineSpaces[i] < 0 ? 0 : (maxLineWidth - lineWidths[i]) / lineSpaces[i]), lineAlignOffsets.push(alignOffset);
|
||||
}
|
||||
const lenChars = chars.length, pagesMeshData = {}, newPagesMeshData = [], activePagesMeshData = this._activePagesMeshData;
|
||||
pageMeshDataPool.push(...activePagesMeshData);
|
||||
for (let i = 0; i < lenChars; i++) {
|
||||
const texture = chars[i].texture, baseTextureUid = texture.baseTexture.uid;
|
||||
if (!pagesMeshData[baseTextureUid]) {
|
||||
let pageMeshData = pageMeshDataPool.pop();
|
||||
if (!pageMeshData) {
|
||||
const geometry = new MeshGeometry();
|
||||
let material, meshBlendMode;
|
||||
data.distanceFieldType === "none" ? (material = new MeshMaterial(Texture.EMPTY), meshBlendMode = BLEND_MODES.NORMAL) : (material = new MeshMaterial(
|
||||
Texture.EMPTY,
|
||||
{ program: Program.from(msdfVert, msdfFrag), uniforms: { uFWidth: 0 } }
|
||||
), meshBlendMode = BLEND_MODES.NORMAL_NPM);
|
||||
const mesh = new Mesh(geometry, material);
|
||||
mesh.blendMode = meshBlendMode, pageMeshData = {
|
||||
index: 0,
|
||||
indexCount: 0,
|
||||
vertexCount: 0,
|
||||
uvsCount: 0,
|
||||
total: 0,
|
||||
mesh,
|
||||
vertices: null,
|
||||
uvs: null,
|
||||
indices: null
|
||||
};
|
||||
}
|
||||
pageMeshData.index = 0, pageMeshData.indexCount = 0, pageMeshData.vertexCount = 0, pageMeshData.uvsCount = 0, pageMeshData.total = 0;
|
||||
const { _textureCache } = this;
|
||||
_textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture), pageMeshData.mesh.texture = _textureCache[baseTextureUid], pageMeshData.mesh.tint = this._tintColor.value, newPagesMeshData.push(pageMeshData), pagesMeshData[baseTextureUid] = pageMeshData;
|
||||
}
|
||||
pagesMeshData[baseTextureUid].total++;
|
||||
}
|
||||
for (let i = 0; i < activePagesMeshData.length; i++)
|
||||
newPagesMeshData.includes(activePagesMeshData[i]) || this.removeChild(activePagesMeshData[i].mesh);
|
||||
for (let i = 0; i < newPagesMeshData.length; i++)
|
||||
newPagesMeshData[i].mesh.parent !== this && this.addChild(newPagesMeshData[i].mesh);
|
||||
this._activePagesMeshData = newPagesMeshData;
|
||||
for (const i in pagesMeshData) {
|
||||
const pageMeshData = pagesMeshData[i], total = pageMeshData.total;
|
||||
if (!(pageMeshData.indices?.length > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2)
|
||||
pageMeshData.vertices = new Float32Array(4 * 2 * total), pageMeshData.uvs = new Float32Array(4 * 2 * total), pageMeshData.indices = new Uint16Array(6 * total);
|
||||
else {
|
||||
const total2 = pageMeshData.total, vertices = pageMeshData.vertices;
|
||||
for (let i2 = total2 * 4 * 2; i2 < vertices.length; i2++)
|
||||
vertices[i2] = 0;
|
||||
}
|
||||
pageMeshData.mesh.size = 6 * total;
|
||||
}
|
||||
for (let i = 0; i < lenChars; i++) {
|
||||
const char = chars[i];
|
||||
let offset = char.position.x + lineAlignOffsets[char.line] * (this._align === "justify" ? char.prevSpaces : 1);
|
||||
this._roundPixels && (offset = Math.round(offset));
|
||||
const xPos = offset * scale, yPos = char.position.y * scale, texture = char.texture, pageMesh = pagesMeshData[texture.baseTexture.uid], textureFrame = texture.frame, textureUvs = texture._uvs, index = pageMesh.index++;
|
||||
pageMesh.indices[index * 6 + 0] = 0 + index * 4, pageMesh.indices[index * 6 + 1] = 1 + index * 4, pageMesh.indices[index * 6 + 2] = 2 + index * 4, pageMesh.indices[index * 6 + 3] = 0 + index * 4, pageMesh.indices[index * 6 + 4] = 2 + index * 4, pageMesh.indices[index * 6 + 5] = 3 + index * 4, pageMesh.vertices[index * 8 + 0] = xPos, pageMesh.vertices[index * 8 + 1] = yPos, pageMesh.vertices[index * 8 + 2] = xPos + textureFrame.width * scale, pageMesh.vertices[index * 8 + 3] = yPos, pageMesh.vertices[index * 8 + 4] = xPos + textureFrame.width * scale, pageMesh.vertices[index * 8 + 5] = yPos + textureFrame.height * scale, pageMesh.vertices[index * 8 + 6] = xPos, pageMesh.vertices[index * 8 + 7] = yPos + textureFrame.height * scale, pageMesh.uvs[index * 8 + 0] = textureUvs.x0, pageMesh.uvs[index * 8 + 1] = textureUvs.y0, pageMesh.uvs[index * 8 + 2] = textureUvs.x1, pageMesh.uvs[index * 8 + 3] = textureUvs.y1, pageMesh.uvs[index * 8 + 4] = textureUvs.x2, pageMesh.uvs[index * 8 + 5] = textureUvs.y2, pageMesh.uvs[index * 8 + 6] = textureUvs.x3, pageMesh.uvs[index * 8 + 7] = textureUvs.y3;
|
||||
}
|
||||
this._textWidth = maxLineWidth * scale, this._textHeight = (pos.y + data.lineHeight) * scale;
|
||||
for (const i in pagesMeshData) {
|
||||
const pageMeshData = pagesMeshData[i];
|
||||
if (this.anchor.x !== 0 || this.anchor.y !== 0) {
|
||||
let vertexCount = 0;
|
||||
const anchorOffsetX = this._textWidth * this.anchor.x, anchorOffsetY = this._textHeight * this.anchor.y;
|
||||
for (let i2 = 0; i2 < pageMeshData.total; i2++)
|
||||
pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY, pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY, pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY, pageMeshData.vertices[vertexCount++] -= anchorOffsetX, pageMeshData.vertices[vertexCount++] -= anchorOffsetY;
|
||||
}
|
||||
this._maxLineHeight = maxLineHeight * scale;
|
||||
const vertexBuffer = pageMeshData.mesh.geometry.getBuffer("aVertexPosition"), textureBuffer = pageMeshData.mesh.geometry.getBuffer("aTextureCoord"), indexBuffer = pageMeshData.mesh.geometry.getIndex();
|
||||
vertexBuffer.data = pageMeshData.vertices, textureBuffer.data = pageMeshData.uvs, indexBuffer.data = pageMeshData.indices, vertexBuffer.update(), textureBuffer.update(), indexBuffer.update();
|
||||
}
|
||||
for (let i = 0; i < chars.length; i++)
|
||||
charRenderDataPool.push(chars[i]);
|
||||
this._font = data, this.dirty = !1;
|
||||
}
|
||||
updateTransform() {
|
||||
this.validate(), this.containerUpdateTransform();
|
||||
}
|
||||
_render(renderer) {
|
||||
this._autoResolution && this._resolution !== renderer.resolution && (this._resolution = renderer.resolution, this.dirty = !0);
|
||||
const { distanceFieldRange, distanceFieldType, size } = BitmapFont.available[this._fontName];
|
||||
if (distanceFieldType !== "none") {
|
||||
const { a, b, c, d } = this.worldTransform, dx = Math.sqrt(a * a + b * b), dy = Math.sqrt(c * c + d * d), worldScale = (Math.abs(dx) + Math.abs(dy)) / 2, fontScale = this.fontSize / size, resolution = renderer._view.resolution;
|
||||
for (const mesh of this._activePagesMeshData)
|
||||
mesh.mesh.shader.uniforms.uFWidth = worldScale * distanceFieldRange * fontScale * resolution;
|
||||
}
|
||||
super._render(renderer);
|
||||
}
|
||||
/**
|
||||
* Validates text before calling parent's getLocalBounds
|
||||
* @returns - The rectangular bounding area
|
||||
*/
|
||||
getLocalBounds() {
|
||||
return this.validate(), super.getLocalBounds();
|
||||
}
|
||||
/**
|
||||
* Updates text when needed
|
||||
* @private
|
||||
*/
|
||||
validate() {
|
||||
const font = BitmapFont.available[this._fontName];
|
||||
if (!font)
|
||||
throw new Error(`Missing BitmapFont "${this._fontName}"`);
|
||||
this._font !== font && (this.dirty = !0), this.dirty && this.updateText();
|
||||
}
|
||||
/**
|
||||
* The tint of the BitmapText object.
|
||||
* @default 0xffffff
|
||||
*/
|
||||
get tint() {
|
||||
return this._tintColor.value;
|
||||
}
|
||||
set tint(value) {
|
||||
if (this.tint !== value) {
|
||||
this._tintColor.setValue(value);
|
||||
for (let i = 0; i < this._activePagesMeshData.length; i++)
|
||||
this._activePagesMeshData[i].mesh.tint = value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The alignment of the BitmapText object.
|
||||
* @member {string}
|
||||
* @default 'left'
|
||||
*/
|
||||
get align() {
|
||||
return this._align;
|
||||
}
|
||||
set align(value) {
|
||||
this._align !== value && (this._align = value, this.dirty = !0);
|
||||
}
|
||||
/** The name of the BitmapFont. */
|
||||
get fontName() {
|
||||
return this._fontName;
|
||||
}
|
||||
set fontName(value) {
|
||||
if (!BitmapFont.available[value])
|
||||
throw new Error(`Missing BitmapFont "${value}"`);
|
||||
this._fontName !== value && (this._fontName = value, this.dirty = !0);
|
||||
}
|
||||
/** The size of the font to display. */
|
||||
get fontSize() {
|
||||
return this._fontSize ?? BitmapFont.available[this._fontName].size;
|
||||
}
|
||||
set fontSize(value) {
|
||||
this._fontSize !== value && (this._fontSize = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The anchor sets the origin point of the text.
|
||||
*
|
||||
* The default is `(0,0)`, this means the text's origin is the top left.
|
||||
*
|
||||
* Setting the anchor to `(0.5,0.5)` means the text's origin is centered.
|
||||
*
|
||||
* Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.
|
||||
*/
|
||||
get anchor() {
|
||||
return this._anchor;
|
||||
}
|
||||
set anchor(value) {
|
||||
typeof value == "number" ? this._anchor.set(value) : this._anchor.copyFrom(value);
|
||||
}
|
||||
/** The text of the BitmapText object. */
|
||||
get text() {
|
||||
return this._text;
|
||||
}
|
||||
set text(text) {
|
||||
text = String(text ?? ""), this._text !== text && (this._text = text, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The max width of this bitmap text in pixels. If the text provided is longer than the
|
||||
* value provided, line breaks will be automatically inserted in the last whitespace.
|
||||
* Disable by setting the value to 0.
|
||||
*/
|
||||
get maxWidth() {
|
||||
return this._maxWidth;
|
||||
}
|
||||
set maxWidth(value) {
|
||||
this._maxWidth !== value && (this._maxWidth = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The max line height. This is useful when trying to use the total height of the Text,
|
||||
* i.e. when trying to vertically align.
|
||||
* @readonly
|
||||
*/
|
||||
get maxLineHeight() {
|
||||
return this.validate(), this._maxLineHeight;
|
||||
}
|
||||
/**
|
||||
* The width of the overall text, different from fontSize,
|
||||
* which is defined in the style object.
|
||||
* @readonly
|
||||
*/
|
||||
get textWidth() {
|
||||
return this.validate(), this._textWidth;
|
||||
}
|
||||
/** Additional space between characters. */
|
||||
get letterSpacing() {
|
||||
return this._letterSpacing;
|
||||
}
|
||||
set letterSpacing(value) {
|
||||
this._letterSpacing !== value && (this._letterSpacing = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.
|
||||
* Advantages can include sharper image quality (like text) and faster rendering on canvas.
|
||||
* The main disadvantage is movement of objects may appear less smooth.
|
||||
* To set the global default, change {@link PIXI.settings.ROUND_PIXELS}
|
||||
* @default PIXI.settings.ROUND_PIXELS
|
||||
*/
|
||||
get roundPixels() {
|
||||
return this._roundPixels;
|
||||
}
|
||||
set roundPixels(value) {
|
||||
value !== this._roundPixels && (this._roundPixels = value, this.dirty = !0);
|
||||
}
|
||||
/**
|
||||
* The height of the overall text, different from fontSize,
|
||||
* which is defined in the style object.
|
||||
* @readonly
|
||||
*/
|
||||
get textHeight() {
|
||||
return this.validate(), this._textHeight;
|
||||
}
|
||||
/**
|
||||
* The resolution / device pixel ratio of the canvas.
|
||||
*
|
||||
* This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
|
||||
* @default 1
|
||||
*/
|
||||
get resolution() {
|
||||
return this._resolution;
|
||||
}
|
||||
set resolution(value) {
|
||||
this._autoResolution = !1, this._resolution !== value && (this._resolution = value, this.dirty = !0);
|
||||
}
|
||||
destroy(options) {
|
||||
const { _textureCache } = this, pageMeshDataPool = BitmapFont.available[this._fontName].distanceFieldType === "none" ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;
|
||||
pageMeshDataPool.push(...this._activePagesMeshData);
|
||||
for (const pageMeshData of this._activePagesMeshData)
|
||||
this.removeChild(pageMeshData.mesh);
|
||||
this._activePagesMeshData = [], pageMeshDataPool.filter((page) => _textureCache[page.mesh.texture.baseTexture.uid]).forEach((page) => {
|
||||
page.mesh.texture = Texture.EMPTY;
|
||||
});
|
||||
for (const id in _textureCache)
|
||||
_textureCache[id].destroy(), delete _textureCache[id];
|
||||
this._font = null, this._tintColor = null, this._textureCache = null, super.destroy(options);
|
||||
}
|
||||
};
|
||||
_BitmapText.styleDefaults = {
|
||||
align: "left",
|
||||
tint: 16777215,
|
||||
maxWidth: 0,
|
||||
letterSpacing: 0
|
||||
};
|
||||
let BitmapText = _BitmapText;
|
||||
export {
|
||||
BitmapText
|
||||
};
|
||||
//# sourceMappingURL=BitmapText.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapText.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.js
generated
vendored
Normal file
2
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
//# sourceMappingURL=BitmapTextStyle.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BitmapTextStyle.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
||||
2
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.mjs
generated
vendored
Normal file
2
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
//# sourceMappingURL=BitmapTextStyle.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/BitmapTextStyle.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BitmapTextStyle.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
||||
66
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.js
generated
vendored
Normal file
66
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
var BitmapFontData = require("../BitmapFontData.js");
|
||||
class TextFormat {
|
||||
/**
|
||||
* Check if resource refers to txt font data.
|
||||
* @param data
|
||||
* @returns - True if resource could be treated as font data, false otherwise.
|
||||
*/
|
||||
static test(data) {
|
||||
return typeof data == "string" && data.startsWith("info face=");
|
||||
}
|
||||
/**
|
||||
* Convert text font data to a javascript object.
|
||||
* @param txt - Raw string data to be converted
|
||||
* @returns - Parsed font data
|
||||
*/
|
||||
static parse(txt) {
|
||||
const items = txt.match(/^[a-z]+\s+.+$/gm), rawData = {
|
||||
info: [],
|
||||
common: [],
|
||||
page: [],
|
||||
char: [],
|
||||
chars: [],
|
||||
kerning: [],
|
||||
kernings: [],
|
||||
distanceField: []
|
||||
};
|
||||
for (const i in items) {
|
||||
const name = items[i].match(/^[a-z]+/gm)[0], attributeList = items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm), itemData = {};
|
||||
for (const i2 in attributeList) {
|
||||
const split = attributeList[i2].split("="), key = split[0], strValue = split[1].replace(/"/gm, ""), floatValue = parseFloat(strValue), value = isNaN(floatValue) ? strValue : floatValue;
|
||||
itemData[key] = value;
|
||||
}
|
||||
rawData[name].push(itemData);
|
||||
}
|
||||
const font = new BitmapFontData.BitmapFontData();
|
||||
return rawData.info.forEach((info) => font.info.push({
|
||||
face: info.face,
|
||||
size: parseInt(info.size, 10)
|
||||
})), rawData.common.forEach((common) => font.common.push({
|
||||
lineHeight: parseInt(common.lineHeight, 10)
|
||||
})), rawData.page.forEach((page) => font.page.push({
|
||||
id: parseInt(page.id, 10),
|
||||
file: page.file
|
||||
})), rawData.char.forEach((char) => font.char.push({
|
||||
id: parseInt(char.id, 10),
|
||||
page: parseInt(char.page, 10),
|
||||
x: parseInt(char.x, 10),
|
||||
y: parseInt(char.y, 10),
|
||||
width: parseInt(char.width, 10),
|
||||
height: parseInt(char.height, 10),
|
||||
xoffset: parseInt(char.xoffset, 10),
|
||||
yoffset: parseInt(char.yoffset, 10),
|
||||
xadvance: parseInt(char.xadvance, 10)
|
||||
})), rawData.kerning.forEach((kerning) => font.kerning.push({
|
||||
first: parseInt(kerning.first, 10),
|
||||
second: parseInt(kerning.second, 10),
|
||||
amount: parseInt(kerning.amount, 10)
|
||||
})), rawData.distanceField.forEach((df) => font.distanceField.push({
|
||||
distanceRange: parseInt(df.distanceRange, 10),
|
||||
fieldType: df.fieldType
|
||||
})), font;
|
||||
}
|
||||
}
|
||||
exports.TextFormat = TextFormat;
|
||||
//# sourceMappingURL=TextFormat.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.mjs
generated
vendored
Normal file
67
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.mjs
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import { BitmapFontData } from "../BitmapFontData.mjs";
|
||||
class TextFormat {
|
||||
/**
|
||||
* Check if resource refers to txt font data.
|
||||
* @param data
|
||||
* @returns - True if resource could be treated as font data, false otherwise.
|
||||
*/
|
||||
static test(data) {
|
||||
return typeof data == "string" && data.startsWith("info face=");
|
||||
}
|
||||
/**
|
||||
* Convert text font data to a javascript object.
|
||||
* @param txt - Raw string data to be converted
|
||||
* @returns - Parsed font data
|
||||
*/
|
||||
static parse(txt) {
|
||||
const items = txt.match(/^[a-z]+\s+.+$/gm), rawData = {
|
||||
info: [],
|
||||
common: [],
|
||||
page: [],
|
||||
char: [],
|
||||
chars: [],
|
||||
kerning: [],
|
||||
kernings: [],
|
||||
distanceField: []
|
||||
};
|
||||
for (const i in items) {
|
||||
const name = items[i].match(/^[a-z]+/gm)[0], attributeList = items[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm), itemData = {};
|
||||
for (const i2 in attributeList) {
|
||||
const split = attributeList[i2].split("="), key = split[0], strValue = split[1].replace(/"/gm, ""), floatValue = parseFloat(strValue), value = isNaN(floatValue) ? strValue : floatValue;
|
||||
itemData[key] = value;
|
||||
}
|
||||
rawData[name].push(itemData);
|
||||
}
|
||||
const font = new BitmapFontData();
|
||||
return rawData.info.forEach((info) => font.info.push({
|
||||
face: info.face,
|
||||
size: parseInt(info.size, 10)
|
||||
})), rawData.common.forEach((common) => font.common.push({
|
||||
lineHeight: parseInt(common.lineHeight, 10)
|
||||
})), rawData.page.forEach((page) => font.page.push({
|
||||
id: parseInt(page.id, 10),
|
||||
file: page.file
|
||||
})), rawData.char.forEach((char) => font.char.push({
|
||||
id: parseInt(char.id, 10),
|
||||
page: parseInt(char.page, 10),
|
||||
x: parseInt(char.x, 10),
|
||||
y: parseInt(char.y, 10),
|
||||
width: parseInt(char.width, 10),
|
||||
height: parseInt(char.height, 10),
|
||||
xoffset: parseInt(char.xoffset, 10),
|
||||
yoffset: parseInt(char.yoffset, 10),
|
||||
xadvance: parseInt(char.xadvance, 10)
|
||||
})), rawData.kerning.forEach((kerning) => font.kerning.push({
|
||||
first: parseInt(kerning.first, 10),
|
||||
second: parseInt(kerning.second, 10),
|
||||
amount: parseInt(kerning.amount, 10)
|
||||
})), rawData.distanceField.forEach((df) => font.distanceField.push({
|
||||
distanceRange: parseInt(df.distanceRange, 10),
|
||||
fieldType: df.fieldType
|
||||
})), font;
|
||||
}
|
||||
}
|
||||
export {
|
||||
TextFormat
|
||||
};
|
||||
//# sourceMappingURL=TextFormat.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/TextFormat.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
63
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.js
generated
vendored
Normal file
63
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
var BitmapFontData = require("../BitmapFontData.js");
|
||||
class XMLFormat {
|
||||
/**
|
||||
* Check if resource refers to xml font data.
|
||||
* @param data
|
||||
* @returns - True if resource could be treated as font data, false otherwise.
|
||||
*/
|
||||
static test(data) {
|
||||
const xml = data;
|
||||
return typeof data != "string" && "getElementsByTagName" in data && xml.getElementsByTagName("page").length && xml.getElementsByTagName("info")[0].getAttribute("face") !== null;
|
||||
}
|
||||
/**
|
||||
* Convert the XML into BitmapFontData that we can use.
|
||||
* @param xml
|
||||
* @returns - Data to use for BitmapFont
|
||||
*/
|
||||
static parse(xml) {
|
||||
const data = new BitmapFontData.BitmapFontData(), info = xml.getElementsByTagName("info"), common = xml.getElementsByTagName("common"), page = xml.getElementsByTagName("page"), char = xml.getElementsByTagName("char"), kerning = xml.getElementsByTagName("kerning"), distanceField = xml.getElementsByTagName("distanceField");
|
||||
for (let i = 0; i < info.length; i++)
|
||||
data.info.push({
|
||||
face: info[i].getAttribute("face"),
|
||||
size: parseInt(info[i].getAttribute("size"), 10)
|
||||
});
|
||||
for (let i = 0; i < common.length; i++)
|
||||
data.common.push({
|
||||
lineHeight: parseInt(common[i].getAttribute("lineHeight"), 10)
|
||||
});
|
||||
for (let i = 0; i < page.length; i++)
|
||||
data.page.push({
|
||||
id: parseInt(page[i].getAttribute("id"), 10) || 0,
|
||||
file: page[i].getAttribute("file")
|
||||
});
|
||||
for (let i = 0; i < char.length; i++) {
|
||||
const letter = char[i];
|
||||
data.char.push({
|
||||
id: parseInt(letter.getAttribute("id"), 10),
|
||||
page: parseInt(letter.getAttribute("page"), 10) || 0,
|
||||
x: parseInt(letter.getAttribute("x"), 10),
|
||||
y: parseInt(letter.getAttribute("y"), 10),
|
||||
width: parseInt(letter.getAttribute("width"), 10),
|
||||
height: parseInt(letter.getAttribute("height"), 10),
|
||||
xoffset: parseInt(letter.getAttribute("xoffset"), 10),
|
||||
yoffset: parseInt(letter.getAttribute("yoffset"), 10),
|
||||
xadvance: parseInt(letter.getAttribute("xadvance"), 10)
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < kerning.length; i++)
|
||||
data.kerning.push({
|
||||
first: parseInt(kerning[i].getAttribute("first"), 10),
|
||||
second: parseInt(kerning[i].getAttribute("second"), 10),
|
||||
amount: parseInt(kerning[i].getAttribute("amount"), 10)
|
||||
});
|
||||
for (let i = 0; i < distanceField.length; i++)
|
||||
data.distanceField.push({
|
||||
fieldType: distanceField[i].getAttribute("fieldType"),
|
||||
distanceRange: parseInt(distanceField[i].getAttribute("distanceRange"), 10)
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
||||
exports.XMLFormat = XMLFormat;
|
||||
//# sourceMappingURL=XMLFormat.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
64
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.mjs
generated
vendored
Normal file
64
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.mjs
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import { BitmapFontData } from "../BitmapFontData.mjs";
|
||||
class XMLFormat {
|
||||
/**
|
||||
* Check if resource refers to xml font data.
|
||||
* @param data
|
||||
* @returns - True if resource could be treated as font data, false otherwise.
|
||||
*/
|
||||
static test(data) {
|
||||
const xml = data;
|
||||
return typeof data != "string" && "getElementsByTagName" in data && xml.getElementsByTagName("page").length && xml.getElementsByTagName("info")[0].getAttribute("face") !== null;
|
||||
}
|
||||
/**
|
||||
* Convert the XML into BitmapFontData that we can use.
|
||||
* @param xml
|
||||
* @returns - Data to use for BitmapFont
|
||||
*/
|
||||
static parse(xml) {
|
||||
const data = new BitmapFontData(), info = xml.getElementsByTagName("info"), common = xml.getElementsByTagName("common"), page = xml.getElementsByTagName("page"), char = xml.getElementsByTagName("char"), kerning = xml.getElementsByTagName("kerning"), distanceField = xml.getElementsByTagName("distanceField");
|
||||
for (let i = 0; i < info.length; i++)
|
||||
data.info.push({
|
||||
face: info[i].getAttribute("face"),
|
||||
size: parseInt(info[i].getAttribute("size"), 10)
|
||||
});
|
||||
for (let i = 0; i < common.length; i++)
|
||||
data.common.push({
|
||||
lineHeight: parseInt(common[i].getAttribute("lineHeight"), 10)
|
||||
});
|
||||
for (let i = 0; i < page.length; i++)
|
||||
data.page.push({
|
||||
id: parseInt(page[i].getAttribute("id"), 10) || 0,
|
||||
file: page[i].getAttribute("file")
|
||||
});
|
||||
for (let i = 0; i < char.length; i++) {
|
||||
const letter = char[i];
|
||||
data.char.push({
|
||||
id: parseInt(letter.getAttribute("id"), 10),
|
||||
page: parseInt(letter.getAttribute("page"), 10) || 0,
|
||||
x: parseInt(letter.getAttribute("x"), 10),
|
||||
y: parseInt(letter.getAttribute("y"), 10),
|
||||
width: parseInt(letter.getAttribute("width"), 10),
|
||||
height: parseInt(letter.getAttribute("height"), 10),
|
||||
xoffset: parseInt(letter.getAttribute("xoffset"), 10),
|
||||
yoffset: parseInt(letter.getAttribute("yoffset"), 10),
|
||||
xadvance: parseInt(letter.getAttribute("xadvance"), 10)
|
||||
});
|
||||
}
|
||||
for (let i = 0; i < kerning.length; i++)
|
||||
data.kerning.push({
|
||||
first: parseInt(kerning[i].getAttribute("first"), 10),
|
||||
second: parseInt(kerning[i].getAttribute("second"), 10),
|
||||
amount: parseInt(kerning[i].getAttribute("amount"), 10)
|
||||
});
|
||||
for (let i = 0; i < distanceField.length; i++)
|
||||
data.distanceField.push({
|
||||
fieldType: distanceField[i].getAttribute("fieldType"),
|
||||
distanceRange: parseInt(distanceField[i].getAttribute("distanceRange"), 10)
|
||||
});
|
||||
return data;
|
||||
}
|
||||
}
|
||||
export {
|
||||
XMLFormat
|
||||
};
|
||||
//# sourceMappingURL=XMLFormat.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLFormat.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.js
generated
vendored
Normal file
22
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
var core = require("@pixi/core"), XMLFormat = require("./XMLFormat.js");
|
||||
class XMLStringFormat {
|
||||
/**
|
||||
* Check if resource refers to text xml font data.
|
||||
* @param data
|
||||
* @returns - True if resource could be treated as font data, false otherwise.
|
||||
*/
|
||||
static test(data) {
|
||||
return typeof data == "string" && data.includes("<font>") ? XMLFormat.XMLFormat.test(core.settings.ADAPTER.parseXML(data)) : !1;
|
||||
}
|
||||
/**
|
||||
* Convert the text XML into BitmapFontData that we can use.
|
||||
* @param xmlTxt
|
||||
* @returns - Data to use for BitmapFont
|
||||
*/
|
||||
static parse(xmlTxt) {
|
||||
return XMLFormat.XMLFormat.parse(core.settings.ADAPTER.parseXML(xmlTxt));
|
||||
}
|
||||
}
|
||||
exports.XMLStringFormat = XMLStringFormat;
|
||||
//# sourceMappingURL=XMLStringFormat.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"XMLStringFormat.js","sources":["../../src/formats/XMLStringFormat.ts"],"sourcesContent":["import { settings } from '@pixi/core';\nimport { XMLFormat } from './XMLFormat';\n\nimport type { BitmapFontData } from '../BitmapFontData';\n\n/**\n * BitmapFont format that's XML-based.\n * @private\n */\nexport class XMLStringFormat\n{\n /**\n * Check if resource refers to text xml font data.\n * @param data\n * @returns - True if resource could be treated as font data, false otherwise.\n */\n static test(data: string | XMLDocument | BitmapFontData): boolean\n {\n if (typeof data === 'string' && data.includes('<font>'))\n {\n return XMLFormat.test(settings.ADAPTER.parseXML(data));\n }\n\n return false;\n }\n\n /**\n * Convert the text XML into BitmapFontData that we can use.\n * @param xmlTxt\n * @returns - Data to use for BitmapFont\n */\n static parse(xmlTxt: string): BitmapFontData\n {\n return XMLFormat.parse(settings.ADAPTER.parseXML(xmlTxt));\n }\n}\n"],"names":["XMLFormat","settings"],"mappings":";;AASO,MAAM,gBACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,OAAO,KAAK,MACZ;AACI,WAAI,OAAO,QAAS,YAAY,KAAK,SAAS,QAAQ,IAE3CA,UAAAA,UAAU,KAAKC,KAAAA,SAAS,QAAQ,SAAS,IAAI,CAAC,IAGlD;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,MAAM,QACb;AACI,WAAOD,UAAAA,UAAU,MAAMC,KAAA,SAAS,QAAQ,SAAS,MAAM,CAAC;AAAA,EAC5D;AACJ;;"}
|
||||
24
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.mjs
generated
vendored
Normal file
24
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.mjs
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { settings } from "@pixi/core";
|
||||
import { XMLFormat } from "./XMLFormat.mjs";
|
||||
class XMLStringFormat {
|
||||
/**
|
||||
* Check if resource refers to text xml font data.
|
||||
* @param data
|
||||
* @returns - True if resource could be treated as font data, false otherwise.
|
||||
*/
|
||||
static test(data) {
|
||||
return typeof data == "string" && data.includes("<font>") ? XMLFormat.test(settings.ADAPTER.parseXML(data)) : !1;
|
||||
}
|
||||
/**
|
||||
* Convert the text XML into BitmapFontData that we can use.
|
||||
* @param xmlTxt
|
||||
* @returns - Data to use for BitmapFont
|
||||
*/
|
||||
static parse(xmlTxt) {
|
||||
return XMLFormat.parse(settings.ADAPTER.parseXML(xmlTxt));
|
||||
}
|
||||
}
|
||||
export {
|
||||
XMLStringFormat
|
||||
};
|
||||
//# sourceMappingURL=XMLStringFormat.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/XMLStringFormat.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"XMLStringFormat.mjs","sources":["../../src/formats/XMLStringFormat.ts"],"sourcesContent":["import { settings } from '@pixi/core';\nimport { XMLFormat } from './XMLFormat';\n\nimport type { BitmapFontData } from '../BitmapFontData';\n\n/**\n * BitmapFont format that's XML-based.\n * @private\n */\nexport class XMLStringFormat\n{\n /**\n * Check if resource refers to text xml font data.\n * @param data\n * @returns - True if resource could be treated as font data, false otherwise.\n */\n static test(data: string | XMLDocument | BitmapFontData): boolean\n {\n if (typeof data === 'string' && data.includes('<font>'))\n {\n return XMLFormat.test(settings.ADAPTER.parseXML(data));\n }\n\n return false;\n }\n\n /**\n * Convert the text XML into BitmapFontData that we can use.\n * @param xmlTxt\n * @returns - Data to use for BitmapFont\n */\n static parse(xmlTxt: string): BitmapFontData\n {\n return XMLFormat.parse(settings.ADAPTER.parseXML(xmlTxt));\n }\n}\n"],"names":[],"mappings":";;AASO,MAAM,gBACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,OAAO,KAAK,MACZ;AACI,WAAI,OAAO,QAAS,YAAY,KAAK,SAAS,QAAQ,IAE3C,UAAU,KAAK,SAAS,QAAQ,SAAS,IAAI,CAAC,IAGlD;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,MAAM,QACb;AACI,WAAO,UAAU,MAAM,SAAS,QAAQ,SAAS,MAAM,CAAC;AAAA,EAC5D;AACJ;"}
|
||||
18
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.js
generated
vendored
Normal file
18
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var TextFormat = require("./TextFormat.js"), XMLFormat = require("./XMLFormat.js"), XMLStringFormat = require("./XMLStringFormat.js");
|
||||
const formats = [
|
||||
TextFormat.TextFormat,
|
||||
XMLFormat.XMLFormat,
|
||||
XMLStringFormat.XMLStringFormat
|
||||
];
|
||||
function autoDetectFormat(data) {
|
||||
for (let i = 0; i < formats.length; i++)
|
||||
if (formats[i].test(data))
|
||||
return formats[i];
|
||||
return null;
|
||||
}
|
||||
exports.TextFormat = TextFormat.TextFormat;
|
||||
exports.XMLFormat = XMLFormat.XMLFormat;
|
||||
exports.XMLStringFormat = XMLStringFormat.XMLStringFormat;
|
||||
exports.autoDetectFormat = autoDetectFormat;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../src/formats/index.ts"],"sourcesContent":["import { TextFormat } from './TextFormat';\nimport { XMLFormat } from './XMLFormat';\nimport { XMLStringFormat } from './XMLStringFormat';\n\nimport type { BitmapFontData } from '../BitmapFontData';\n\n// Registered formats, maybe make this extensible in the future?\nconst formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat,\n] as const;\n\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @returns {any} Format or null\n */\nexport function autoDetectFormat(data: string | XMLDocument | BitmapFontData): typeof formats[number] | null\n{\n for (let i = 0; i < formats.length; i++)\n {\n if (formats[i].test(data))\n {\n return formats[i];\n }\n }\n\n return null;\n}\n\nexport type { IBitmapFontRawData } from './TextFormat';\nexport { TextFormat, XMLFormat, XMLStringFormat };\n"],"names":["TextFormat","XMLFormat","XMLStringFormat"],"mappings":";;AAOA,MAAM,UAAU;AAAA,EACZA,WAAA;AAAA,EACAC,UAAA;AAAA,EACAC,gBAAA;AACJ;AAQO,SAAS,iBAAiB,MACjC;AACI,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ;AAEhC,QAAI,QAAQ,CAAC,EAAE,KAAK,IAAI;AAEpB,aAAO,QAAQ,CAAC;AAIjB,SAAA;AACX;;;;;"}
|
||||
21
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.mjs
generated
vendored
Normal file
21
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { TextFormat } from "./TextFormat.mjs";
|
||||
import { XMLFormat } from "./XMLFormat.mjs";
|
||||
import { XMLStringFormat } from "./XMLStringFormat.mjs";
|
||||
const formats = [
|
||||
TextFormat,
|
||||
XMLFormat,
|
||||
XMLStringFormat
|
||||
];
|
||||
function autoDetectFormat(data) {
|
||||
for (let i = 0; i < formats.length; i++)
|
||||
if (formats[i].test(data))
|
||||
return formats[i];
|
||||
return null;
|
||||
}
|
||||
export {
|
||||
TextFormat,
|
||||
XMLFormat,
|
||||
XMLStringFormat,
|
||||
autoDetectFormat
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/formats/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../../src/formats/index.ts"],"sourcesContent":["import { TextFormat } from './TextFormat';\nimport { XMLFormat } from './XMLFormat';\nimport { XMLStringFormat } from './XMLStringFormat';\n\nimport type { BitmapFontData } from '../BitmapFontData';\n\n// Registered formats, maybe make this extensible in the future?\nconst formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat,\n] as const;\n\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @returns {any} Format or null\n */\nexport function autoDetectFormat(data: string | XMLDocument | BitmapFontData): typeof formats[number] | null\n{\n for (let i = 0; i < formats.length; i++)\n {\n if (formats[i].test(data))\n {\n return formats[i];\n }\n }\n\n return null;\n}\n\nexport type { IBitmapFontRawData } from './TextFormat';\nexport { TextFormat, XMLFormat, XMLStringFormat };\n"],"names":[],"mappings":";;;AAOA,MAAM,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACJ;AAQO,SAAS,iBAAiB,MACjC;AACI,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ;AAEhC,QAAI,QAAQ,CAAC,EAAE,KAAK,IAAI;AAEpB,aAAO,QAAQ,CAAC;AAIjB,SAAA;AACX;"}
|
||||
13
resources/app/node_modules/@pixi/text-bitmap/lib/index.js
generated
vendored
Normal file
13
resources/app/node_modules/@pixi/text-bitmap/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
var BitmapFont = require("./BitmapFont.js"), BitmapFontData = require("./BitmapFontData.js"), BitmapText = require("./BitmapText.js");
|
||||
require("./BitmapTextStyle.js");
|
||||
var index = require("./formats/index.js"), loadBitmapFont = require("./loadBitmapFont.js"), TextFormat = require("./formats/TextFormat.js"), XMLFormat = require("./formats/XMLFormat.js"), XMLStringFormat = require("./formats/XMLStringFormat.js");
|
||||
exports.BitmapFont = BitmapFont.BitmapFont;
|
||||
exports.BitmapFontData = BitmapFontData.BitmapFontData;
|
||||
exports.BitmapText = BitmapText.BitmapText;
|
||||
exports.autoDetectFormat = index.autoDetectFormat;
|
||||
exports.loadBitmapFont = loadBitmapFont.loadBitmapFont;
|
||||
exports.TextFormat = TextFormat.TextFormat;
|
||||
exports.XMLFormat = XMLFormat.XMLFormat;
|
||||
exports.XMLStringFormat = XMLStringFormat.XMLStringFormat;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/index.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
||||
20
resources/app/node_modules/@pixi/text-bitmap/lib/index.mjs
generated
vendored
Normal file
20
resources/app/node_modules/@pixi/text-bitmap/lib/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import { BitmapFont } from "./BitmapFont.mjs";
|
||||
import { BitmapFontData } from "./BitmapFontData.mjs";
|
||||
import { BitmapText } from "./BitmapText.mjs";
|
||||
import "./BitmapTextStyle.mjs";
|
||||
import { autoDetectFormat } from "./formats/index.mjs";
|
||||
import { loadBitmapFont } from "./loadBitmapFont.mjs";
|
||||
import { TextFormat } from "./formats/TextFormat.mjs";
|
||||
import { XMLFormat } from "./formats/XMLFormat.mjs";
|
||||
import { XMLStringFormat } from "./formats/XMLStringFormat.mjs";
|
||||
export {
|
||||
BitmapFont,
|
||||
BitmapFontData,
|
||||
BitmapText,
|
||||
TextFormat,
|
||||
XMLFormat,
|
||||
XMLStringFormat,
|
||||
autoDetectFormat,
|
||||
loadBitmapFont
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/index.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
||||
36
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.js
generated
vendored
Normal file
36
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
var assets = require("@pixi/assets"), core = require("@pixi/core"), BitmapFont = require("./BitmapFont.js");
|
||||
require("./formats/index.js");
|
||||
var TextFormat = require("./formats/TextFormat.js"), XMLStringFormat = require("./formats/XMLStringFormat.js");
|
||||
const validExtensions = [".xml", ".fnt"], loadBitmapFont = {
|
||||
extension: {
|
||||
type: core.ExtensionType.LoadParser,
|
||||
priority: assets.LoaderParserPriority.Normal
|
||||
},
|
||||
name: "loadBitmapFont",
|
||||
test(url) {
|
||||
return validExtensions.includes(core.utils.path.extname(url).toLowerCase());
|
||||
},
|
||||
async testParse(data) {
|
||||
return TextFormat.TextFormat.test(data) || XMLStringFormat.XMLStringFormat.test(data);
|
||||
},
|
||||
async parse(asset, data, loader) {
|
||||
const fontData = TextFormat.TextFormat.test(asset) ? TextFormat.TextFormat.parse(asset) : XMLStringFormat.XMLStringFormat.parse(asset), { src } = data, { page: pages } = fontData, textureUrls = [];
|
||||
for (let i = 0; i < pages.length; ++i) {
|
||||
const pageFile = pages[i].file;
|
||||
let imagePath = core.utils.path.join(core.utils.path.dirname(src), pageFile);
|
||||
imagePath = assets.copySearchParams(imagePath, src), textureUrls.push(imagePath);
|
||||
}
|
||||
const loadedTextures = await loader.load(textureUrls), textures = textureUrls.map((url) => loadedTextures[url]);
|
||||
return BitmapFont.BitmapFont.install(fontData, textures, !0);
|
||||
},
|
||||
async load(url, _options) {
|
||||
return (await core.settings.ADAPTER.fetch(url)).text();
|
||||
},
|
||||
unload(bitmapFont) {
|
||||
bitmapFont.destroy();
|
||||
}
|
||||
};
|
||||
core.extensions.add(loadBitmapFont);
|
||||
exports.loadBitmapFont = loadBitmapFont;
|
||||
//# sourceMappingURL=loadBitmapFont.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadBitmapFont.js","sources":["../src/loadBitmapFont.ts"],"sourcesContent":["import { copySearchParams, LoaderParserPriority } from '@pixi/assets';\nimport { extensions, ExtensionType, settings, utils } from '@pixi/core';\nimport { BitmapFont } from './BitmapFont';\nimport { TextFormat, XMLStringFormat } from './formats';\n\nimport type { Loader, LoaderParser, ResolvedAsset } from '@pixi/assets';\nimport type { Texture } from '@pixi/core';\nimport type { BitmapFontData } from './BitmapFontData';\n\nconst validExtensions = ['.xml', '.fnt'];\n\n/** simple loader plugin for loading in bitmap fonts! */\nexport const loadBitmapFont = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Normal,\n },\n\n name: 'loadBitmapFont',\n\n test(url: string): boolean\n {\n return validExtensions.includes(utils.path.extname(url).toLowerCase());\n },\n\n async testParse(data: string): Promise<boolean>\n {\n return TextFormat.test(data) || XMLStringFormat.test(data);\n },\n\n async parse(asset: string, data: ResolvedAsset, loader: Loader): Promise<BitmapFont>\n {\n const fontData: BitmapFontData = TextFormat.test(asset)\n ? TextFormat.parse(asset)\n : XMLStringFormat.parse(asset);\n\n const { src } = data;\n const { page: pages } = fontData;\n const textureUrls = [];\n\n for (let i = 0; i < pages.length; ++i)\n {\n const pageFile = pages[i].file;\n let imagePath = utils.path.join(utils.path.dirname(src), pageFile);\n\n imagePath = copySearchParams(imagePath, src);\n\n textureUrls.push(imagePath);\n }\n\n const loadedTextures = await loader.load<Texture>(textureUrls);\n const textures = textureUrls.map((url) => loadedTextures[url]);\n\n return BitmapFont.install(fontData, textures, true);\n },\n\n async load(url: string, _options: ResolvedAsset): Promise<string>\n {\n const response = await settings.ADAPTER.fetch(url);\n\n return response.text();\n },\n\n unload(bitmapFont: BitmapFont): void\n {\n bitmapFont.destroy();\n }\n} as LoaderParser<BitmapFont | string>;\n\nextensions.add(loadBitmapFont);\n"],"names":["ExtensionType","LoaderParserPriority","utils","TextFormat","XMLStringFormat","copySearchParams","BitmapFont","settings","extensions"],"mappings":";;;;AASA,MAAM,kBAAkB,CAAC,QAAQ,MAAM,GAG1B,iBAAiB;AAAA,EAC1B,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAUC,OAAqB,qBAAA;AAAA,EACnC;AAAA,EAEA,MAAM;AAAA,EAEN,KAAK,KACL;AACW,WAAA,gBAAgB,SAASC,WAAM,KAAK,QAAQ,GAAG,EAAE,aAAa;AAAA,EACzE;AAAA,EAEA,MAAM,UAAU,MAChB;AACI,WAAOC,WAAAA,WAAW,KAAK,IAAI,KAAKC,gBAAAA,gBAAgB,KAAK,IAAI;AAAA,EAC7D;AAAA,EAEA,MAAM,MAAM,OAAe,MAAqB,QAChD;AACU,UAAA,WAA2BD,sBAAW,KAAK,KAAK,IAChDA,WAAAA,WAAW,MAAM,KAAK,IACtBC,gCAAgB,MAAM,KAAK,GAE3B,EAAE,IAAI,IAAI,MACV,EAAE,MAAM,UAAU,UAClB,cAAc;AAEpB,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,EAAE,GACpC;AACU,YAAA,WAAW,MAAM,CAAC,EAAE;AACtB,UAAA,YAAYF,KAAAA,MAAM,KAAK,KAAKA,KAAAA,MAAM,KAAK,QAAQ,GAAG,GAAG,QAAQ;AAEjE,kBAAYG,wBAAiB,WAAW,GAAG,GAE3C,YAAY,KAAK,SAAS;AAAA,IAC9B;AAEA,UAAM,iBAAiB,MAAM,OAAO,KAAc,WAAW,GACvD,WAAW,YAAY,IAAI,CAAC,QAAQ,eAAe,GAAG,CAAC;AAE7D,WAAOC,WAAAA,WAAW,QAAQ,UAAU,UAAU,EAAI;AAAA,EACtD;AAAA,EAEA,MAAM,KAAK,KAAa,UACxB;AAGI,YAFiB,MAAMC,KAAAA,SAAS,QAAQ,MAAM,GAAG,GAEjC;EACpB;AAAA,EAEA,OAAO,YACP;AACI,eAAW,QAAQ;AAAA,EACvB;AACJ;AAEAC,KAAAA,WAAW,IAAI,cAAc;;"}
|
||||
40
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.mjs
generated
vendored
Normal file
40
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.mjs
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { LoaderParserPriority, copySearchParams } from "@pixi/assets";
|
||||
import { ExtensionType, utils, settings, extensions } from "@pixi/core";
|
||||
import { BitmapFont } from "./BitmapFont.mjs";
|
||||
import "./formats/index.mjs";
|
||||
import { TextFormat } from "./formats/TextFormat.mjs";
|
||||
import { XMLStringFormat } from "./formats/XMLStringFormat.mjs";
|
||||
const validExtensions = [".xml", ".fnt"], loadBitmapFont = {
|
||||
extension: {
|
||||
type: ExtensionType.LoadParser,
|
||||
priority: LoaderParserPriority.Normal
|
||||
},
|
||||
name: "loadBitmapFont",
|
||||
test(url) {
|
||||
return validExtensions.includes(utils.path.extname(url).toLowerCase());
|
||||
},
|
||||
async testParse(data) {
|
||||
return TextFormat.test(data) || XMLStringFormat.test(data);
|
||||
},
|
||||
async parse(asset, data, loader) {
|
||||
const fontData = TextFormat.test(asset) ? TextFormat.parse(asset) : XMLStringFormat.parse(asset), { src } = data, { page: pages } = fontData, textureUrls = [];
|
||||
for (let i = 0; i < pages.length; ++i) {
|
||||
const pageFile = pages[i].file;
|
||||
let imagePath = utils.path.join(utils.path.dirname(src), pageFile);
|
||||
imagePath = copySearchParams(imagePath, src), textureUrls.push(imagePath);
|
||||
}
|
||||
const loadedTextures = await loader.load(textureUrls), textures = textureUrls.map((url) => loadedTextures[url]);
|
||||
return BitmapFont.install(fontData, textures, !0);
|
||||
},
|
||||
async load(url, _options) {
|
||||
return (await settings.ADAPTER.fetch(url)).text();
|
||||
},
|
||||
unload(bitmapFont) {
|
||||
bitmapFont.destroy();
|
||||
}
|
||||
};
|
||||
extensions.add(loadBitmapFont);
|
||||
export {
|
||||
loadBitmapFont
|
||||
};
|
||||
//# sourceMappingURL=loadBitmapFont.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/loadBitmapFont.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadBitmapFont.mjs","sources":["../src/loadBitmapFont.ts"],"sourcesContent":["import { copySearchParams, LoaderParserPriority } from '@pixi/assets';\nimport { extensions, ExtensionType, settings, utils } from '@pixi/core';\nimport { BitmapFont } from './BitmapFont';\nimport { TextFormat, XMLStringFormat } from './formats';\n\nimport type { Loader, LoaderParser, ResolvedAsset } from '@pixi/assets';\nimport type { Texture } from '@pixi/core';\nimport type { BitmapFontData } from './BitmapFontData';\n\nconst validExtensions = ['.xml', '.fnt'];\n\n/** simple loader plugin for loading in bitmap fonts! */\nexport const loadBitmapFont = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.Normal,\n },\n\n name: 'loadBitmapFont',\n\n test(url: string): boolean\n {\n return validExtensions.includes(utils.path.extname(url).toLowerCase());\n },\n\n async testParse(data: string): Promise<boolean>\n {\n return TextFormat.test(data) || XMLStringFormat.test(data);\n },\n\n async parse(asset: string, data: ResolvedAsset, loader: Loader): Promise<BitmapFont>\n {\n const fontData: BitmapFontData = TextFormat.test(asset)\n ? TextFormat.parse(asset)\n : XMLStringFormat.parse(asset);\n\n const { src } = data;\n const { page: pages } = fontData;\n const textureUrls = [];\n\n for (let i = 0; i < pages.length; ++i)\n {\n const pageFile = pages[i].file;\n let imagePath = utils.path.join(utils.path.dirname(src), pageFile);\n\n imagePath = copySearchParams(imagePath, src);\n\n textureUrls.push(imagePath);\n }\n\n const loadedTextures = await loader.load<Texture>(textureUrls);\n const textures = textureUrls.map((url) => loadedTextures[url]);\n\n return BitmapFont.install(fontData, textures, true);\n },\n\n async load(url: string, _options: ResolvedAsset): Promise<string>\n {\n const response = await settings.ADAPTER.fetch(url);\n\n return response.text();\n },\n\n unload(bitmapFont: BitmapFont): void\n {\n bitmapFont.destroy();\n }\n} as LoaderParser<BitmapFont | string>;\n\nextensions.add(loadBitmapFont);\n"],"names":[],"mappings":";;;;;;AASA,MAAM,kBAAkB,CAAC,QAAQ,MAAM,GAG1B,iBAAiB;AAAA,EAC1B,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU,qBAAqB;AAAA,EACnC;AAAA,EAEA,MAAM;AAAA,EAEN,KAAK,KACL;AACW,WAAA,gBAAgB,SAAS,MAAM,KAAK,QAAQ,GAAG,EAAE,aAAa;AAAA,EACzE;AAAA,EAEA,MAAM,UAAU,MAChB;AACI,WAAO,WAAW,KAAK,IAAI,KAAK,gBAAgB,KAAK,IAAI;AAAA,EAC7D;AAAA,EAEA,MAAM,MAAM,OAAe,MAAqB,QAChD;AACU,UAAA,WAA2B,WAAW,KAAK,KAAK,IAChD,WAAW,MAAM,KAAK,IACtB,gBAAgB,MAAM,KAAK,GAE3B,EAAE,IAAI,IAAI,MACV,EAAE,MAAM,UAAU,UAClB,cAAc;AAEpB,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,EAAE,GACpC;AACU,YAAA,WAAW,MAAM,CAAC,EAAE;AACtB,UAAA,YAAY,MAAM,KAAK,KAAK,MAAM,KAAK,QAAQ,GAAG,GAAG,QAAQ;AAEjE,kBAAY,iBAAiB,WAAW,GAAG,GAE3C,YAAY,KAAK,SAAS;AAAA,IAC9B;AAEA,UAAM,iBAAiB,MAAM,OAAO,KAAc,WAAW,GACvD,WAAW,YAAY,IAAI,CAAC,QAAQ,eAAe,GAAG,CAAC;AAE7D,WAAO,WAAW,QAAQ,UAAU,UAAU,EAAI;AAAA,EACtD;AAAA,EAEA,MAAM,KAAK,KAAa,UACxB;AAGI,YAFiB,MAAM,SAAS,QAAQ,MAAM,GAAG,GAEjC;EACpB;AAAA,EAEA,OAAO,YACP;AACI,eAAW,QAAQ;AAAA,EACvB;AACJ;AAEA,WAAW,IAAI,cAAc;"}
|
||||
43
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.js
generated
vendored
Normal file
43
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: !0 });
|
||||
var msdfFrag = `// Pixi texture info\r
|
||||
varying vec2 vTextureCoord;\r
|
||||
uniform sampler2D uSampler;\r
|
||||
\r
|
||||
// Tint\r
|
||||
uniform vec4 uColor;\r
|
||||
\r
|
||||
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
|
||||
uniform float uFWidth;\r
|
||||
\r
|
||||
void main(void) {\r
|
||||
\r
|
||||
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
|
||||
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
|
||||
\r
|
||||
// MSDF\r
|
||||
float median = texColor.r + texColor.g + texColor.b -\r
|
||||
min(texColor.r, min(texColor.g, texColor.b)) -\r
|
||||
max(texColor.r, max(texColor.g, texColor.b));\r
|
||||
// SDF\r
|
||||
median = min(median, texColor.a);\r
|
||||
\r
|
||||
float screenPxDistance = uFWidth * (median - 0.5);\r
|
||||
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
|
||||
if (median < 0.01) {\r
|
||||
alpha = 0.0;\r
|
||||
} else if (median > 0.99) {\r
|
||||
alpha = 1.0;\r
|
||||
}\r
|
||||
\r
|
||||
// Gamma correction for coverage-like alpha\r
|
||||
float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
|
||||
float gamma = mix(1.0, 1.0 / 2.2, luma);\r
|
||||
float coverage = pow(uColor.a * alpha, gamma); \r
|
||||
\r
|
||||
// NPM Textures, NPM outputs\r
|
||||
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
||||
}\r
|
||||
`;
|
||||
exports.default = msdfFrag;
|
||||
//# sourceMappingURL=msdf.frag.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"msdf.frag.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
43
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.mjs
generated
vendored
Normal file
43
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.mjs
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
var msdfFrag = `// Pixi texture info\r
|
||||
varying vec2 vTextureCoord;\r
|
||||
uniform sampler2D uSampler;\r
|
||||
\r
|
||||
// Tint\r
|
||||
uniform vec4 uColor;\r
|
||||
\r
|
||||
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
|
||||
uniform float uFWidth;\r
|
||||
\r
|
||||
void main(void) {\r
|
||||
\r
|
||||
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
|
||||
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
|
||||
\r
|
||||
// MSDF\r
|
||||
float median = texColor.r + texColor.g + texColor.b -\r
|
||||
min(texColor.r, min(texColor.g, texColor.b)) -\r
|
||||
max(texColor.r, max(texColor.g, texColor.b));\r
|
||||
// SDF\r
|
||||
median = min(median, texColor.a);\r
|
||||
\r
|
||||
float screenPxDistance = uFWidth * (median - 0.5);\r
|
||||
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
|
||||
if (median < 0.01) {\r
|
||||
alpha = 0.0;\r
|
||||
} else if (median > 0.99) {\r
|
||||
alpha = 1.0;\r
|
||||
}\r
|
||||
\r
|
||||
// Gamma correction for coverage-like alpha\r
|
||||
float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
|
||||
float gamma = mix(1.0, 1.0 / 2.2, luma);\r
|
||||
float coverage = pow(uColor.a * alpha, gamma); \r
|
||||
\r
|
||||
// NPM Textures, NPM outputs\r
|
||||
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
||||
}\r
|
||||
`;
|
||||
export {
|
||||
msdfFrag as default
|
||||
};
|
||||
//# sourceMappingURL=msdf.frag.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.frag.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"msdf.frag.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
21
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.js
generated
vendored
Normal file
21
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: !0 });
|
||||
var msdfVert = `// Mesh material default fragment\r
|
||||
attribute vec2 aVertexPosition;\r
|
||||
attribute vec2 aTextureCoord;\r
|
||||
\r
|
||||
uniform mat3 projectionMatrix;\r
|
||||
uniform mat3 translationMatrix;\r
|
||||
uniform mat3 uTextureMatrix;\r
|
||||
\r
|
||||
varying vec2 vTextureCoord;\r
|
||||
\r
|
||||
void main(void)\r
|
||||
{\r
|
||||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
||||
\r
|
||||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
||||
}\r
|
||||
`;
|
||||
exports.default = msdfVert;
|
||||
//# sourceMappingURL=msdf.vert.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"msdf.vert.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
||||
21
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.mjs
generated
vendored
Normal file
21
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var msdfVert = `// Mesh material default fragment\r
|
||||
attribute vec2 aVertexPosition;\r
|
||||
attribute vec2 aTextureCoord;\r
|
||||
\r
|
||||
uniform mat3 projectionMatrix;\r
|
||||
uniform mat3 translationMatrix;\r
|
||||
uniform mat3 uTextureMatrix;\r
|
||||
\r
|
||||
varying vec2 vTextureCoord;\r
|
||||
\r
|
||||
void main(void)\r
|
||||
{\r
|
||||
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
||||
\r
|
||||
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
||||
}\r
|
||||
`;
|
||||
export {
|
||||
msdfVert as default
|
||||
};
|
||||
//# sourceMappingURL=msdf.vert.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/shader/msdf.vert.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"msdf.vert.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
||||
15
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.js
generated
vendored
Normal file
15
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
var core = require("@pixi/core"), generateFillStyle = require("./generateFillStyle.js");
|
||||
function drawGlyph(canvas, context, metrics, x, y, resolution, style) {
|
||||
const char = metrics.text, fontProperties = metrics.fontProperties;
|
||||
context.translate(x, y), context.scale(resolution, resolution);
|
||||
const tx = style.strokeThickness / 2, ty = -(style.strokeThickness / 2);
|
||||
if (context.font = style.toFontString(), context.lineWidth = style.strokeThickness, context.textBaseline = style.textBaseline, context.lineJoin = style.lineJoin, context.miterLimit = style.miterLimit, context.fillStyle = generateFillStyle.generateFillStyle(canvas, context, style, resolution, [char], metrics), context.strokeStyle = style.stroke, style.dropShadow) {
|
||||
const dropShadowColor = style.dropShadowColor, dropShadowBlur = style.dropShadowBlur * resolution, dropShadowDistance = style.dropShadowDistance * resolution;
|
||||
context.shadowColor = core.Color.shared.setValue(dropShadowColor).setAlpha(style.dropShadowAlpha).toRgbaString(), context.shadowBlur = dropShadowBlur, context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance, context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance;
|
||||
} else
|
||||
context.shadowColor = "black", context.shadowBlur = 0, context.shadowOffsetX = 0, context.shadowOffsetY = 0;
|
||||
style.stroke && style.strokeThickness && context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent), style.fill && context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent), context.setTransform(1, 0, 0, 1, 0, 0), context.fillStyle = "rgba(0, 0, 0, 0)";
|
||||
}
|
||||
exports.drawGlyph = drawGlyph;
|
||||
//# sourceMappingURL=drawGlyph.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"drawGlyph.js","sources":["../../src/utils/drawGlyph.ts"],"sourcesContent":["import { Color } from '@pixi/core';\nimport { generateFillStyle } from './generateFillStyle';\n\nimport type { ICanvas, ICanvasRenderingContext2D } from '@pixi/core';\nimport type { TextMetrics, TextStyle } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n * @ignore\n * @param {PIXI.ICanvas} canvas\n * @param {PIXI.ICanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nexport function drawGlyph(\n canvas: ICanvas,\n context: ICanvasRenderingContext2D,\n metrics: TextMetrics,\n x: number,\n y: number,\n resolution: number,\n style: TextStyle\n): void\n{\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n\n context.translate(x, y);\n context.scale(resolution, resolution);\n\n const tx = style.strokeThickness / 2;\n const ty = -(style.strokeThickness / 2);\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n if (style.dropShadow)\n {\n const dropShadowColor = style.dropShadowColor;\n const dropShadowBlur = style.dropShadowBlur * resolution;\n const dropShadowDistance = style.dropShadowDistance * resolution;\n\n context.shadowColor = Color.shared\n .setValue(dropShadowColor)\n .setAlpha(style.dropShadowAlpha)\n .toRgbaString();\n context.shadowBlur = dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance;\n }\n else\n {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill)\n {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n"],"names":["generateFillStyle","Color"],"mappings":";;AAqBO,SAAS,UACZ,QACA,SACA,SACA,GACA,GACA,YACA,OAEJ;AACI,QAAM,OAAO,QAAQ,MACf,iBAAiB,QAAQ;AAE/B,UAAQ,UAAU,GAAG,CAAC,GACtB,QAAQ,MAAM,YAAY,UAAU;AAEpC,QAAM,KAAK,MAAM,kBAAkB,GAC7B,KAAK,EAAE,MAAM,kBAAkB;AAYrC,MAVA,QAAQ,OAAO,MAAM,aAAa,GAClC,QAAQ,YAAY,MAAM,iBAC1B,QAAQ,eAAe,MAAM,cAC7B,QAAQ,WAAW,MAAM,UACzB,QAAQ,aAAa,MAAM,YAG3B,QAAQ,YAAYA,kBAAA,kBAAkB,QAAQ,SAAS,OAAO,YAAY,CAAC,IAAI,GAAG,OAAO,GACzF,QAAQ,cAAc,MAAM,QAExB,MAAM,YACV;AACU,UAAA,kBAAkB,MAAM,iBACxB,iBAAiB,MAAM,iBAAiB,YACxC,qBAAqB,MAAM,qBAAqB;AAEtD,YAAQ,cAAcC,KAAAA,MAAM,OACvB,SAAS,eAAe,EACxB,SAAS,MAAM,eAAe,EAC9B,aAAa,GAClB,QAAQ,aAAa,gBACrB,QAAQ,gBAAgB,KAAK,IAAI,MAAM,eAAe,IAAI,oBAC1D,QAAQ,gBAAgB,KAAK,IAAI,MAAM,eAAe,IAAI;AAAA,EAC9D;AAGY,YAAA,cAAc,SACtB,QAAQ,aAAa,GACrB,QAAQ,gBAAgB,GACxB,QAAQ,gBAAgB;AAGxB,QAAM,UAAU,MAAM,mBAEtB,QAAQ,WAAW,MAAM,IAAI,KAAK,QAAQ,aAAa,eAAe,OAAO,GAE7E,MAAM,QAEN,QAAQ,SAAS,MAAM,IAAI,KAAK,QAAQ,aAAa,eAAe,OAAO,GAG/E,QAAQ,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,GAErC,QAAQ,YAAY;AACxB;;"}
|
||||
17
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.mjs
generated
vendored
Normal file
17
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.mjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Color } from "@pixi/core";
|
||||
import { generateFillStyle } from "./generateFillStyle.mjs";
|
||||
function drawGlyph(canvas, context, metrics, x, y, resolution, style) {
|
||||
const char = metrics.text, fontProperties = metrics.fontProperties;
|
||||
context.translate(x, y), context.scale(resolution, resolution);
|
||||
const tx = style.strokeThickness / 2, ty = -(style.strokeThickness / 2);
|
||||
if (context.font = style.toFontString(), context.lineWidth = style.strokeThickness, context.textBaseline = style.textBaseline, context.lineJoin = style.lineJoin, context.miterLimit = style.miterLimit, context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics), context.strokeStyle = style.stroke, style.dropShadow) {
|
||||
const dropShadowColor = style.dropShadowColor, dropShadowBlur = style.dropShadowBlur * resolution, dropShadowDistance = style.dropShadowDistance * resolution;
|
||||
context.shadowColor = Color.shared.setValue(dropShadowColor).setAlpha(style.dropShadowAlpha).toRgbaString(), context.shadowBlur = dropShadowBlur, context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance, context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance;
|
||||
} else
|
||||
context.shadowColor = "black", context.shadowBlur = 0, context.shadowOffsetX = 0, context.shadowOffsetY = 0;
|
||||
style.stroke && style.strokeThickness && context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent), style.fill && context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent), context.setTransform(1, 0, 0, 1, 0, 0), context.fillStyle = "rgba(0, 0, 0, 0)";
|
||||
}
|
||||
export {
|
||||
drawGlyph
|
||||
};
|
||||
//# sourceMappingURL=drawGlyph.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/drawGlyph.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"drawGlyph.mjs","sources":["../../src/utils/drawGlyph.ts"],"sourcesContent":["import { Color } from '@pixi/core';\nimport { generateFillStyle } from './generateFillStyle';\n\nimport type { ICanvas, ICanvasRenderingContext2D } from '@pixi/core';\nimport type { TextMetrics, TextStyle } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n * @ignore\n * @param {PIXI.ICanvas} canvas\n * @param {PIXI.ICanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nexport function drawGlyph(\n canvas: ICanvas,\n context: ICanvasRenderingContext2D,\n metrics: TextMetrics,\n x: number,\n y: number,\n resolution: number,\n style: TextStyle\n): void\n{\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n\n context.translate(x, y);\n context.scale(resolution, resolution);\n\n const tx = style.strokeThickness / 2;\n const ty = -(style.strokeThickness / 2);\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n if (style.dropShadow)\n {\n const dropShadowColor = style.dropShadowColor;\n const dropShadowBlur = style.dropShadowBlur * resolution;\n const dropShadowDistance = style.dropShadowDistance * resolution;\n\n context.shadowColor = Color.shared\n .setValue(dropShadowColor)\n .setAlpha(style.dropShadowAlpha)\n .toRgbaString();\n context.shadowBlur = dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * dropShadowDistance;\n }\n else\n {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill)\n {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n"],"names":[],"mappings":";;AAqBO,SAAS,UACZ,QACA,SACA,SACA,GACA,GACA,YACA,OAEJ;AACI,QAAM,OAAO,QAAQ,MACf,iBAAiB,QAAQ;AAE/B,UAAQ,UAAU,GAAG,CAAC,GACtB,QAAQ,MAAM,YAAY,UAAU;AAEpC,QAAM,KAAK,MAAM,kBAAkB,GAC7B,KAAK,EAAE,MAAM,kBAAkB;AAYrC,MAVA,QAAQ,OAAO,MAAM,aAAa,GAClC,QAAQ,YAAY,MAAM,iBAC1B,QAAQ,eAAe,MAAM,cAC7B,QAAQ,WAAW,MAAM,UACzB,QAAQ,aAAa,MAAM,YAG3B,QAAQ,YAAY,kBAAkB,QAAQ,SAAS,OAAO,YAAY,CAAC,IAAI,GAAG,OAAO,GACzF,QAAQ,cAAc,MAAM,QAExB,MAAM,YACV;AACU,UAAA,kBAAkB,MAAM,iBACxB,iBAAiB,MAAM,iBAAiB,YACxC,qBAAqB,MAAM,qBAAqB;AAEtD,YAAQ,cAAc,MAAM,OACvB,SAAS,eAAe,EACxB,SAAS,MAAM,eAAe,EAC9B,aAAa,GAClB,QAAQ,aAAa,gBACrB,QAAQ,gBAAgB,KAAK,IAAI,MAAM,eAAe,IAAI,oBAC1D,QAAQ,gBAAgB,KAAK,IAAI,MAAM,eAAe,IAAI;AAAA,EAC9D;AAGY,YAAA,cAAc,SACtB,QAAQ,aAAa,GACrB,QAAQ,gBAAgB,GACxB,QAAQ,gBAAgB;AAGxB,QAAM,UAAU,MAAM,mBAEtB,QAAQ,WAAW,MAAM,IAAI,KAAK,QAAQ,aAAa,eAAe,OAAO,GAE7E,MAAM,QAEN,QAAQ,SAAS,MAAM,IAAI,KAAK,QAAQ,aAAa,eAAe,OAAO,GAG/E,QAAQ,aAAa,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,GAErC,QAAQ,YAAY;AACxB;"}
|
||||
6
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.js
generated
vendored
Normal file
6
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
function extractCharCode(str) {
|
||||
return str.codePointAt ? str.codePointAt(0) : str.charCodeAt(0);
|
||||
}
|
||||
exports.extractCharCode = extractCharCode;
|
||||
//# sourceMappingURL=extractCharCode.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extractCharCode.js","sources":["../../src/utils/extractCharCode.ts"],"sourcesContent":["/**\n * Ponyfill for IE because it doesn't support `codePointAt`\n * @param str\n * @private\n */\nexport function extractCharCode(str: string): number\n{\n return str.codePointAt ? str.codePointAt(0) : str.charCodeAt(0);\n}\n"],"names":[],"mappings":";AAKO,SAAS,gBAAgB,KAChC;AACW,SAAA,IAAI,cAAc,IAAI,YAAY,CAAC,IAAI,IAAI,WAAW,CAAC;AAClE;;"}
|
||||
7
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.mjs
generated
vendored
Normal file
7
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function extractCharCode(str) {
|
||||
return str.codePointAt ? str.codePointAt(0) : str.charCodeAt(0);
|
||||
}
|
||||
export {
|
||||
extractCharCode
|
||||
};
|
||||
//# sourceMappingURL=extractCharCode.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/extractCharCode.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"extractCharCode.mjs","sources":["../../src/utils/extractCharCode.ts"],"sourcesContent":["/**\n * Ponyfill for IE because it doesn't support `codePointAt`\n * @param str\n * @private\n */\nexport function extractCharCode(str: string): number\n{\n return str.codePointAt ? str.codePointAt(0) : str.charCodeAt(0);\n}\n"],"names":[],"mappings":"AAKO,SAAS,gBAAgB,KAChC;AACW,SAAA,IAAI,cAAc,IAAI,YAAY,CAAC,IAAI,IAAI,WAAW,CAAC;AAClE;"}
|
||||
43
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.js
generated
vendored
Normal file
43
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
var text = require("@pixi/text");
|
||||
function generateFillStyle(canvas, context, style, resolution, lines, metrics) {
|
||||
const fillStyle = style.fill;
|
||||
if (Array.isArray(fillStyle)) {
|
||||
if (fillStyle.length === 1)
|
||||
return fillStyle[0];
|
||||
} else
|
||||
return fillStyle;
|
||||
let gradient;
|
||||
const dropShadowCorrection = style.dropShadow ? style.dropShadowDistance : 0, padding = style.padding || 0, width = canvas.width / resolution - dropShadowCorrection - padding * 2, height = canvas.height / resolution - dropShadowCorrection - padding * 2, fill = fillStyle.slice(), fillGradientStops = style.fillGradientStops.slice();
|
||||
if (!fillGradientStops.length) {
|
||||
const lengthPlus1 = fill.length + 1;
|
||||
for (let i = 1; i < lengthPlus1; ++i)
|
||||
fillGradientStops.push(i / lengthPlus1);
|
||||
}
|
||||
if (fill.unshift(fillStyle[0]), fillGradientStops.unshift(0), fill.push(fillStyle[fillStyle.length - 1]), fillGradientStops.push(1), style.fillGradientType === text.TEXT_GRADIENT.LINEAR_VERTICAL) {
|
||||
gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);
|
||||
let lastIterationStop = 0;
|
||||
const gradStopLineHeight = (metrics.fontProperties.fontSize + style.strokeThickness) / height;
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const thisLineTop = metrics.lineHeight * i;
|
||||
for (let j = 0; j < fill.length; j++) {
|
||||
let lineStop = 0;
|
||||
typeof fillGradientStops[j] == "number" ? lineStop = fillGradientStops[j] : lineStop = j / fill.length;
|
||||
const globalStop = thisLineTop / height + lineStop * gradStopLineHeight;
|
||||
let clampedStop = Math.max(lastIterationStop, globalStop);
|
||||
clampedStop = Math.min(clampedStop, 1), gradient.addColorStop(clampedStop, fill[j]), lastIterationStop = clampedStop;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);
|
||||
const totalIterations = fill.length + 1;
|
||||
let currentIteration = 1;
|
||||
for (let i = 0; i < fill.length; i++) {
|
||||
let stop;
|
||||
typeof fillGradientStops[i] == "number" ? stop = fillGradientStops[i] : stop = currentIteration / totalIterations, gradient.addColorStop(stop, fill[i]), currentIteration++;
|
||||
}
|
||||
}
|
||||
return gradient;
|
||||
}
|
||||
exports.generateFillStyle = generateFillStyle;
|
||||
//# sourceMappingURL=generateFillStyle.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
44
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.mjs
generated
vendored
Normal file
44
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.mjs
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { TEXT_GRADIENT } from "@pixi/text";
|
||||
function generateFillStyle(canvas, context, style, resolution, lines, metrics) {
|
||||
const fillStyle = style.fill;
|
||||
if (Array.isArray(fillStyle)) {
|
||||
if (fillStyle.length === 1)
|
||||
return fillStyle[0];
|
||||
} else
|
||||
return fillStyle;
|
||||
let gradient;
|
||||
const dropShadowCorrection = style.dropShadow ? style.dropShadowDistance : 0, padding = style.padding || 0, width = canvas.width / resolution - dropShadowCorrection - padding * 2, height = canvas.height / resolution - dropShadowCorrection - padding * 2, fill = fillStyle.slice(), fillGradientStops = style.fillGradientStops.slice();
|
||||
if (!fillGradientStops.length) {
|
||||
const lengthPlus1 = fill.length + 1;
|
||||
for (let i = 1; i < lengthPlus1; ++i)
|
||||
fillGradientStops.push(i / lengthPlus1);
|
||||
}
|
||||
if (fill.unshift(fillStyle[0]), fillGradientStops.unshift(0), fill.push(fillStyle[fillStyle.length - 1]), fillGradientStops.push(1), style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL) {
|
||||
gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);
|
||||
let lastIterationStop = 0;
|
||||
const gradStopLineHeight = (metrics.fontProperties.fontSize + style.strokeThickness) / height;
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const thisLineTop = metrics.lineHeight * i;
|
||||
for (let j = 0; j < fill.length; j++) {
|
||||
let lineStop = 0;
|
||||
typeof fillGradientStops[j] == "number" ? lineStop = fillGradientStops[j] : lineStop = j / fill.length;
|
||||
const globalStop = thisLineTop / height + lineStop * gradStopLineHeight;
|
||||
let clampedStop = Math.max(lastIterationStop, globalStop);
|
||||
clampedStop = Math.min(clampedStop, 1), gradient.addColorStop(clampedStop, fill[j]), lastIterationStop = clampedStop;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);
|
||||
const totalIterations = fill.length + 1;
|
||||
let currentIteration = 1;
|
||||
for (let i = 0; i < fill.length; i++) {
|
||||
let stop;
|
||||
typeof fillGradientStops[i] == "number" ? stop = fillGradientStops[i] : stop = currentIteration / totalIterations, gradient.addColorStop(stop, fill[i]), currentIteration++;
|
||||
}
|
||||
}
|
||||
return gradient;
|
||||
}
|
||||
export {
|
||||
generateFillStyle
|
||||
};
|
||||
//# sourceMappingURL=generateFillStyle.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/generateFillStyle.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.js
generated
vendored
Normal file
8
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
var drawGlyph = require("./drawGlyph.js"), extractCharCode = require("./extractCharCode.js"), generateFillStyle = require("./generateFillStyle.js"), resolveCharacters = require("./resolveCharacters.js"), splitTextToCharacters = require("./splitTextToCharacters.js");
|
||||
exports.drawGlyph = drawGlyph.drawGlyph;
|
||||
exports.extractCharCode = extractCharCode.extractCharCode;
|
||||
exports.generateFillStyle = generateFillStyle.generateFillStyle;
|
||||
exports.resolveCharacters = resolveCharacters.resolveCharacters;
|
||||
exports.splitTextToCharacters = splitTextToCharacters.splitTextToCharacters;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
||||
13
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.mjs
generated
vendored
Normal file
13
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { drawGlyph } from "./drawGlyph.mjs";
|
||||
import { extractCharCode } from "./extractCharCode.mjs";
|
||||
import { generateFillStyle } from "./generateFillStyle.mjs";
|
||||
import { resolveCharacters } from "./resolveCharacters.mjs";
|
||||
import { splitTextToCharacters } from "./splitTextToCharacters.mjs";
|
||||
export {
|
||||
drawGlyph,
|
||||
extractCharCode,
|
||||
generateFillStyle,
|
||||
resolveCharacters,
|
||||
splitTextToCharacters
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
||||
24
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.js
generated
vendored
Normal file
24
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var splitTextToCharacters = require("./splitTextToCharacters.js");
|
||||
function resolveCharacters(chars) {
|
||||
typeof chars == "string" && (chars = [chars]);
|
||||
const result = [];
|
||||
for (let i = 0, j = chars.length; i < j; i++) {
|
||||
const item = chars[i];
|
||||
if (Array.isArray(item)) {
|
||||
if (item.length !== 2)
|
||||
throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);
|
||||
const startCode = item[0].charCodeAt(0), endCode = item[1].charCodeAt(0);
|
||||
if (endCode < startCode)
|
||||
throw new Error("[BitmapFont]: Invalid character range.");
|
||||
for (let i2 = startCode, j2 = endCode; i2 <= j2; i2++)
|
||||
result.push(String.fromCharCode(i2));
|
||||
} else
|
||||
result.push(...splitTextToCharacters.splitTextToCharacters(item));
|
||||
}
|
||||
if (result.length === 0)
|
||||
throw new Error("[BitmapFont]: Empty set when resolving characters.");
|
||||
return result;
|
||||
}
|
||||
exports.resolveCharacters = resolveCharacters;
|
||||
//# sourceMappingURL=resolveCharacters.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"resolveCharacters.js","sources":["../../src/utils/resolveCharacters.ts"],"sourcesContent":["import { splitTextToCharacters } from './splitTextToCharacters';\n\n/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]} the flattened array of characters\n */\nexport function resolveCharacters(chars: string | (string | string[])[]): string[]\n{\n // Split the chars string into individual characters\n if (typeof chars === 'string')\n {\n chars = [chars];\n }\n\n // Handle an array of characters+ranges\n const result: string[] = [];\n\n for (let i = 0, j = chars.length; i < j; i++)\n {\n const item = chars[i];\n\n // Handle range delimited by start/end chars\n if (Array.isArray(item))\n {\n if (item.length !== 2)\n {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n\n if (endCode < startCode)\n {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n\n for (let i = startCode, j = endCode; i <= j; i++)\n {\n result.push(String.fromCharCode(i));\n }\n }\n // Handle a character set string\n else\n {\n result.push(...splitTextToCharacters(item));\n }\n }\n\n if (result.length === 0)\n {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n\n return result;\n}\n"],"names":["i","j","splitTextToCharacters"],"mappings":";;AAUO,SAAS,kBAAkB,OAClC;AAEQ,SAAO,SAAU,aAEjB,QAAQ,CAAC,KAAK;AAIlB,QAAM,SAAmB,CAAA;AAEzB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,KACzC;AACU,UAAA,OAAO,MAAM,CAAC;AAGhB,QAAA,MAAM,QAAQ,IAAI,GACtB;AACI,UAAI,KAAK,WAAW;AAEhB,cAAM,IAAI,MAAM,iEAAiE,KAAK,MAAM,GAAG;AAGnG,YAAM,YAAY,KAAK,CAAC,EAAE,WAAW,CAAC,GAChC,UAAU,KAAK,CAAC,EAAE,WAAW,CAAC;AAEpC,UAAI,UAAU;AAEJ,cAAA,IAAI,MAAM,wCAAwC;AAG5D,eAASA,KAAI,WAAWC,KAAI,SAASD,MAAKC,IAAGD;AAEzC,eAAO,KAAK,OAAO,aAAaA,EAAC,CAAC;AAAA,IAE1C;AAII,aAAO,KAAK,GAAGE,4CAAsB,IAAI,CAAC;AAAA,EAElD;AAEA,MAAI,OAAO,WAAW;AAEZ,UAAA,IAAI,MAAM,oDAAoD;AAGjE,SAAA;AACX;;"}
|
||||
25
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.mjs
generated
vendored
Normal file
25
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.mjs
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { splitTextToCharacters } from "./splitTextToCharacters.mjs";
|
||||
function resolveCharacters(chars) {
|
||||
typeof chars == "string" && (chars = [chars]);
|
||||
const result = [];
|
||||
for (let i = 0, j = chars.length; i < j; i++) {
|
||||
const item = chars[i];
|
||||
if (Array.isArray(item)) {
|
||||
if (item.length !== 2)
|
||||
throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);
|
||||
const startCode = item[0].charCodeAt(0), endCode = item[1].charCodeAt(0);
|
||||
if (endCode < startCode)
|
||||
throw new Error("[BitmapFont]: Invalid character range.");
|
||||
for (let i2 = startCode, j2 = endCode; i2 <= j2; i2++)
|
||||
result.push(String.fromCharCode(i2));
|
||||
} else
|
||||
result.push(...splitTextToCharacters(item));
|
||||
}
|
||||
if (result.length === 0)
|
||||
throw new Error("[BitmapFont]: Empty set when resolving characters.");
|
||||
return result;
|
||||
}
|
||||
export {
|
||||
resolveCharacters
|
||||
};
|
||||
//# sourceMappingURL=resolveCharacters.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/resolveCharacters.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"resolveCharacters.mjs","sources":["../../src/utils/resolveCharacters.ts"],"sourcesContent":["import { splitTextToCharacters } from './splitTextToCharacters';\n\n/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]} the flattened array of characters\n */\nexport function resolveCharacters(chars: string | (string | string[])[]): string[]\n{\n // Split the chars string into individual characters\n if (typeof chars === 'string')\n {\n chars = [chars];\n }\n\n // Handle an array of characters+ranges\n const result: string[] = [];\n\n for (let i = 0, j = chars.length; i < j; i++)\n {\n const item = chars[i];\n\n // Handle range delimited by start/end chars\n if (Array.isArray(item))\n {\n if (item.length !== 2)\n {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n\n if (endCode < startCode)\n {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n\n for (let i = startCode, j = endCode; i <= j; i++)\n {\n result.push(String.fromCharCode(i));\n }\n }\n // Handle a character set string\n else\n {\n result.push(...splitTextToCharacters(item));\n }\n }\n\n if (result.length === 0)\n {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n\n return result;\n}\n"],"names":["i","j"],"mappings":";AAUO,SAAS,kBAAkB,OAClC;AAEQ,SAAO,SAAU,aAEjB,QAAQ,CAAC,KAAK;AAIlB,QAAM,SAAmB,CAAA;AAEzB,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,KACzC;AACU,UAAA,OAAO,MAAM,CAAC;AAGhB,QAAA,MAAM,QAAQ,IAAI,GACtB;AACI,UAAI,KAAK,WAAW;AAEhB,cAAM,IAAI,MAAM,iEAAiE,KAAK,MAAM,GAAG;AAGnG,YAAM,YAAY,KAAK,CAAC,EAAE,WAAW,CAAC,GAChC,UAAU,KAAK,CAAC,EAAE,WAAW,CAAC;AAEpC,UAAI,UAAU;AAEJ,cAAA,IAAI,MAAM,wCAAwC;AAG5D,eAASA,KAAI,WAAWC,KAAI,SAASD,MAAKC,IAAGD;AAEzC,eAAO,KAAK,OAAO,aAAaA,EAAC,CAAC;AAAA,IAE1C;AAII,aAAO,KAAK,GAAG,sBAAsB,IAAI,CAAC;AAAA,EAElD;AAEA,MAAI,OAAO,WAAW;AAEZ,UAAA,IAAI,MAAM,oDAAoD;AAGjE,SAAA;AACX;"}
|
||||
6
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.js
generated
vendored
Normal file
6
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
function splitTextToCharacters(text) {
|
||||
return Array.from ? Array.from(text) : text.split("");
|
||||
}
|
||||
exports.splitTextToCharacters = splitTextToCharacters;
|
||||
//# sourceMappingURL=splitTextToCharacters.js.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"splitTextToCharacters.js","sources":["../../src/utils/splitTextToCharacters.ts"],"sourcesContent":["/**\n * Ponyfill for IE because it doesn't support `Array.from`\n * @param text\n * @private\n */\nexport function splitTextToCharacters(text: string): string[]\n{\n return Array.from ? Array.from(text) : text.split('');\n}\n"],"names":[],"mappings":";AAKO,SAAS,sBAAsB,MACtC;AACW,SAAA,MAAM,OAAO,MAAM,KAAK,IAAI,IAAI,KAAK,MAAM,EAAE;AACxD;;"}
|
||||
7
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.mjs
generated
vendored
Normal file
7
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function splitTextToCharacters(text) {
|
||||
return Array.from ? Array.from(text) : text.split("");
|
||||
}
|
||||
export {
|
||||
splitTextToCharacters
|
||||
};
|
||||
//# sourceMappingURL=splitTextToCharacters.mjs.map
|
||||
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/text-bitmap/lib/utils/splitTextToCharacters.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"splitTextToCharacters.mjs","sources":["../../src/utils/splitTextToCharacters.ts"],"sourcesContent":["/**\n * Ponyfill for IE because it doesn't support `Array.from`\n * @param text\n * @private\n */\nexport function splitTextToCharacters(text: string): string[]\n{\n return Array.from ? Array.from(text) : text.split('');\n}\n"],"names":[],"mappings":"AAKO,SAAS,sBAAsB,MACtC;AACW,SAAA,MAAM,OAAO,MAAM,KAAK,IAAI,IAAI,KAAK,MAAM,EAAE;AACxD;"}
|
||||
Reference in New Issue
Block a user