37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$utils$resolveCharacters = function(global, require, module, exports) {
|
|
exports.resolveCharacters = function(chars) {
|
|
if ("" === chars) {
|
|
return [];
|
|
}
|
|
"string" === typeof chars && (chars = [chars]);
|
|
const result = [];
|
|
for (let i = 0, j = chars.length; i < j; i++) {
|
|
var item = chars[i];
|
|
if (Array.isArray(item)) {
|
|
if (2 !== item.length) {
|
|
throw Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);
|
|
}
|
|
if (0 === item[0].length || 0 === item[1].length) {
|
|
throw Error("[BitmapFont]: Invalid character delimiter.");
|
|
}
|
|
const startCode = item[0].charCodeAt(0);
|
|
item = item[1].charCodeAt(0);
|
|
if (item < startCode) {
|
|
throw Error("[BitmapFont]: Invalid character range.");
|
|
}
|
|
for (let i2 = startCode, j2 = item; i2 <= j2; i2++) {
|
|
result.push(String.fromCharCode(i2));
|
|
}
|
|
} else {
|
|
result.push(...Array.from(item));
|
|
}
|
|
}
|
|
if (0 === result.length) {
|
|
throw Error("[BitmapFont]: Empty set when resolving characters.");
|
|
}
|
|
return result;
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$text_bitmap$utils$resolveCharacters.js.map
|