@wcardinal/wcardinal-ui 0.425.0 → 0.427.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/wcardinal/ui/d-dynamic-text-geometry.d.ts +14 -3
- package/dist/types/wcardinal/ui/d-pane.d.ts +4 -4
- package/dist/types/wcardinal/ui/shape/e-shape-text.d.ts +3 -1
- package/dist/types/wcardinal/ui/shape/variant/build-text.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/variant/e-shape-text-impl.d.ts +6 -1
- package/dist/types/wcardinal/ui/util/character.d.ts +8 -0
- package/dist/types/wcardinal/ui/util/dynamic-font-atlas-character.d.ts +1 -0
- package/dist/types/wcardinal/ui/util/dynamic-font-atlas-characters.d.ts +1 -1
- package/dist/types/wcardinal/ui/util/dynamic-font-atlas.d.ts +5 -7
- package/dist/types/wcardinal/ui/util/dynamic-sdf-font-atlas.d.ts +4 -5
- package/dist/types/wcardinal/ui/util/dynamic-sdf-font-atlases.d.ts +2 -2
- package/dist/types/wcardinal/ui/util/index.d.ts +1 -0
- package/dist/types/wcardinal/ui/util/util-character-iterator.d.ts +0 -8
- package/dist/wcardinal/ui/d-dynamic-text-geometry.js +56 -49
- package/dist/wcardinal/ui/d-dynamic-text-geometry.js.map +1 -1
- package/dist/wcardinal/ui/d-dynamic-text-measure.js +11 -11
- package/dist/wcardinal/ui/d-dynamic-text-measure.js.map +1 -1
- package/dist/wcardinal/ui/d-pane.js +9 -21
- package/dist/wcardinal/ui/d-pane.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-renderer.js +3 -3
- package/dist/wcardinal/ui/shape/e-shape-renderer.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-text.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/build-text.js +13 -14
- package/dist/wcardinal/ui/shape/variant/build-text.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/builder-text.js +1 -1
- package/dist/wcardinal/ui/shape/variant/builder-text.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-text-impl.js +88 -13
- package/dist/wcardinal/ui/shape/variant/e-shape-text-impl.js.map +1 -1
- package/dist/wcardinal/ui/util/character.js +13 -0
- package/dist/wcardinal/ui/util/character.js.map +1 -0
- package/dist/wcardinal/ui/util/dynamic-font-atlas-character.js +2 -1
- package/dist/wcardinal/ui/util/dynamic-font-atlas-character.js.map +1 -1
- package/dist/wcardinal/ui/util/dynamic-font-atlas-characters.js.map +1 -1
- package/dist/wcardinal/ui/util/dynamic-font-atlas.js +124 -108
- package/dist/wcardinal/ui/util/dynamic-font-atlas.js.map +1 -1
- package/dist/wcardinal/ui/util/dynamic-font-atlases.js +2 -1
- package/dist/wcardinal/ui/util/dynamic-font-atlases.js.map +1 -1
- package/dist/wcardinal/ui/util/dynamic-sdf-font-atlas.js +99 -112
- package/dist/wcardinal/ui/util/dynamic-sdf-font-atlas.js.map +1 -1
- package/dist/wcardinal/ui/util/dynamic-sdf-font-atlases.js +18 -26
- package/dist/wcardinal/ui/util/dynamic-sdf-font-atlases.js.map +1 -1
- package/dist/wcardinal/ui/util/index.js +1 -0
- package/dist/wcardinal/ui/util/index.js.map +1 -1
- package/dist/wcardinal/ui/util/util-character-iterator.js +0 -17
- package/dist/wcardinal/ui/util/util-character-iterator.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +508 -450
- package/dist/wcardinal-ui.js +508 -450
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/wcardinal/ui/util/ascii.d.ts +0 -1
- package/dist/wcardinal/ui/util/ascii.js +0 -6
- package/dist/wcardinal/ui/util/ascii.js.map +0 -1
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.427.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -358,91 +358,6 @@ var buildBarUv = function (uvs, voffset, textureUvs) {
|
|
|
358
358
|
uvs[++iuv] = textureUvs.y2;
|
|
359
359
|
};
|
|
360
360
|
|
|
361
|
-
/*
|
|
362
|
-
* Copyright (C) 2019 Toshiba Corporation
|
|
363
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
364
|
-
*/
|
|
365
|
-
var UtilCharacterIterator = /** @class */ (function () {
|
|
366
|
-
function UtilCharacterIterator() {
|
|
367
|
-
this.target = "";
|
|
368
|
-
this.position = 0;
|
|
369
|
-
}
|
|
370
|
-
UtilCharacterIterator.prototype.init = function (target) {
|
|
371
|
-
this.target = target;
|
|
372
|
-
this.position = 0;
|
|
373
|
-
};
|
|
374
|
-
UtilCharacterIterator.prototype.hasNext = function () {
|
|
375
|
-
return this.position < this.target.length;
|
|
376
|
-
};
|
|
377
|
-
UtilCharacterIterator.prototype.findNextBreak = function (target, istart) {
|
|
378
|
-
var iend = target.length;
|
|
379
|
-
for (var i = istart; i < iend; ++i) {
|
|
380
|
-
var code = target.charCodeAt(i);
|
|
381
|
-
if (!this.isLowSurrogate(code) && !this.isVariationSelector(code)) {
|
|
382
|
-
return i;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return iend;
|
|
386
|
-
};
|
|
387
|
-
UtilCharacterIterator.prototype.isHighSurrogate = function (code) {
|
|
388
|
-
return 0xd800 <= code && code <= 0xdbff;
|
|
389
|
-
};
|
|
390
|
-
UtilCharacterIterator.prototype.isLowSurrogate = function (code) {
|
|
391
|
-
return 0xdc00 <= code && code <= 0xdfff;
|
|
392
|
-
};
|
|
393
|
-
UtilCharacterIterator.prototype.isVariationSelector = function (code) {
|
|
394
|
-
return 0xfe00 <= code && code <= 0xfe0f;
|
|
395
|
-
};
|
|
396
|
-
UtilCharacterIterator.prototype.next = function () {
|
|
397
|
-
var target = this.target;
|
|
398
|
-
var position = this.position;
|
|
399
|
-
var nextBreak = this.findNextBreak(target, position + 1);
|
|
400
|
-
var result = target.substring(position, nextBreak);
|
|
401
|
-
this.position = nextBreak;
|
|
402
|
-
return result;
|
|
403
|
-
};
|
|
404
|
-
/**
|
|
405
|
-
* Advances the position if the next character is not equal to
|
|
406
|
-
* the given `except`.
|
|
407
|
-
*
|
|
408
|
-
* @param except
|
|
409
|
-
* @return true if the position is advanced
|
|
410
|
-
*/
|
|
411
|
-
UtilCharacterIterator.prototype.advance = function (except) {
|
|
412
|
-
var target = this.target;
|
|
413
|
-
var position = this.position;
|
|
414
|
-
var nextBreak = this.findNextBreak(target, position + 1);
|
|
415
|
-
if (target.substring(position, nextBreak) !== except) {
|
|
416
|
-
this.position = nextBreak;
|
|
417
|
-
return true;
|
|
418
|
-
}
|
|
419
|
-
return false;
|
|
420
|
-
};
|
|
421
|
-
/**
|
|
422
|
-
* Closes this iterator.
|
|
423
|
-
*
|
|
424
|
-
* @returns true if closed.
|
|
425
|
-
*/
|
|
426
|
-
UtilCharacterIterator.prototype.close = function () {
|
|
427
|
-
var length = this.target.length;
|
|
428
|
-
if (this.position < length) {
|
|
429
|
-
this.position = length;
|
|
430
|
-
return true;
|
|
431
|
-
}
|
|
432
|
-
return false;
|
|
433
|
-
};
|
|
434
|
-
UtilCharacterIterator.from = function (target) {
|
|
435
|
-
if (UtilCharacterIterator._instance == null) {
|
|
436
|
-
UtilCharacterIterator._instance = new UtilCharacterIterator();
|
|
437
|
-
}
|
|
438
|
-
var instance = UtilCharacterIterator._instance;
|
|
439
|
-
instance.init(target);
|
|
440
|
-
return instance;
|
|
441
|
-
};
|
|
442
|
-
UtilCharacterIterator._instance = null;
|
|
443
|
-
return UtilCharacterIterator;
|
|
444
|
-
}());
|
|
445
|
-
|
|
446
361
|
/*
|
|
447
362
|
* Copyright (C) 2019 Toshiba Corporation
|
|
448
363
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -501,6 +416,19 @@ var toLength = function (p0x, p0y, p1x, p1y) {
|
|
|
501
416
|
return Math.sqrt(dx01 * dx01 + dy01 * dy01);
|
|
502
417
|
};
|
|
503
418
|
|
|
419
|
+
/*
|
|
420
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
421
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
422
|
+
*/
|
|
423
|
+
var Character = {
|
|
424
|
+
ASCII: "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
|
|
425
|
+
SPACE: " ",
|
|
426
|
+
TAB: "\t",
|
|
427
|
+
SOFT_TAB: " ",
|
|
428
|
+
DOTS: "...",
|
|
429
|
+
NEW_LINE: "\n"
|
|
430
|
+
};
|
|
431
|
+
|
|
504
432
|
var TEXT_VERTEX_COUNT = 4;
|
|
505
433
|
var TEXT_VERTEX_COUNT_SHIFT = 2;
|
|
506
434
|
var TEXT_INDEX_COUNT = 2;
|
|
@@ -847,7 +775,7 @@ var invertAlignVertical = function (align) {
|
|
|
847
775
|
return EShapeTextAlignVertical.OUTSIDE_TOP;
|
|
848
776
|
}
|
|
849
777
|
};
|
|
850
|
-
var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY, sizeX, sizeY, textAtlas, textSize,
|
|
778
|
+
var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY, sizeX, sizeY, textAtlas, textSize, textCharacters, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textFitting, textWorld, textureUvs, internalTransform) {
|
|
851
779
|
// Calculate the transformed positions
|
|
852
780
|
//
|
|
853
781
|
// 0 1
|
|
@@ -939,15 +867,14 @@ var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY
|
|
|
939
867
|
var lineWidth = 0;
|
|
940
868
|
var lineCount = 1;
|
|
941
869
|
var textAtlasCharacters = textAtlas.characters;
|
|
942
|
-
var iterator = UtilCharacterIterator.from(textValue);
|
|
943
870
|
var advancePrevious = 0;
|
|
944
|
-
|
|
945
|
-
var character =
|
|
946
|
-
if (character !==
|
|
871
|
+
for (var i = 0, imax = textCharacters.length; i < imax; ++i) {
|
|
872
|
+
var character = textCharacters[i];
|
|
873
|
+
if (character !== Character.NEW_LINE) {
|
|
947
874
|
if (0 < advancePrevious) {
|
|
948
875
|
lineWidth += Math.max(0, advancePrevious + textSpacingHorizontal);
|
|
949
876
|
}
|
|
950
|
-
var data = textAtlasCharacters
|
|
877
|
+
var data = textAtlasCharacters.get(character);
|
|
951
878
|
if (data) {
|
|
952
879
|
advancePrevious = data.advance;
|
|
953
880
|
heightChar = data.height;
|
|
@@ -1091,12 +1018,11 @@ var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY
|
|
|
1091
1018
|
var cy3 = by3;
|
|
1092
1019
|
lineWidth = 0;
|
|
1093
1020
|
advancePrevious = 0;
|
|
1094
|
-
iterator.position = 0;
|
|
1095
1021
|
lineCount = 0;
|
|
1096
1022
|
var iv = voffset * 2;
|
|
1097
|
-
for (
|
|
1098
|
-
var character =
|
|
1099
|
-
if (character !==
|
|
1023
|
+
for (var i = 0, imax = textCharacters.length; i < imax; i += 1, iv += 8) {
|
|
1024
|
+
var character = textCharacters[i];
|
|
1025
|
+
if (character !== Character.NEW_LINE) {
|
|
1100
1026
|
var lineWidthPrevious = lineWidth;
|
|
1101
1027
|
if (0 < advancePrevious) {
|
|
1102
1028
|
lineWidth += Math.max(0, advancePrevious + textSpacingHorizontal);
|
|
@@ -1107,12 +1033,12 @@ var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY
|
|
|
1107
1033
|
cy0 = by0 + ay;
|
|
1108
1034
|
cx3 = bx3 + ax;
|
|
1109
1035
|
cy3 = by3 + ay;
|
|
1110
|
-
var data = textAtlasCharacters
|
|
1036
|
+
var data = textAtlasCharacters.get(character);
|
|
1111
1037
|
lineCount += 1;
|
|
1112
1038
|
if (data) {
|
|
1113
1039
|
var advance = data.advance;
|
|
1114
1040
|
if (lineWidthMaximum < (lineWidth + advance) * scaleX) {
|
|
1115
|
-
var dots = textAtlasCharacters
|
|
1041
|
+
var dots = textAtlasCharacters.get(Character.DOTS);
|
|
1116
1042
|
if (dots) {
|
|
1117
1043
|
if (1 < lineCount &&
|
|
1118
1044
|
lineWidthMaximum < (lineWidth + dots.advance) * scaleX) {
|
|
@@ -1129,9 +1055,10 @@ var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY
|
|
|
1129
1055
|
advancePrevious = dots.advance;
|
|
1130
1056
|
writeCharacter(vertices, uvs, iv, dots, textAtlas, snx, sny, cx0, cy0, cx3, cy3, duvx01, duvy01, duvx03, duvy03, uvx0, uvy0);
|
|
1131
1057
|
for (iv += 8; true; iv += 8) {
|
|
1132
|
-
if (
|
|
1058
|
+
if (i + 1 < imax && textCharacters[i + 1] !== Character.NEW_LINE) {
|
|
1133
1059
|
writeCharacterEmpty(vertices, uvs, iv, cx0, cy0, cx3, cy3, uvx0, uvy0, uvx3, uvy3);
|
|
1134
1060
|
lineCount += 1;
|
|
1061
|
+
i += 1;
|
|
1135
1062
|
}
|
|
1136
1063
|
else {
|
|
1137
1064
|
iv -= 8;
|
|
@@ -7800,6 +7727,9 @@ var EShapeTextImpl = /** @class */ (function () {
|
|
|
7800
7727
|
this.padding = new EShapeTextOffsetImpl(parent, 10, 10);
|
|
7801
7728
|
this._clipping = false;
|
|
7802
7729
|
this._fitting = false;
|
|
7730
|
+
this._characters = [];
|
|
7731
|
+
this._nacharacters = [];
|
|
7732
|
+
this.updateCharacters(value);
|
|
7803
7733
|
}
|
|
7804
7734
|
Object.defineProperty(EShapeTextImpl.prototype, "enable", {
|
|
7805
7735
|
get: function () {
|
|
@@ -7826,7 +7756,8 @@ var EShapeTextImpl = /** @class */ (function () {
|
|
|
7826
7756
|
if (this._plength < length_1) {
|
|
7827
7757
|
this._plength = length_1;
|
|
7828
7758
|
}
|
|
7829
|
-
|
|
7759
|
+
this.updateCharacters(value);
|
|
7760
|
+
if (this.isCompatible()) {
|
|
7830
7761
|
this._parent.updateUploaded();
|
|
7831
7762
|
}
|
|
7832
7763
|
else {
|
|
@@ -7838,7 +7769,78 @@ var EShapeTextImpl = /** @class */ (function () {
|
|
|
7838
7769
|
enumerable: false,
|
|
7839
7770
|
configurable: true
|
|
7840
7771
|
});
|
|
7841
|
-
EShapeTextImpl.prototype
|
|
7772
|
+
Object.defineProperty(EShapeTextImpl.prototype, "characters", {
|
|
7773
|
+
get: function () {
|
|
7774
|
+
return this._characters;
|
|
7775
|
+
},
|
|
7776
|
+
enumerable: false,
|
|
7777
|
+
configurable: true
|
|
7778
|
+
});
|
|
7779
|
+
Object.defineProperty(EShapeTextImpl.prototype, "nacharacters", {
|
|
7780
|
+
get: function () {
|
|
7781
|
+
return this._nacharacters;
|
|
7782
|
+
},
|
|
7783
|
+
enumerable: false,
|
|
7784
|
+
configurable: true
|
|
7785
|
+
});
|
|
7786
|
+
EShapeTextImpl.prototype.updateCharacters = function (value) {
|
|
7787
|
+
var characters = this._characters;
|
|
7788
|
+
var charactersLength = characters.length;
|
|
7789
|
+
var icharacters = 0;
|
|
7790
|
+
var nacharacters = this._nacharacters;
|
|
7791
|
+
var nacharactersLength = nacharacters.length;
|
|
7792
|
+
var inacharacters = 0;
|
|
7793
|
+
for (var i = 0, imax = value.length; i < imax;) {
|
|
7794
|
+
if (value.charCodeAt(i) <= 0xff) {
|
|
7795
|
+
// Add an ASCII character
|
|
7796
|
+
var ac = value.substring(i, i + 1);
|
|
7797
|
+
if (icharacters < charactersLength) {
|
|
7798
|
+
characters[icharacters] = ac;
|
|
7799
|
+
}
|
|
7800
|
+
else {
|
|
7801
|
+
characters.push(ac);
|
|
7802
|
+
}
|
|
7803
|
+
icharacters += 1;
|
|
7804
|
+
i += 1;
|
|
7805
|
+
continue;
|
|
7806
|
+
}
|
|
7807
|
+
var j = i + 1;
|
|
7808
|
+
for (; j < imax; ++j) {
|
|
7809
|
+
var cc = value.charCodeAt(j);
|
|
7810
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
7811
|
+
// Low surrogate
|
|
7812
|
+
// Variation selector
|
|
7813
|
+
continue;
|
|
7814
|
+
}
|
|
7815
|
+
break;
|
|
7816
|
+
}
|
|
7817
|
+
// Add an non-ascii character
|
|
7818
|
+
var nac = value.substring(i, j);
|
|
7819
|
+
if (icharacters < charactersLength) {
|
|
7820
|
+
characters[icharacters] = nac;
|
|
7821
|
+
}
|
|
7822
|
+
else {
|
|
7823
|
+
characters.push(nac);
|
|
7824
|
+
}
|
|
7825
|
+
icharacters += 1;
|
|
7826
|
+
if (inacharacters < nacharactersLength) {
|
|
7827
|
+
nacharacters[inacharacters] = nac;
|
|
7828
|
+
}
|
|
7829
|
+
else {
|
|
7830
|
+
nacharacters.push(nac);
|
|
7831
|
+
}
|
|
7832
|
+
inacharacters += 1;
|
|
7833
|
+
// Go to the next
|
|
7834
|
+
i = j;
|
|
7835
|
+
}
|
|
7836
|
+
if (icharacters < charactersLength) {
|
|
7837
|
+
characters.length = icharacters;
|
|
7838
|
+
}
|
|
7839
|
+
if (inacharacters < nacharactersLength) {
|
|
7840
|
+
nacharacters.length = inacharacters;
|
|
7841
|
+
}
|
|
7842
|
+
};
|
|
7843
|
+
EShapeTextImpl.prototype.isCompatible = function () {
|
|
7842
7844
|
// Compatibility check
|
|
7843
7845
|
var parent = this._parent;
|
|
7844
7846
|
var uploaded = parent.uploaded;
|
|
@@ -7847,18 +7849,17 @@ var EShapeTextImpl = /** @class */ (function () {
|
|
|
7847
7849
|
}
|
|
7848
7850
|
// Character code check
|
|
7849
7851
|
var atlas = this.atlas;
|
|
7850
|
-
|
|
7851
|
-
if (characters != null) {
|
|
7852
|
-
for (var i = 0, imax = value.length; i < imax; ++i) {
|
|
7853
|
-
var char = value[i];
|
|
7854
|
-
if (!(char in characters)) {
|
|
7855
|
-
return false;
|
|
7856
|
-
}
|
|
7857
|
-
}
|
|
7858
|
-
}
|
|
7859
|
-
else {
|
|
7852
|
+
if (atlas == null) {
|
|
7860
7853
|
return false;
|
|
7861
7854
|
}
|
|
7855
|
+
var atlasCharacters = atlas.characters;
|
|
7856
|
+
var nacharacters = this._nacharacters;
|
|
7857
|
+
for (var i = 0, imax = nacharacters.length; i < imax; ++i) {
|
|
7858
|
+
if (!atlasCharacters.has(nacharacters[i])) {
|
|
7859
|
+
return false;
|
|
7860
|
+
}
|
|
7861
|
+
}
|
|
7862
|
+
// Done
|
|
7862
7863
|
return true;
|
|
7863
7864
|
};
|
|
7864
7865
|
Object.defineProperty(EShapeTextImpl.prototype, "length", {
|
|
@@ -8013,7 +8014,8 @@ var EShapeTextImpl = /** @class */ (function () {
|
|
|
8013
8014
|
if (this._plength < length_2) {
|
|
8014
8015
|
this._plength = length_2;
|
|
8015
8016
|
}
|
|
8016
|
-
|
|
8017
|
+
this.updateCharacters(value);
|
|
8018
|
+
if (this.isCompatible()) {
|
|
8017
8019
|
isChangedUploaded = true;
|
|
8018
8020
|
}
|
|
8019
8021
|
else {
|
|
@@ -8844,7 +8846,7 @@ var BuilderText = /** @class */ (function () {
|
|
|
8844
8846
|
textWorld = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
|
|
8845
8847
|
text.world = textWorld;
|
|
8846
8848
|
}
|
|
8847
|
-
buildTextVertex(buffer.vertices, buffer.uvs, this.vertexOffset, this.vertexCount, 0, 0, shapeSize.x, shapeSize.y, textAtlas, textSize,
|
|
8849
|
+
buildTextVertex(buffer.vertices, buffer.uvs, this.vertexOffset, this.vertexCount, 0, 0, shapeSize.x, shapeSize.y, textAtlas, textSize, text.characters, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textFitting, textWorld, toTextureUvs(textTexture), shape.transform.internalTransform);
|
|
8848
8850
|
}
|
|
8849
8851
|
};
|
|
8850
8852
|
BuilderText.prototype.updateColor = function (buffer, shape) {
|
|
@@ -21159,12 +21161,6 @@ var DynamicAtlasItemFontAtlas = /** @class */ (function (_super) {
|
|
|
21159
21161
|
return DynamicAtlasItemFontAtlas;
|
|
21160
21162
|
}(DynamicAtlasItem));
|
|
21161
21163
|
|
|
21162
|
-
/*
|
|
21163
|
-
* Copyright (C) 2019 Toshiba Corporation
|
|
21164
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
21165
|
-
*/
|
|
21166
|
-
var ASCII_CHARACTERS = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
|
|
21167
|
-
|
|
21168
21164
|
/*
|
|
21169
21165
|
* Copyright (C) 2019 Toshiba Corporation
|
|
21170
21166
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -21184,7 +21180,7 @@ var DynamicFontAtlasCharacterOrigin = /** @class */ (function () {
|
|
|
21184
21180
|
var DynamicFontAtlasCharacter = /** @class */ (function () {
|
|
21185
21181
|
function DynamicFontAtlasCharacter(type, character, x, y, width, height, advance) {
|
|
21186
21182
|
this.ref = 1;
|
|
21187
|
-
this.life =
|
|
21183
|
+
this.life = DynamicFontAtlasCharacter.LIFE;
|
|
21188
21184
|
this.character = character;
|
|
21189
21185
|
this.x = x;
|
|
21190
21186
|
this.y = y;
|
|
@@ -21194,6 +21190,7 @@ var DynamicFontAtlasCharacter = /** @class */ (function () {
|
|
|
21194
21190
|
this.origin = new DynamicFontAtlasCharacterOrigin(0, 0);
|
|
21195
21191
|
this.type = type;
|
|
21196
21192
|
}
|
|
21193
|
+
DynamicFontAtlasCharacter.LIFE = 10;
|
|
21197
21194
|
return DynamicFontAtlasCharacter;
|
|
21198
21195
|
}());
|
|
21199
21196
|
|
|
@@ -21613,11 +21610,20 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21613
21610
|
this._generator = DynamicSDFFontGenerator.getInstance().init();
|
|
21614
21611
|
this._canvas = document.createElement("canvas");
|
|
21615
21612
|
this._font = new DynamicSDFFontAtlasFont(fontFamily);
|
|
21616
|
-
this._characters = {};
|
|
21617
|
-
this._length = 0;
|
|
21618
21613
|
this._width = 1;
|
|
21619
21614
|
this._height = 1;
|
|
21615
|
+
var characters = new Map();
|
|
21616
|
+
characters.set(Character.SPACE, this.newChar(Character.SPACE, DynamicFontAtlasCharacterType.SPACE_R));
|
|
21617
|
+
characters.set(Character.TAB, this.newChar(Character.SOFT_TAB, DynamicFontAtlasCharacterType.SPACE_R));
|
|
21618
|
+
characters.set(Character.DOTS, this.newChar(Character.DOTS, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
21619
|
+
for (var i = 0, imax = Character.ASCII.length; i < imax; ++i) {
|
|
21620
|
+
var ac = Character.ASCII[i];
|
|
21621
|
+
characters.set(ac, this.newChar(ac, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
21622
|
+
}
|
|
21623
|
+
this._characters = characters;
|
|
21620
21624
|
this._isDirty = true;
|
|
21625
|
+
this._isTouched = false;
|
|
21626
|
+
this._life = DynamicFontAtlasCharacter.LIFE;
|
|
21621
21627
|
}
|
|
21622
21628
|
Object.defineProperty(DynamicSDFFontAtlas.prototype, "id", {
|
|
21623
21629
|
get: function () {
|
|
@@ -21674,143 +21680,125 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21674
21680
|
configurable: true
|
|
21675
21681
|
});
|
|
21676
21682
|
DynamicSDFFontAtlas.prototype.begin = function () {
|
|
21677
|
-
this.
|
|
21678
|
-
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
|
|
21683
|
+
this._isTouched = false;
|
|
21684
|
+
this._characters.forEach(function (character) {
|
|
21685
|
+
if (!(character.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
21686
|
+
character.ref = 0;
|
|
21687
|
+
}
|
|
21688
|
+
});
|
|
21682
21689
|
};
|
|
21683
21690
|
DynamicSDFFontAtlas.prototype.end = function () {
|
|
21691
|
+
var _this = this;
|
|
21684
21692
|
var characters = this._characters;
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21688
|
-
|
|
21689
|
-
|
|
21690
|
-
|
|
21691
|
-
|
|
21693
|
+
if (this._isTouched) {
|
|
21694
|
+
this._life = DynamicFontAtlasCharacter.LIFE;
|
|
21695
|
+
characters.forEach(function (character, id) {
|
|
21696
|
+
if (character.ref <= 0 &&
|
|
21697
|
+
!(character.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
21698
|
+
character.life -= 1;
|
|
21699
|
+
if (character.life <= 0) {
|
|
21700
|
+
characters.delete(id);
|
|
21701
|
+
_this._isDirty = true;
|
|
21702
|
+
}
|
|
21692
21703
|
}
|
|
21704
|
+
});
|
|
21705
|
+
}
|
|
21706
|
+
else {
|
|
21707
|
+
this._life -= 1;
|
|
21708
|
+
if (this._life <= 0 && 0 < characters.size) {
|
|
21709
|
+
characters.clear();
|
|
21710
|
+
this._isDirty = true;
|
|
21693
21711
|
}
|
|
21694
21712
|
}
|
|
21695
21713
|
};
|
|
21696
|
-
DynamicSDFFontAtlas.prototype.
|
|
21697
|
-
|
|
21698
|
-
this.addChar("\t", " ", DynamicFontAtlasCharacterType.SPACE_R);
|
|
21699
|
-
this.addChar("...", "...", DynamicFontAtlasCharacterType.LETTER_RNB);
|
|
21700
|
-
for (var i = 0, imax = ASCII_CHARACTERS.length; i < imax; ++i) {
|
|
21701
|
-
var char = ASCII_CHARACTERS[i];
|
|
21702
|
-
this.addChar(char, char, DynamicFontAtlasCharacterType.LETTER_RNB);
|
|
21703
|
-
}
|
|
21714
|
+
DynamicSDFFontAtlas.prototype.newChar = function (character, type) {
|
|
21715
|
+
return new DynamicFontAtlasCharacter(type, character, 0, 0, 1, 1, 0);
|
|
21704
21716
|
};
|
|
21705
|
-
DynamicSDFFontAtlas.prototype.
|
|
21706
|
-
var
|
|
21707
|
-
|
|
21708
|
-
var
|
|
21717
|
+
DynamicSDFFontAtlas.prototype.add = function (characters, nacharacters) {
|
|
21718
|
+
var cs = this._characters;
|
|
21719
|
+
for (var i = 0, imax = nacharacters.length; i < imax; ++i) {
|
|
21720
|
+
var nac = nacharacters[i];
|
|
21721
|
+
var data = cs.get(nac);
|
|
21709
21722
|
if (data != null) {
|
|
21710
|
-
if (data.ref <= 0) {
|
|
21711
|
-
this._length += 1;
|
|
21712
|
-
}
|
|
21713
21723
|
data.ref += 1;
|
|
21724
|
+
data.life = DynamicFontAtlasCharacter.LIFE;
|
|
21714
21725
|
}
|
|
21715
21726
|
else {
|
|
21716
|
-
|
|
21717
|
-
this._length += 1;
|
|
21727
|
+
cs.set(nac, this.newChar(nac, DynamicFontAtlasCharacterType.LETTER));
|
|
21718
21728
|
this._isDirty = true;
|
|
21719
21729
|
}
|
|
21720
21730
|
}
|
|
21721
|
-
|
|
21722
|
-
|
|
21723
|
-
switch (character) {
|
|
21724
|
-
case "\n": // Line feed
|
|
21725
|
-
return true;
|
|
21726
|
-
case "\r": // Carriage return
|
|
21727
|
-
return true;
|
|
21728
|
-
case "\v": // Vertical tab
|
|
21729
|
-
return true;
|
|
21730
|
-
case "\f": // Form feed
|
|
21731
|
-
return true;
|
|
21732
|
-
case "\u0085": // Next line
|
|
21733
|
-
return true;
|
|
21734
|
-
}
|
|
21735
|
-
return false;
|
|
21736
|
-
};
|
|
21737
|
-
DynamicSDFFontAtlas.prototype.add = function (characters, type) {
|
|
21738
|
-
if (type === void 0) { type = DynamicFontAtlasCharacterType.LETTER; }
|
|
21739
|
-
var iterator = UtilCharacterIterator.from(characters);
|
|
21740
|
-
while (iterator.hasNext()) {
|
|
21741
|
-
var character = iterator.next();
|
|
21742
|
-
this.addChar(character, character, type);
|
|
21731
|
+
if (0 < characters.length) {
|
|
21732
|
+
this._isTouched = true;
|
|
21743
21733
|
}
|
|
21744
21734
|
};
|
|
21745
21735
|
DynamicSDFFontAtlas.prototype.get = function (id) {
|
|
21746
|
-
return this._characters
|
|
21736
|
+
return this._characters.get(id);
|
|
21747
21737
|
};
|
|
21748
21738
|
DynamicSDFFontAtlas.prototype.update = function () {
|
|
21749
21739
|
if (this._isDirty) {
|
|
21750
21740
|
var canvas = this._canvas;
|
|
21751
21741
|
var generator = this._generator;
|
|
21752
21742
|
if (canvas != null && generator != null) {
|
|
21753
|
-
var
|
|
21754
|
-
if (
|
|
21743
|
+
var context_1 = canvas.getContext("2d");
|
|
21744
|
+
if (context_1 != null) {
|
|
21755
21745
|
this._isDirty = false;
|
|
21756
21746
|
var font = this._font;
|
|
21747
|
+
var fontSize_1 = font.size + 14;
|
|
21757
21748
|
var characters = this._characters;
|
|
21758
|
-
var
|
|
21759
|
-
|
|
21760
|
-
this._width = width;
|
|
21749
|
+
var width_1 = this.toPowerOf2(Math.ceil(Math.sqrt(characters.size)) * fontSize_1);
|
|
21750
|
+
this._width = width_1;
|
|
21761
21751
|
var fontStyle = (font.italic ? "italic " : "") + (font.size + "px ") + font.id;
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
UtilFont.measure(
|
|
21771
|
-
var
|
|
21772
|
-
var
|
|
21773
|
-
var
|
|
21774
|
-
var
|
|
21775
|
-
|
|
21776
|
-
var
|
|
21777
|
-
var
|
|
21778
|
-
var
|
|
21779
|
-
|
|
21780
|
-
|
|
21781
|
-
|
|
21782
|
-
y += characterSize;
|
|
21752
|
+
context_1.font = fontStyle;
|
|
21753
|
+
context_1.textAlign = "left";
|
|
21754
|
+
context_1.textBaseline = "alphabetic";
|
|
21755
|
+
context_1.lineWidth = 0;
|
|
21756
|
+
context_1.lineCap = "round";
|
|
21757
|
+
context_1.lineJoin = "miter";
|
|
21758
|
+
context_1.miterLimit = 10;
|
|
21759
|
+
context_1.fillStyle = "#FFFFFF";
|
|
21760
|
+
UtilFont.measure(context_1, font);
|
|
21761
|
+
var offsetX_1 = 7;
|
|
21762
|
+
var offsetY_1 = Math.round((fontSize_1 - (font.ascent + font.descent)) * 0.5 + font.ascent);
|
|
21763
|
+
var x_1 = 0;
|
|
21764
|
+
var y_1 = 0;
|
|
21765
|
+
characters.forEach(function (character) {
|
|
21766
|
+
var advance = context_1.measureText(character.character).width;
|
|
21767
|
+
var characterWidth = Math.ceil(offsetX_1 + advance + offsetX_1);
|
|
21768
|
+
var characterHeight = fontSize_1;
|
|
21769
|
+
if (width_1 <= x_1 + characterWidth) {
|
|
21770
|
+
x_1 = 0;
|
|
21771
|
+
y_1 += fontSize_1;
|
|
21783
21772
|
}
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
}
|
|
21793
|
-
var height = (this._height =
|
|
21773
|
+
character.x = x_1;
|
|
21774
|
+
character.y = y_1;
|
|
21775
|
+
character.width = characterWidth;
|
|
21776
|
+
character.height = characterHeight;
|
|
21777
|
+
character.advance = advance;
|
|
21778
|
+
character.origin.x = x_1 + offsetX_1;
|
|
21779
|
+
character.origin.y = y_1 + offsetY_1;
|
|
21780
|
+
x_1 += characterWidth;
|
|
21781
|
+
});
|
|
21782
|
+
var height = (this._height = y_1 + fontSize_1);
|
|
21794
21783
|
// Make a input canvas
|
|
21795
21784
|
// Here, we need to reset the context because
|
|
21796
21785
|
// context settings will be lost when we set the width/height.
|
|
21797
|
-
canvas.width =
|
|
21786
|
+
canvas.width = width_1;
|
|
21798
21787
|
canvas.height = height;
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
}
|
|
21788
|
+
context_1.font = fontStyle;
|
|
21789
|
+
context_1.textAlign = "left";
|
|
21790
|
+
context_1.textBaseline = "alphabetic";
|
|
21791
|
+
context_1.lineWidth = 0;
|
|
21792
|
+
context_1.lineCap = "round";
|
|
21793
|
+
context_1.lineJoin = "miter";
|
|
21794
|
+
context_1.miterLimit = 10;
|
|
21795
|
+
context_1.fillStyle = "#FFFFFF";
|
|
21796
|
+
context_1.clearRect(0, 0, width_1, height);
|
|
21797
|
+
characters.forEach(function (character) {
|
|
21798
|
+
context_1.fillText(character.character, character.origin.x, character.origin.y);
|
|
21799
|
+
});
|
|
21812
21800
|
// Convert to SDF font texture
|
|
21813
|
-
generator.updateTexture(
|
|
21801
|
+
generator.updateTexture(width_1, height, canvas);
|
|
21814
21802
|
generator.render();
|
|
21815
21803
|
generator.read(canvas);
|
|
21816
21804
|
return true;
|
|
@@ -21821,7 +21809,7 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21821
21809
|
};
|
|
21822
21810
|
Object.defineProperty(DynamicSDFFontAtlas.prototype, "length", {
|
|
21823
21811
|
get: function () {
|
|
21824
|
-
return this.
|
|
21812
|
+
return this._characters.size;
|
|
21825
21813
|
},
|
|
21826
21814
|
enumerable: false,
|
|
21827
21815
|
configurable: true
|
|
@@ -21846,10 +21834,7 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21846
21834
|
if (canvas != null) {
|
|
21847
21835
|
this._canvas = null;
|
|
21848
21836
|
}
|
|
21849
|
-
|
|
21850
|
-
for (var id in characters) {
|
|
21851
|
-
delete characters[id];
|
|
21852
|
-
}
|
|
21837
|
+
this._characters.clear();
|
|
21853
21838
|
};
|
|
21854
21839
|
DynamicSDFFontAtlas.prototype.toPowerOf2 = function (size) {
|
|
21855
21840
|
var result = 32;
|
|
@@ -21867,52 +21852,45 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21867
21852
|
*/
|
|
21868
21853
|
var DynamicSDFFontAtlases = /** @class */ (function () {
|
|
21869
21854
|
function DynamicSDFFontAtlases() {
|
|
21870
|
-
this._atlases =
|
|
21855
|
+
this._atlases = new Map();
|
|
21871
21856
|
}
|
|
21872
21857
|
DynamicSDFFontAtlases.prototype.begin = function () {
|
|
21873
|
-
|
|
21874
|
-
for (var family in atlases) {
|
|
21875
|
-
var atlas = atlases[family];
|
|
21858
|
+
this._atlases.forEach(function (atlas) {
|
|
21876
21859
|
atlas.begin();
|
|
21877
|
-
}
|
|
21860
|
+
});
|
|
21878
21861
|
};
|
|
21879
21862
|
DynamicSDFFontAtlases.prototype.end = function () {
|
|
21880
21863
|
var atlases = this._atlases;
|
|
21881
|
-
|
|
21882
|
-
var atlas = atlases[family];
|
|
21883
|
-
if (0 < atlas.length) {
|
|
21884
|
-
atlas.addAscii();
|
|
21885
|
-
}
|
|
21864
|
+
atlases.forEach(function (atlas, family) {
|
|
21886
21865
|
atlas.end();
|
|
21887
21866
|
if (atlas.length <= 0) {
|
|
21888
21867
|
atlas.destroy();
|
|
21889
|
-
delete
|
|
21868
|
+
atlases.delete(family);
|
|
21890
21869
|
}
|
|
21891
|
-
}
|
|
21870
|
+
});
|
|
21892
21871
|
};
|
|
21893
|
-
DynamicSDFFontAtlases.prototype.add = function (family,
|
|
21894
|
-
var
|
|
21872
|
+
DynamicSDFFontAtlases.prototype.add = function (family, characters, nacharacters) {
|
|
21873
|
+
var atlases = this._atlases;
|
|
21874
|
+
var atlas = atlases.get(family);
|
|
21895
21875
|
if (atlas != null) {
|
|
21896
|
-
atlas.add(
|
|
21876
|
+
atlas.add(characters, nacharacters);
|
|
21897
21877
|
}
|
|
21898
21878
|
else {
|
|
21899
21879
|
var newAtlas = new DynamicSDFFontAtlas(family);
|
|
21900
|
-
newAtlas.add(
|
|
21901
|
-
|
|
21880
|
+
newAtlas.add(characters, nacharacters);
|
|
21881
|
+
atlases.set(family, newAtlas);
|
|
21902
21882
|
}
|
|
21903
21883
|
};
|
|
21904
21884
|
DynamicSDFFontAtlases.prototype.get = function (family) {
|
|
21905
|
-
var atlas = this._atlases
|
|
21885
|
+
var atlas = this._atlases.get(family);
|
|
21906
21886
|
if (atlas != null) {
|
|
21907
21887
|
return atlas;
|
|
21908
21888
|
}
|
|
21909
21889
|
return null;
|
|
21910
21890
|
};
|
|
21911
21891
|
DynamicSDFFontAtlases.prototype.update = function (baseAtlas) {
|
|
21912
|
-
var atlases = this._atlases;
|
|
21913
21892
|
var baseTexture = baseAtlas.getBaseTexture();
|
|
21914
|
-
|
|
21915
|
-
var atlas = atlases[family];
|
|
21893
|
+
this._atlases.forEach(function (atlas) {
|
|
21916
21894
|
if (atlas.update()) {
|
|
21917
21895
|
var atlasId = atlas.id;
|
|
21918
21896
|
var item = baseAtlas.get(atlasId);
|
|
@@ -21930,15 +21908,14 @@ var DynamicSDFFontAtlases = /** @class */ (function () {
|
|
|
21930
21908
|
baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
|
|
21931
21909
|
}
|
|
21932
21910
|
}
|
|
21933
|
-
}
|
|
21911
|
+
});
|
|
21934
21912
|
};
|
|
21935
21913
|
DynamicSDFFontAtlases.prototype.destroy = function () {
|
|
21936
21914
|
var atlases = this._atlases;
|
|
21937
|
-
|
|
21938
|
-
var atlas = atlases[family];
|
|
21915
|
+
atlases.forEach(function (atlas) {
|
|
21939
21916
|
atlas.destroy();
|
|
21940
|
-
}
|
|
21941
|
-
|
|
21917
|
+
});
|
|
21918
|
+
atlases.clear();
|
|
21942
21919
|
};
|
|
21943
21920
|
return DynamicSDFFontAtlases;
|
|
21944
21921
|
}());
|
|
@@ -22326,9 +22303,9 @@ var EShapeRenderer = /** @class */ (function (_super) {
|
|
|
22326
22303
|
}
|
|
22327
22304
|
// Font texture atlas
|
|
22328
22305
|
var text = shape.text;
|
|
22329
|
-
var
|
|
22330
|
-
if (0 <
|
|
22331
|
-
fontAtlases.add(text.family,
|
|
22306
|
+
var textCharacters = text.characters;
|
|
22307
|
+
if (0 < textCharacters.length) {
|
|
22308
|
+
fontAtlases.add(text.family, textCharacters, text.nacharacters);
|
|
22332
22309
|
}
|
|
22333
22310
|
};
|
|
22334
22311
|
EShapeRenderer.prototype.updateAtlases = function (shapes, atlas, fontAtlases, defaultTexture, baseTexture) {
|
|
@@ -28695,6 +28672,74 @@ var DDynamicTextMeasureResult = /** @class */ (function () {
|
|
|
28695
28672
|
return DDynamicTextMeasureResult;
|
|
28696
28673
|
}());
|
|
28697
28674
|
|
|
28675
|
+
/*
|
|
28676
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
28677
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
28678
|
+
*/
|
|
28679
|
+
var UtilCharacterIterator = /** @class */ (function () {
|
|
28680
|
+
function UtilCharacterIterator() {
|
|
28681
|
+
this.target = "";
|
|
28682
|
+
this.position = 0;
|
|
28683
|
+
}
|
|
28684
|
+
UtilCharacterIterator.prototype.init = function (target) {
|
|
28685
|
+
this.target = target;
|
|
28686
|
+
this.position = 0;
|
|
28687
|
+
};
|
|
28688
|
+
UtilCharacterIterator.prototype.hasNext = function () {
|
|
28689
|
+
return this.position < this.target.length;
|
|
28690
|
+
};
|
|
28691
|
+
UtilCharacterIterator.prototype.findNextBreak = function (target, istart) {
|
|
28692
|
+
var iend = target.length;
|
|
28693
|
+
for (var i = istart; i < iend; ++i) {
|
|
28694
|
+
var code = target.charCodeAt(i);
|
|
28695
|
+
if (!this.isLowSurrogate(code) && !this.isVariationSelector(code)) {
|
|
28696
|
+
return i;
|
|
28697
|
+
}
|
|
28698
|
+
}
|
|
28699
|
+
return iend;
|
|
28700
|
+
};
|
|
28701
|
+
UtilCharacterIterator.prototype.isHighSurrogate = function (code) {
|
|
28702
|
+
return 0xd800 <= code && code <= 0xdbff;
|
|
28703
|
+
};
|
|
28704
|
+
UtilCharacterIterator.prototype.isLowSurrogate = function (code) {
|
|
28705
|
+
return 0xdc00 <= code && code <= 0xdfff;
|
|
28706
|
+
};
|
|
28707
|
+
UtilCharacterIterator.prototype.isVariationSelector = function (code) {
|
|
28708
|
+
return 0xfe00 <= code && code <= 0xfe0f;
|
|
28709
|
+
};
|
|
28710
|
+
UtilCharacterIterator.prototype.next = function () {
|
|
28711
|
+
var target = this.target;
|
|
28712
|
+
var position = this.position;
|
|
28713
|
+
var nextBreak = this.findNextBreak(target, position + 1);
|
|
28714
|
+
var result = target.substring(position, nextBreak);
|
|
28715
|
+
this.position = nextBreak;
|
|
28716
|
+
return result;
|
|
28717
|
+
};
|
|
28718
|
+
/**
|
|
28719
|
+
* Closes this iterator.
|
|
28720
|
+
*
|
|
28721
|
+
* @returns true if closed.
|
|
28722
|
+
*/
|
|
28723
|
+
UtilCharacterIterator.prototype.close = function () {
|
|
28724
|
+
var length = this.target.length;
|
|
28725
|
+
if (this.position < length) {
|
|
28726
|
+
this.position = length;
|
|
28727
|
+
return true;
|
|
28728
|
+
}
|
|
28729
|
+
return false;
|
|
28730
|
+
};
|
|
28731
|
+
UtilCharacterIterator.from = function (target) {
|
|
28732
|
+
if (UtilCharacterIterator._instance == null) {
|
|
28733
|
+
UtilCharacterIterator._instance = new UtilCharacterIterator();
|
|
28734
|
+
}
|
|
28735
|
+
var instance = UtilCharacterIterator._instance;
|
|
28736
|
+
instance.init(target);
|
|
28737
|
+
return instance;
|
|
28738
|
+
};
|
|
28739
|
+
UtilCharacterIterator._instance = null;
|
|
28740
|
+
return UtilCharacterIterator;
|
|
28741
|
+
}());
|
|
28742
|
+
|
|
28698
28743
|
/*
|
|
28699
28744
|
* Copyright (C) 2019 Toshiba Corporation
|
|
28700
28745
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -28705,7 +28750,6 @@ var DDynamicTextStyleWordWrap = {
|
|
|
28705
28750
|
BREAK_ALL: 2
|
|
28706
28751
|
};
|
|
28707
28752
|
|
|
28708
|
-
var NEW_LINE = "\n";
|
|
28709
28753
|
var DDynamicTextMeasure = /** @class */ (function () {
|
|
28710
28754
|
function DDynamicTextMeasure() {
|
|
28711
28755
|
}
|
|
@@ -28775,7 +28819,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28775
28819
|
while (iterator.hasNext()) {
|
|
28776
28820
|
var characterPosition = iterator.position;
|
|
28777
28821
|
var character = iterator.next();
|
|
28778
|
-
if (character === NEW_LINE) {
|
|
28822
|
+
if (character === Character.NEW_LINE) {
|
|
28779
28823
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28780
28824
|
result.newLine(lineHeight);
|
|
28781
28825
|
}
|
|
@@ -28807,7 +28851,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28807
28851
|
DDynamicTextMeasure.measure1b = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28808
28852
|
while (iterator.hasNext()) {
|
|
28809
28853
|
var character = iterator.next();
|
|
28810
|
-
if (character === NEW_LINE) {
|
|
28854
|
+
if (character === Character.NEW_LINE) {
|
|
28811
28855
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28812
28856
|
result.newLine(lineHeight);
|
|
28813
28857
|
}
|
|
@@ -28838,7 +28882,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28838
28882
|
DDynamicTextMeasure.measure1 = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28839
28883
|
while (iterator.hasNext()) {
|
|
28840
28884
|
var character = iterator.next();
|
|
28841
|
-
if (character === NEW_LINE) {
|
|
28885
|
+
if (character === Character.NEW_LINE) {
|
|
28842
28886
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28843
28887
|
result.newLine(lineHeight);
|
|
28844
28888
|
}
|
|
@@ -28870,7 +28914,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28870
28914
|
while (iterator.hasNext()) {
|
|
28871
28915
|
var characterPosition = iterator.position;
|
|
28872
28916
|
var character = iterator.next();
|
|
28873
|
-
if (character === NEW_LINE) {
|
|
28917
|
+
if (character === Character.NEW_LINE) {
|
|
28874
28918
|
result.newLine(lineHeight);
|
|
28875
28919
|
}
|
|
28876
28920
|
else {
|
|
@@ -28892,7 +28936,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28892
28936
|
DDynamicTextMeasure.measure2b = function (iterator, clippingWidth, lineHeight, atlas, result) {
|
|
28893
28937
|
while (iterator.hasNext()) {
|
|
28894
28938
|
var character = iterator.next();
|
|
28895
|
-
if (character === NEW_LINE) {
|
|
28939
|
+
if (character === Character.NEW_LINE) {
|
|
28896
28940
|
result.newLine(lineHeight);
|
|
28897
28941
|
}
|
|
28898
28942
|
else {
|
|
@@ -28913,7 +28957,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28913
28957
|
DDynamicTextMeasure.measure2 = function (iterator, clippingWidth, lineHeight, atlas, result) {
|
|
28914
28958
|
while (iterator.hasNext()) {
|
|
28915
28959
|
var character = iterator.next();
|
|
28916
|
-
if (character === NEW_LINE) {
|
|
28960
|
+
if (character === Character.NEW_LINE) {
|
|
28917
28961
|
result.newLine(lineHeight);
|
|
28918
28962
|
}
|
|
28919
28963
|
else {
|
|
@@ -28933,7 +28977,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28933
28977
|
DDynamicTextMeasure.measure3 = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28934
28978
|
while (iterator.hasNext()) {
|
|
28935
28979
|
var character = iterator.next();
|
|
28936
|
-
if (character === NEW_LINE) {
|
|
28980
|
+
if (character === Character.NEW_LINE) {
|
|
28937
28981
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28938
28982
|
result.newLine(lineHeight);
|
|
28939
28983
|
}
|
|
@@ -28957,7 +29001,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28957
29001
|
DDynamicTextMeasure.measure4 = function (iterator, lineHeight, atlas, result) {
|
|
28958
29002
|
while (iterator.hasNext()) {
|
|
28959
29003
|
var character = iterator.next();
|
|
28960
|
-
if (character === NEW_LINE) {
|
|
29004
|
+
if (character === Character.NEW_LINE) {
|
|
28961
29005
|
result.newLine(lineHeight);
|
|
28962
29006
|
}
|
|
28963
29007
|
else {
|
|
@@ -28970,7 +29014,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28970
29014
|
};
|
|
28971
29015
|
DDynamicTextMeasure.measure5 = function (iterator, clippingWidth, lineHeight, atlas, result, close) {
|
|
28972
29016
|
result.clipped = true;
|
|
28973
|
-
var dots = atlas.get(
|
|
29017
|
+
var dots = atlas.get(Character.DOTS);
|
|
28974
29018
|
if (dots != null) {
|
|
28975
29019
|
while (!result.isPushable(clippingWidth, dots)) {
|
|
28976
29020
|
if (!result.pop()) {
|
|
@@ -28986,7 +29030,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28986
29030
|
}
|
|
28987
29031
|
else {
|
|
28988
29032
|
while (iterator.hasNext()) {
|
|
28989
|
-
if (iterator.next() === NEW_LINE) {
|
|
29033
|
+
if (iterator.next() === Character.NEW_LINE) {
|
|
28990
29034
|
result.newLine(lineHeight);
|
|
28991
29035
|
break;
|
|
28992
29036
|
}
|
|
@@ -29070,47 +29114,61 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
29070
29114
|
var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
29071
29115
|
__extends(DDynamicTextGeometry, _super);
|
|
29072
29116
|
function DDynamicTextGeometry() {
|
|
29073
|
-
var
|
|
29117
|
+
var _a, _b, _c;
|
|
29118
|
+
var _this = _super.call(this, ((_a = DDynamicTextGeometry.VERTICES) !== null && _a !== void 0 ? _a : (DDynamicTextGeometry.VERTICES = new Float32Array(0))), ((_b = DDynamicTextGeometry.UVS) !== null && _b !== void 0 ? _b : (DDynamicTextGeometry.UVS = new Float32Array(0))), ((_c = DDynamicTextGeometry.INDICES) !== null && _c !== void 0 ? _c : (DDynamicTextGeometry.INDICES = new Uint16Array(0)))) || this;
|
|
29074
29119
|
_this.width = 0;
|
|
29075
29120
|
_this.height = 0;
|
|
29076
29121
|
_this.scale = 1;
|
|
29077
29122
|
_this.scaled = false;
|
|
29078
29123
|
_this.clipped = false;
|
|
29124
|
+
_this.vertexBuffer = _this.getBuffer("aVertexPosition");
|
|
29125
|
+
_this.vertices = DDynamicTextGeometry.VERTICES;
|
|
29126
|
+
_this.uvBuffer = _this.getBuffer("aTextureCoord");
|
|
29127
|
+
_this.uvs = DDynamicTextGeometry.UVS;
|
|
29128
|
+
_this.indexBuffer = _this.getIndex();
|
|
29129
|
+
_this.indices = DDynamicTextGeometry.INDICES;
|
|
29130
|
+
_this.nchars = 0;
|
|
29079
29131
|
return _this;
|
|
29080
29132
|
}
|
|
29081
29133
|
DDynamicTextGeometry.prototype.update = function (text, atlas, modifier) {
|
|
29082
|
-
var vertexBuffer = this.getBuffer("aVertexPosition");
|
|
29083
|
-
var uvBuffer = this.getBuffer("aTextureCoord");
|
|
29084
|
-
var indexBuffer = this.getIndex();
|
|
29085
29134
|
var result = DDynamicTextMeasure.measure(text, atlas, modifier);
|
|
29086
|
-
var
|
|
29087
|
-
var
|
|
29088
|
-
if (
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
|
|
29098
|
-
|
|
29135
|
+
var resultCount = result.count;
|
|
29136
|
+
var nchars = ((resultCount >> 3) + (resultCount & 0x7 ? 1 : 0)) << 3;
|
|
29137
|
+
if (this.nchars < nchars) {
|
|
29138
|
+
this.nchars = nchars;
|
|
29139
|
+
var nvertex = nchars << 3;
|
|
29140
|
+
this.vertices = new Float32Array(nvertex);
|
|
29141
|
+
this.uvs = new Float32Array(nvertex);
|
|
29142
|
+
this.vertexBuffer.data = this.vertices;
|
|
29143
|
+
this.uvBuffer.data = this.uvs;
|
|
29144
|
+
var nindex = (nchars << 2) + (nchars << 1);
|
|
29145
|
+
this.indices = new Uint16Array(nindex);
|
|
29146
|
+
this.indexBuffer.data = this.indices;
|
|
29147
|
+
this.initIndices(this.indices);
|
|
29148
|
+
this.indexBuffer.update();
|
|
29149
|
+
}
|
|
29150
|
+
else {
|
|
29151
|
+
nchars = this.nchars;
|
|
29152
|
+
}
|
|
29153
|
+
if (nchars <= 0) {
|
|
29154
|
+
return;
|
|
29155
|
+
}
|
|
29156
|
+
var vertices = this.vertices;
|
|
29157
|
+
var uvs = this.uvs;
|
|
29099
29158
|
if (atlas != null) {
|
|
29100
|
-
var count = result.count;
|
|
29101
29159
|
var characters = result.characters;
|
|
29102
29160
|
var scale = result.scale;
|
|
29103
|
-
|
|
29161
|
+
var fw = 1 / atlas.width;
|
|
29162
|
+
var fh = 1 / atlas.height;
|
|
29163
|
+
for (var i = 0; i < resultCount; ++i) {
|
|
29104
29164
|
var character = characters[i];
|
|
29105
29165
|
var cx = character.x;
|
|
29106
29166
|
var cy = character.y;
|
|
29107
29167
|
var cc = character.character;
|
|
29108
|
-
|
|
29109
|
-
var h = atlas.height;
|
|
29110
|
-
this.writeCharacter(vertices, uvs, indices, i, cx, cy, scale, cc, w, h);
|
|
29168
|
+
this.fill(vertices, uvs, i, cx, cy, scale, cc, fw, fh);
|
|
29111
29169
|
}
|
|
29112
|
-
for (var i =
|
|
29113
|
-
this.
|
|
29170
|
+
for (var i = resultCount; i < nchars; ++i) {
|
|
29171
|
+
this.fillBlank(vertices, uvs, i);
|
|
29114
29172
|
}
|
|
29115
29173
|
this.width = result.width * scale;
|
|
29116
29174
|
this.height = result.height * scale;
|
|
@@ -29119,8 +29177,8 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29119
29177
|
this.clipped = result.clipped;
|
|
29120
29178
|
}
|
|
29121
29179
|
else {
|
|
29122
|
-
for (var i = 0
|
|
29123
|
-
this.
|
|
29180
|
+
for (var i = 0; i < nchars; ++i) {
|
|
29181
|
+
this.fillBlank(vertices, uvs, i);
|
|
29124
29182
|
}
|
|
29125
29183
|
this.width = 0;
|
|
29126
29184
|
this.height = 0;
|
|
@@ -29128,11 +29186,10 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29128
29186
|
this.scaled = false;
|
|
29129
29187
|
this.clipped = false;
|
|
29130
29188
|
}
|
|
29131
|
-
vertexBuffer.update();
|
|
29132
|
-
uvBuffer.update();
|
|
29133
|
-
indexBuffer.update();
|
|
29189
|
+
this.vertexBuffer.update();
|
|
29190
|
+
this.uvBuffer.update();
|
|
29134
29191
|
};
|
|
29135
|
-
DDynamicTextGeometry.prototype.
|
|
29192
|
+
DDynamicTextGeometry.prototype.fill = function (vertices, uvs, index, x, y, scale, character, fw, fh) {
|
|
29136
29193
|
var cx = character.x;
|
|
29137
29194
|
var cy = character.y;
|
|
29138
29195
|
var cw = character.width;
|
|
@@ -29151,10 +29208,10 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29151
29208
|
vertices[iv + 5] = y1;
|
|
29152
29209
|
vertices[iv + 6] = x0;
|
|
29153
29210
|
vertices[iv + 7] = y1;
|
|
29154
|
-
var u0 = cx
|
|
29155
|
-
var v0 = cy
|
|
29156
|
-
var u1 = (cx + cw)
|
|
29157
|
-
var v1 = (cy + ch)
|
|
29211
|
+
var u0 = cx * fw;
|
|
29212
|
+
var v0 = cy * fh;
|
|
29213
|
+
var u1 = (cx + cw) * fw;
|
|
29214
|
+
var v1 = (cy + ch) * fh;
|
|
29158
29215
|
uvs[iv + 0] = u0;
|
|
29159
29216
|
uvs[iv + 1] = v0;
|
|
29160
29217
|
uvs[iv + 2] = u1;
|
|
@@ -29163,16 +29220,8 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29163
29220
|
uvs[iv + 5] = v1;
|
|
29164
29221
|
uvs[iv + 6] = u0;
|
|
29165
29222
|
uvs[iv + 7] = v1;
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
indices[ii + 0] = vo + 0;
|
|
29169
|
-
indices[ii + 1] = vo + 1;
|
|
29170
|
-
indices[ii + 2] = vo + 3;
|
|
29171
|
-
indices[ii + 3] = vo + 1;
|
|
29172
|
-
indices[ii + 4] = vo + 2;
|
|
29173
|
-
indices[ii + 5] = vo + 3;
|
|
29174
|
-
};
|
|
29175
|
-
DDynamicTextGeometry.prototype.writeCharacterEmpty = function (vertices, uvs, indices, index) {
|
|
29223
|
+
};
|
|
29224
|
+
DDynamicTextGeometry.prototype.fillBlank = function (vertices, uvs, index) {
|
|
29176
29225
|
var iv = index << 3;
|
|
29177
29226
|
vertices[iv + 0] = 0;
|
|
29178
29227
|
vertices[iv + 1] = 0;
|
|
@@ -29190,14 +29239,16 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29190
29239
|
uvs[iv + 5] = 0;
|
|
29191
29240
|
uvs[iv + 6] = 0;
|
|
29192
29241
|
uvs[iv + 7] = 0;
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
|
|
29200
|
-
|
|
29242
|
+
};
|
|
29243
|
+
DDynamicTextGeometry.prototype.initIndices = function (indices) {
|
|
29244
|
+
for (var iv = 0, ivmax = this.nchars << 2, ii = 0; iv < ivmax; iv += 4, ii += 6) {
|
|
29245
|
+
indices[ii] = iv;
|
|
29246
|
+
indices[ii + 1] = iv + 1;
|
|
29247
|
+
indices[ii + 2] = iv + 3;
|
|
29248
|
+
indices[ii + 3] = iv + 1;
|
|
29249
|
+
indices[ii + 4] = iv + 2;
|
|
29250
|
+
indices[ii + 5] = iv + 3;
|
|
29251
|
+
}
|
|
29201
29252
|
};
|
|
29202
29253
|
return DDynamicTextGeometry;
|
|
29203
29254
|
}(pixi_js.MeshGeometry));
|
|
@@ -70090,26 +70141,26 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70090
70141
|
var padding = this.toPadding(fontSize);
|
|
70091
70142
|
this._padding = padding;
|
|
70092
70143
|
this._font = new DynamicFontAtlasFont(fontId, fontSize, fontColor, padding);
|
|
70093
|
-
this._characters = {};
|
|
70094
|
-
this._length = 0;
|
|
70095
70144
|
this._unrefCount = 0;
|
|
70096
70145
|
this._width = 1;
|
|
70097
70146
|
this._height = 1;
|
|
70098
|
-
this._revision = 0;
|
|
70099
70147
|
this._revisionUpdated = 0;
|
|
70100
70148
|
this._texture = pixi_js.Texture.from(this._canvas, {
|
|
70101
70149
|
mipmap: pixi_js.MIPMAP_MODES.OFF,
|
|
70102
70150
|
resolution: resolution,
|
|
70103
70151
|
scaleMode: pixi_js.SCALE_MODES.NEAREST
|
|
70104
70152
|
});
|
|
70105
|
-
var characters =
|
|
70106
|
-
|
|
70107
|
-
|
|
70108
|
-
|
|
70109
|
-
for (var i = 0, imax =
|
|
70110
|
-
var
|
|
70111
|
-
|
|
70112
|
-
}
|
|
70153
|
+
var characters = new Map();
|
|
70154
|
+
characters.set(Character.SPACE, this.newChar(Character.SPACE, DynamicFontAtlasCharacterType.SPACE_R));
|
|
70155
|
+
characters.set(Character.TAB, this.newChar(Character.SOFT_TAB, DynamicFontAtlasCharacterType.SPACE_R));
|
|
70156
|
+
characters.set(Character.DOTS, this.newChar(Character.DOTS, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
70157
|
+
for (var i = 0, imax = Character.ASCII.length; i < imax; ++i) {
|
|
70158
|
+
var ac = Character.ASCII[i];
|
|
70159
|
+
characters.set(ac, this.newChar(ac, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
70160
|
+
}
|
|
70161
|
+
this._characters = characters;
|
|
70162
|
+
this._createds = new Map();
|
|
70163
|
+
this._revision = 1;
|
|
70113
70164
|
}
|
|
70114
70165
|
DynamicFontAtlas.prototype.toPadding = function (fontSize) {
|
|
70115
70166
|
return Math.max(3, Math.ceil(fontSize * 0.2));
|
|
@@ -70163,86 +70214,106 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70163
70214
|
enumerable: false,
|
|
70164
70215
|
configurable: true
|
|
70165
70216
|
});
|
|
70166
|
-
DynamicFontAtlas.prototype.
|
|
70167
|
-
|
|
70168
|
-
|
|
70169
|
-
|
|
70170
|
-
|
|
70171
|
-
|
|
70217
|
+
DynamicFontAtlas.prototype.newChar = function (character, type) {
|
|
70218
|
+
var advance = this.getAdvance(character);
|
|
70219
|
+
var padding = this._padding;
|
|
70220
|
+
var width = Math.ceil(padding + advance + padding);
|
|
70221
|
+
var height = this.font.height;
|
|
70222
|
+
return new DynamicFontAtlasCharacter(type, character, -width, // Setting X and Y to zeros leads to render the character at the UV coordinate (0, 0).
|
|
70223
|
+
-height, width, height, advance);
|
|
70224
|
+
};
|
|
70225
|
+
DynamicFontAtlas.prototype.add = function (characters, type) {
|
|
70226
|
+
var cs = this._characters;
|
|
70227
|
+
var cds = this._createds;
|
|
70228
|
+
for (var i = 0, imax = characters.length; i < imax;) {
|
|
70229
|
+
if (characters.charCodeAt(i) <= 0xff) {
|
|
70230
|
+
// Ignore ASCII characters
|
|
70231
|
+
i += 1;
|
|
70232
|
+
continue;
|
|
70233
|
+
}
|
|
70234
|
+
var j = i + 1;
|
|
70235
|
+
for (; j < imax; ++j) {
|
|
70236
|
+
var cc = characters.charCodeAt(j);
|
|
70237
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
70238
|
+
// Low surrogate
|
|
70239
|
+
// Variation selector
|
|
70240
|
+
continue;
|
|
70241
|
+
}
|
|
70242
|
+
break;
|
|
70243
|
+
}
|
|
70244
|
+
// Increment the reference count or create a new one
|
|
70245
|
+
var nac = characters.substring(i, j);
|
|
70246
|
+
var c = cs.get(nac);
|
|
70247
|
+
if (c != null) {
|
|
70248
|
+
if (!(c.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
70249
|
+
if (c.ref === 0) {
|
|
70172
70250
|
this._unrefCount -= 1;
|
|
70173
70251
|
}
|
|
70174
|
-
|
|
70252
|
+
c.ref += 1;
|
|
70175
70253
|
}
|
|
70176
70254
|
}
|
|
70177
70255
|
else {
|
|
70178
|
-
var
|
|
70179
|
-
|
|
70180
|
-
|
|
70181
|
-
|
|
70182
|
-
|
|
70183
|
-
|
|
70184
|
-
|
|
70256
|
+
var cd = cds.get(nac);
|
|
70257
|
+
if (cd != null) {
|
|
70258
|
+
cd.ref = 1;
|
|
70259
|
+
cs.set(nac, cd);
|
|
70260
|
+
}
|
|
70261
|
+
else {
|
|
70262
|
+
var newCharacter = this.newChar(nac, type);
|
|
70263
|
+
cs.set(nac, newCharacter);
|
|
70264
|
+
cds.set(nac, newCharacter);
|
|
70265
|
+
}
|
|
70185
70266
|
this._revision += 1;
|
|
70186
70267
|
}
|
|
70268
|
+
// Go to the next
|
|
70269
|
+
i = j;
|
|
70187
70270
|
}
|
|
70188
70271
|
};
|
|
70189
|
-
DynamicFontAtlas.prototype.
|
|
70190
|
-
|
|
70191
|
-
|
|
70192
|
-
|
|
70193
|
-
|
|
70194
|
-
|
|
70195
|
-
|
|
70196
|
-
|
|
70197
|
-
|
|
70198
|
-
|
|
70199
|
-
|
|
70200
|
-
|
|
70201
|
-
|
|
70202
|
-
|
|
70203
|
-
|
|
70204
|
-
|
|
70205
|
-
|
|
70206
|
-
|
|
70207
|
-
|
|
70208
|
-
|
|
70209
|
-
|
|
70272
|
+
DynamicFontAtlas.prototype.remove = function (characters) {
|
|
70273
|
+
var cs = this._characters;
|
|
70274
|
+
for (var i = 0, imax = characters.length; i < imax;) {
|
|
70275
|
+
if (characters.charCodeAt(i) <= 0xff) {
|
|
70276
|
+
// Ignore ASCII characters
|
|
70277
|
+
i += 1;
|
|
70278
|
+
continue;
|
|
70279
|
+
}
|
|
70280
|
+
var j = i + 1;
|
|
70281
|
+
for (; j < imax; ++j) {
|
|
70282
|
+
var cc = characters.charCodeAt(j);
|
|
70283
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
70284
|
+
// Low surrogate
|
|
70285
|
+
// Variation selector
|
|
70286
|
+
continue;
|
|
70287
|
+
}
|
|
70288
|
+
break;
|
|
70289
|
+
}
|
|
70290
|
+
// Decrement the reference count
|
|
70291
|
+
var nac = characters.substring(i, j);
|
|
70292
|
+
var c = cs.get(nac);
|
|
70293
|
+
if (c != null && 0 < c.ref && !(c.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
70294
|
+
c.ref -= 1;
|
|
70295
|
+
if (c.ref === 0) {
|
|
70210
70296
|
this._unrefCount += 1;
|
|
70211
70297
|
}
|
|
70212
70298
|
}
|
|
70299
|
+
// Go to the next
|
|
70300
|
+
i = j;
|
|
70213
70301
|
}
|
|
70214
70302
|
};
|
|
70215
|
-
DynamicFontAtlas.prototype.
|
|
70216
|
-
|
|
70217
|
-
|
|
70218
|
-
|
|
70219
|
-
if (
|
|
70220
|
-
delete
|
|
70303
|
+
DynamicFontAtlas.prototype.cleanup = function () {
|
|
70304
|
+
var characters = this._characters;
|
|
70305
|
+
if (characters.size >> 1 <= this._unrefCount) {
|
|
70306
|
+
characters.forEach(function (char, id) {
|
|
70307
|
+
if (char.ref <= 0) {
|
|
70308
|
+
characters.delete(id);
|
|
70221
70309
|
}
|
|
70222
|
-
}
|
|
70223
|
-
this._length -= this._unrefCount;
|
|
70310
|
+
});
|
|
70224
70311
|
this._revision += 1;
|
|
70225
70312
|
this._unrefCount = 0;
|
|
70226
70313
|
}
|
|
70227
70314
|
};
|
|
70228
|
-
DynamicFontAtlas.prototype.add = function (targets, type) {
|
|
70229
|
-
if (type === void 0) { type = DynamicFontAtlasCharacterType.LETTER; }
|
|
70230
|
-
var characters = this._characters;
|
|
70231
|
-
var iterator = UtilCharacterIterator.from(targets);
|
|
70232
|
-
while (iterator.hasNext()) {
|
|
70233
|
-
var character = iterator.next();
|
|
70234
|
-
this.add_(character, character, characters, type);
|
|
70235
|
-
}
|
|
70236
|
-
};
|
|
70237
|
-
DynamicFontAtlas.prototype.remove = function (targets) {
|
|
70238
|
-
var characters = this._characters;
|
|
70239
|
-
var iterator = UtilCharacterIterator.from(targets);
|
|
70240
|
-
while (iterator.hasNext()) {
|
|
70241
|
-
this.remove_(iterator.next(), characters);
|
|
70242
|
-
}
|
|
70243
|
-
};
|
|
70244
70315
|
DynamicFontAtlas.prototype.get = function (id) {
|
|
70245
|
-
return this._characters
|
|
70316
|
+
return this._characters.get(id);
|
|
70246
70317
|
};
|
|
70247
70318
|
DynamicFontAtlas.prototype.getAdvance = function (target) {
|
|
70248
70319
|
var context = this.getContext();
|
|
@@ -70281,52 +70352,50 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70281
70352
|
return context;
|
|
70282
70353
|
};
|
|
70283
70354
|
DynamicFontAtlas.prototype.update = function () {
|
|
70284
|
-
this.
|
|
70355
|
+
this.cleanup();
|
|
70285
70356
|
if (this._revisionUpdated < this._revision) {
|
|
70286
70357
|
this._revisionUpdated = this._revision;
|
|
70287
70358
|
var canvas = this._canvas;
|
|
70288
70359
|
if (canvas != null) {
|
|
70289
70360
|
var font = this._font;
|
|
70290
|
-
var
|
|
70361
|
+
var fontHeight_1 = font.height;
|
|
70291
70362
|
var characters = this._characters;
|
|
70292
|
-
var
|
|
70293
|
-
var
|
|
70294
|
-
var
|
|
70295
|
-
var
|
|
70296
|
-
|
|
70297
|
-
|
|
70298
|
-
|
|
70299
|
-
|
|
70300
|
-
y += fontHeight;
|
|
70363
|
+
var width_1 = (this._width = this.toPowerOf2(Math.ceil(Math.sqrt(characters.size)) * fontHeight_1));
|
|
70364
|
+
var offsetX_1 = this._padding;
|
|
70365
|
+
var x_1 = 0;
|
|
70366
|
+
var y_1 = 0;
|
|
70367
|
+
characters.forEach(function (character) {
|
|
70368
|
+
if (width_1 <= x_1 + character.width) {
|
|
70369
|
+
x_1 = 0;
|
|
70370
|
+
y_1 += fontHeight_1;
|
|
70301
70371
|
}
|
|
70302
|
-
character.x =
|
|
70303
|
-
character.y =
|
|
70304
|
-
character.origin.x =
|
|
70305
|
-
|
|
70306
|
-
}
|
|
70307
|
-
var height = (this._height =
|
|
70372
|
+
character.x = x_1;
|
|
70373
|
+
character.y = y_1;
|
|
70374
|
+
character.origin.x = x_1 + offsetX_1;
|
|
70375
|
+
x_1 += character.width;
|
|
70376
|
+
});
|
|
70377
|
+
var height = (this._height = y_1 + fontHeight_1);
|
|
70308
70378
|
// Make an input canvas
|
|
70309
70379
|
// Here, we need to reset the context because
|
|
70310
70380
|
// context settings will be lost when we set the width/height.
|
|
70311
70381
|
var baseTexture = this._texture.baseTexture;
|
|
70312
70382
|
var resolution = baseTexture.resolution;
|
|
70313
|
-
var realWidth = Math.ceil(
|
|
70383
|
+
var realWidth = Math.ceil(width_1 * resolution);
|
|
70314
70384
|
var realHeight = Math.ceil(height * resolution);
|
|
70315
70385
|
canvas.width = realWidth;
|
|
70316
70386
|
canvas.height = realHeight;
|
|
70317
|
-
var
|
|
70318
|
-
if (
|
|
70319
|
-
UtilFont.measure(
|
|
70320
|
-
var
|
|
70321
|
-
|
|
70322
|
-
|
|
70323
|
-
|
|
70324
|
-
|
|
70325
|
-
|
|
70326
|
-
character.origin.
|
|
70327
|
-
|
|
70328
|
-
|
|
70329
|
-
context.restore();
|
|
70387
|
+
var context_1 = this.getContext();
|
|
70388
|
+
if (context_1 != null) {
|
|
70389
|
+
UtilFont.measure(context_1, font);
|
|
70390
|
+
var offsetY_1 = Math.round((fontHeight_1 - (font.ascent + font.descent)) * 0.5 + font.ascent);
|
|
70391
|
+
context_1.save();
|
|
70392
|
+
context_1.scale(resolution, resolution);
|
|
70393
|
+
context_1.clearRect(0, 0, width_1, height);
|
|
70394
|
+
characters.forEach(function (character) {
|
|
70395
|
+
character.origin.y = character.y + offsetY_1;
|
|
70396
|
+
context_1.fillText(character.character, character.origin.x, character.origin.y);
|
|
70397
|
+
});
|
|
70398
|
+
context_1.restore();
|
|
70330
70399
|
}
|
|
70331
70400
|
baseTexture.setRealSize(realWidth, realHeight);
|
|
70332
70401
|
return true;
|
|
@@ -70342,7 +70411,7 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70342
70411
|
};
|
|
70343
70412
|
Object.defineProperty(DynamicFontAtlas.prototype, "length", {
|
|
70344
70413
|
get: function () {
|
|
70345
|
-
return this.
|
|
70414
|
+
return this._characters.size;
|
|
70346
70415
|
},
|
|
70347
70416
|
enumerable: false,
|
|
70348
70417
|
configurable: true
|
|
@@ -70352,10 +70421,9 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70352
70421
|
if (canvas != null) {
|
|
70353
70422
|
this._canvas = null;
|
|
70354
70423
|
}
|
|
70355
|
-
|
|
70356
|
-
|
|
70357
|
-
|
|
70358
|
-
}
|
|
70424
|
+
this._characters.clear();
|
|
70425
|
+
this._createds.clear();
|
|
70426
|
+
this._unrefCount = 0;
|
|
70359
70427
|
};
|
|
70360
70428
|
DynamicFontAtlas.prototype.toPowerOf2 = function (size) {
|
|
70361
70429
|
var result = 32;
|
|
@@ -70404,7 +70472,7 @@ var DynamicFontAtlases = /** @class */ (function () {
|
|
|
70404
70472
|
atlas = new DynamicFontAtlas(fontId, fontSize, fontColor, this._resolution);
|
|
70405
70473
|
colorToAtlas.set(fontColor, atlas);
|
|
70406
70474
|
}
|
|
70407
|
-
atlas.add(targets);
|
|
70475
|
+
atlas.add(targets, DynamicFontAtlasCharacterType.LETTER);
|
|
70408
70476
|
};
|
|
70409
70477
|
DynamicFontAtlases.prototype.remove = function (fontId, fontColor, targets) {
|
|
70410
70478
|
var colorToAtlas = this._atlases.get(fontId);
|
|
@@ -77676,22 +77744,7 @@ var DPane = /** @class */ (function (_super) {
|
|
|
77676
77744
|
});
|
|
77677
77745
|
};
|
|
77678
77746
|
DPane.prototype.onScrollBarUpdate = function (isRegionVisible) {
|
|
77679
|
-
|
|
77680
|
-
if (overflowMask != null) {
|
|
77681
|
-
var content = this.content;
|
|
77682
|
-
if (isRegionVisible) {
|
|
77683
|
-
if (content.mask !== overflowMask) {
|
|
77684
|
-
content.mask = overflowMask;
|
|
77685
|
-
DApplications.update(this);
|
|
77686
|
-
}
|
|
77687
|
-
}
|
|
77688
|
-
else {
|
|
77689
|
-
if (content.mask) {
|
|
77690
|
-
content.mask = null;
|
|
77691
|
-
DApplications.update(this);
|
|
77692
|
-
}
|
|
77693
|
-
}
|
|
77694
|
-
}
|
|
77747
|
+
// DO NOTHING
|
|
77695
77748
|
};
|
|
77696
77749
|
DPane.prototype.initScrollBar = function (scrollbar) {
|
|
77697
77750
|
var _this = this;
|
|
@@ -77764,14 +77817,18 @@ var DPane = /** @class */ (function (_super) {
|
|
|
77764
77817
|
};
|
|
77765
77818
|
DPane.prototype.getOverflowMask = function () {
|
|
77766
77819
|
var result = this._overflowMask;
|
|
77767
|
-
if (result
|
|
77768
|
-
result =
|
|
77820
|
+
if (result === undefined) {
|
|
77821
|
+
result = this.newOverflowMask();
|
|
77769
77822
|
this._overflowMask = result;
|
|
77770
|
-
this.reflowable.add(result);
|
|
77771
|
-
this.toDirty();
|
|
77772
77823
|
}
|
|
77773
77824
|
return result;
|
|
77774
77825
|
};
|
|
77826
|
+
DPane.prototype.newOverflowMask = function () {
|
|
77827
|
+
var result = new DBaseOverflowMask(this);
|
|
77828
|
+
this.reflowable.add(result);
|
|
77829
|
+
this.toDirty();
|
|
77830
|
+
return result;
|
|
77831
|
+
};
|
|
77775
77832
|
DPane.prototype.onWheel = function (e, deltas, global) {
|
|
77776
77833
|
var content = this.content;
|
|
77777
77834
|
var x = this.getWheelContentX(content, deltas.deltaX * deltas.lowest);
|
|
@@ -100706,6 +100763,7 @@ exports.BuilderTriangleRounded = BuilderTriangleRounded;
|
|
|
100706
100763
|
exports.CIRCLE_INDEX_COUNT = CIRCLE_INDEX_COUNT;
|
|
100707
100764
|
exports.CIRCLE_VERTEX_COUNT = CIRCLE_VERTEX_COUNT;
|
|
100708
100765
|
exports.CIRCLE_WORLD_SIZE = CIRCLE_WORLD_SIZE;
|
|
100766
|
+
exports.Character = Character;
|
|
100709
100767
|
exports.DAlignHorizontal = DAlignHorizontal;
|
|
100710
100768
|
exports.DAlignVertical = DAlignVertical;
|
|
100711
100769
|
exports.DAlignWith = DAlignWith;
|