@wcardinal/wcardinal-ui 0.425.0 → 0.426.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 +2 -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 +83 -114
- 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 +492 -452
- package/dist/wcardinal-ui.js +492 -452
- 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.426.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,10 +21610,17 @@ 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;
|
|
21621
21625
|
}
|
|
21622
21626
|
Object.defineProperty(DynamicSDFFontAtlas.prototype, "id", {
|
|
@@ -21674,143 +21678,109 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21674
21678
|
configurable: true
|
|
21675
21679
|
});
|
|
21676
21680
|
DynamicSDFFontAtlas.prototype.begin = function () {
|
|
21677
|
-
this.
|
|
21678
|
-
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
}
|
|
21681
|
+
this._characters.forEach(function (character) {
|
|
21682
|
+
if (!(character.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
21683
|
+
character.ref = 0;
|
|
21684
|
+
}
|
|
21685
|
+
});
|
|
21682
21686
|
};
|
|
21683
21687
|
DynamicSDFFontAtlas.prototype.end = function () {
|
|
21688
|
+
var _this = this;
|
|
21684
21689
|
var characters = this._characters;
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21688
|
-
|
|
21689
|
-
|
|
21690
|
-
|
|
21691
|
-
this._isDirty = true;
|
|
21690
|
+
characters.forEach(function (character, id) {
|
|
21691
|
+
if (character.ref <= 0 && !(character.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
21692
|
+
character.life -= 1;
|
|
21693
|
+
if (character.life <= 0) {
|
|
21694
|
+
characters.delete(id);
|
|
21695
|
+
_this._isDirty = true;
|
|
21692
21696
|
}
|
|
21693
21697
|
}
|
|
21694
|
-
}
|
|
21698
|
+
});
|
|
21695
21699
|
};
|
|
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
|
-
}
|
|
21700
|
+
DynamicSDFFontAtlas.prototype.newChar = function (character, type) {
|
|
21701
|
+
return new DynamicFontAtlasCharacter(type, character, 0, 0, 1, 1, 0);
|
|
21704
21702
|
};
|
|
21705
|
-
DynamicSDFFontAtlas.prototype.
|
|
21706
|
-
var
|
|
21707
|
-
|
|
21708
|
-
var
|
|
21703
|
+
DynamicSDFFontAtlas.prototype.add = function (characters, nacharacters) {
|
|
21704
|
+
var cs = this._characters;
|
|
21705
|
+
for (var i = 0, imax = nacharacters.length; i < imax; ++i) {
|
|
21706
|
+
var nac = nacharacters[i];
|
|
21707
|
+
var data = cs.get(nac);
|
|
21709
21708
|
if (data != null) {
|
|
21710
|
-
if (data.ref <= 0) {
|
|
21711
|
-
this._length += 1;
|
|
21712
|
-
}
|
|
21713
21709
|
data.ref += 1;
|
|
21714
21710
|
}
|
|
21715
21711
|
else {
|
|
21716
|
-
|
|
21717
|
-
this._length += 1;
|
|
21712
|
+
cs.set(nac, this.newChar(nac, DynamicFontAtlasCharacterType.LETTER));
|
|
21718
21713
|
this._isDirty = true;
|
|
21719
21714
|
}
|
|
21720
21715
|
}
|
|
21721
21716
|
};
|
|
21722
|
-
DynamicSDFFontAtlas.prototype.isIgnored = function (character) {
|
|
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);
|
|
21743
|
-
}
|
|
21744
|
-
};
|
|
21745
21717
|
DynamicSDFFontAtlas.prototype.get = function (id) {
|
|
21746
|
-
return this._characters
|
|
21718
|
+
return this._characters.get(id);
|
|
21747
21719
|
};
|
|
21748
21720
|
DynamicSDFFontAtlas.prototype.update = function () {
|
|
21749
21721
|
if (this._isDirty) {
|
|
21750
21722
|
var canvas = this._canvas;
|
|
21751
21723
|
var generator = this._generator;
|
|
21752
21724
|
if (canvas != null && generator != null) {
|
|
21753
|
-
var
|
|
21754
|
-
if (
|
|
21725
|
+
var context_1 = canvas.getContext("2d");
|
|
21726
|
+
if (context_1 != null) {
|
|
21755
21727
|
this._isDirty = false;
|
|
21756
21728
|
var font = this._font;
|
|
21729
|
+
var fontSize_1 = font.size + 14;
|
|
21757
21730
|
var characters = this._characters;
|
|
21758
|
-
var
|
|
21759
|
-
|
|
21760
|
-
this._width = width;
|
|
21731
|
+
var width_1 = this.toPowerOf2(Math.ceil(Math.sqrt(characters.size)) * fontSize_1);
|
|
21732
|
+
this._width = width_1;
|
|
21761
21733
|
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;
|
|
21734
|
+
context_1.font = fontStyle;
|
|
21735
|
+
context_1.textAlign = "left";
|
|
21736
|
+
context_1.textBaseline = "alphabetic";
|
|
21737
|
+
context_1.lineWidth = 0;
|
|
21738
|
+
context_1.lineCap = "round";
|
|
21739
|
+
context_1.lineJoin = "miter";
|
|
21740
|
+
context_1.miterLimit = 10;
|
|
21741
|
+
context_1.fillStyle = "#FFFFFF";
|
|
21742
|
+
UtilFont.measure(context_1, font);
|
|
21743
|
+
var offsetX_1 = 7;
|
|
21744
|
+
var offsetY_1 = Math.round((fontSize_1 - (font.ascent + font.descent)) * 0.5 + font.ascent);
|
|
21745
|
+
var x_1 = 0;
|
|
21746
|
+
var y_1 = 0;
|
|
21747
|
+
characters.forEach(function (character) {
|
|
21748
|
+
var advance = context_1.measureText(character.character).width;
|
|
21749
|
+
var characterWidth = Math.ceil(offsetX_1 + advance + offsetX_1);
|
|
21750
|
+
var characterHeight = fontSize_1;
|
|
21751
|
+
if (width_1 <= x_1 + characterWidth) {
|
|
21752
|
+
x_1 = 0;
|
|
21753
|
+
y_1 += fontSize_1;
|
|
21783
21754
|
}
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
}
|
|
21793
|
-
var height = (this._height =
|
|
21755
|
+
character.x = x_1;
|
|
21756
|
+
character.y = y_1;
|
|
21757
|
+
character.width = characterWidth;
|
|
21758
|
+
character.height = characterHeight;
|
|
21759
|
+
character.advance = advance;
|
|
21760
|
+
character.origin.x = x_1 + offsetX_1;
|
|
21761
|
+
character.origin.y = y_1 + offsetY_1;
|
|
21762
|
+
x_1 += characterWidth;
|
|
21763
|
+
});
|
|
21764
|
+
var height = (this._height = y_1 + fontSize_1);
|
|
21794
21765
|
// Make a input canvas
|
|
21795
21766
|
// Here, we need to reset the context because
|
|
21796
21767
|
// context settings will be lost when we set the width/height.
|
|
21797
|
-
canvas.width =
|
|
21768
|
+
canvas.width = width_1;
|
|
21798
21769
|
canvas.height = height;
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
}
|
|
21770
|
+
context_1.font = fontStyle;
|
|
21771
|
+
context_1.textAlign = "left";
|
|
21772
|
+
context_1.textBaseline = "alphabetic";
|
|
21773
|
+
context_1.lineWidth = 0;
|
|
21774
|
+
context_1.lineCap = "round";
|
|
21775
|
+
context_1.lineJoin = "miter";
|
|
21776
|
+
context_1.miterLimit = 10;
|
|
21777
|
+
context_1.fillStyle = "#FFFFFF";
|
|
21778
|
+
context_1.clearRect(0, 0, width_1, height);
|
|
21779
|
+
characters.forEach(function (character) {
|
|
21780
|
+
context_1.fillText(character.character, character.origin.x, character.origin.y);
|
|
21781
|
+
});
|
|
21812
21782
|
// Convert to SDF font texture
|
|
21813
|
-
generator.updateTexture(
|
|
21783
|
+
generator.updateTexture(width_1, height, canvas);
|
|
21814
21784
|
generator.render();
|
|
21815
21785
|
generator.read(canvas);
|
|
21816
21786
|
return true;
|
|
@@ -21821,7 +21791,7 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21821
21791
|
};
|
|
21822
21792
|
Object.defineProperty(DynamicSDFFontAtlas.prototype, "length", {
|
|
21823
21793
|
get: function () {
|
|
21824
|
-
return this.
|
|
21794
|
+
return this._characters.size;
|
|
21825
21795
|
},
|
|
21826
21796
|
enumerable: false,
|
|
21827
21797
|
configurable: true
|
|
@@ -21846,10 +21816,7 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21846
21816
|
if (canvas != null) {
|
|
21847
21817
|
this._canvas = null;
|
|
21848
21818
|
}
|
|
21849
|
-
|
|
21850
|
-
for (var id in characters) {
|
|
21851
|
-
delete characters[id];
|
|
21852
|
-
}
|
|
21819
|
+
this._characters.clear();
|
|
21853
21820
|
};
|
|
21854
21821
|
DynamicSDFFontAtlas.prototype.toPowerOf2 = function (size) {
|
|
21855
21822
|
var result = 32;
|
|
@@ -21867,52 +21834,45 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
|
|
|
21867
21834
|
*/
|
|
21868
21835
|
var DynamicSDFFontAtlases = /** @class */ (function () {
|
|
21869
21836
|
function DynamicSDFFontAtlases() {
|
|
21870
|
-
this._atlases =
|
|
21837
|
+
this._atlases = new Map();
|
|
21871
21838
|
}
|
|
21872
21839
|
DynamicSDFFontAtlases.prototype.begin = function () {
|
|
21873
|
-
|
|
21874
|
-
for (var family in atlases) {
|
|
21875
|
-
var atlas = atlases[family];
|
|
21840
|
+
this._atlases.forEach(function (atlas) {
|
|
21876
21841
|
atlas.begin();
|
|
21877
|
-
}
|
|
21842
|
+
});
|
|
21878
21843
|
};
|
|
21879
21844
|
DynamicSDFFontAtlases.prototype.end = function () {
|
|
21880
21845
|
var atlases = this._atlases;
|
|
21881
|
-
|
|
21882
|
-
var atlas = atlases[family];
|
|
21883
|
-
if (0 < atlas.length) {
|
|
21884
|
-
atlas.addAscii();
|
|
21885
|
-
}
|
|
21846
|
+
atlases.forEach(function (atlas, family) {
|
|
21886
21847
|
atlas.end();
|
|
21887
21848
|
if (atlas.length <= 0) {
|
|
21888
21849
|
atlas.destroy();
|
|
21889
|
-
delete
|
|
21850
|
+
atlases.delete(family);
|
|
21890
21851
|
}
|
|
21891
|
-
}
|
|
21852
|
+
});
|
|
21892
21853
|
};
|
|
21893
|
-
DynamicSDFFontAtlases.prototype.add = function (family,
|
|
21894
|
-
var
|
|
21854
|
+
DynamicSDFFontAtlases.prototype.add = function (family, characters, nacharacters) {
|
|
21855
|
+
var atlases = this._atlases;
|
|
21856
|
+
var atlas = atlases.get(family);
|
|
21895
21857
|
if (atlas != null) {
|
|
21896
|
-
atlas.add(
|
|
21858
|
+
atlas.add(characters, nacharacters);
|
|
21897
21859
|
}
|
|
21898
21860
|
else {
|
|
21899
21861
|
var newAtlas = new DynamicSDFFontAtlas(family);
|
|
21900
|
-
newAtlas.add(
|
|
21901
|
-
|
|
21862
|
+
newAtlas.add(characters, nacharacters);
|
|
21863
|
+
atlases.set(family, newAtlas);
|
|
21902
21864
|
}
|
|
21903
21865
|
};
|
|
21904
21866
|
DynamicSDFFontAtlases.prototype.get = function (family) {
|
|
21905
|
-
var atlas = this._atlases
|
|
21867
|
+
var atlas = this._atlases.get(family);
|
|
21906
21868
|
if (atlas != null) {
|
|
21907
21869
|
return atlas;
|
|
21908
21870
|
}
|
|
21909
21871
|
return null;
|
|
21910
21872
|
};
|
|
21911
21873
|
DynamicSDFFontAtlases.prototype.update = function (baseAtlas) {
|
|
21912
|
-
var atlases = this._atlases;
|
|
21913
21874
|
var baseTexture = baseAtlas.getBaseTexture();
|
|
21914
|
-
|
|
21915
|
-
var atlas = atlases[family];
|
|
21875
|
+
this._atlases.forEach(function (atlas) {
|
|
21916
21876
|
if (atlas.update()) {
|
|
21917
21877
|
var atlasId = atlas.id;
|
|
21918
21878
|
var item = baseAtlas.get(atlasId);
|
|
@@ -21930,15 +21890,14 @@ var DynamicSDFFontAtlases = /** @class */ (function () {
|
|
|
21930
21890
|
baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
|
|
21931
21891
|
}
|
|
21932
21892
|
}
|
|
21933
|
-
}
|
|
21893
|
+
});
|
|
21934
21894
|
};
|
|
21935
21895
|
DynamicSDFFontAtlases.prototype.destroy = function () {
|
|
21936
21896
|
var atlases = this._atlases;
|
|
21937
|
-
|
|
21938
|
-
var atlas = atlases[family];
|
|
21897
|
+
atlases.forEach(function (atlas) {
|
|
21939
21898
|
atlas.destroy();
|
|
21940
|
-
}
|
|
21941
|
-
|
|
21899
|
+
});
|
|
21900
|
+
atlases.clear();
|
|
21942
21901
|
};
|
|
21943
21902
|
return DynamicSDFFontAtlases;
|
|
21944
21903
|
}());
|
|
@@ -22326,9 +22285,9 @@ var EShapeRenderer = /** @class */ (function (_super) {
|
|
|
22326
22285
|
}
|
|
22327
22286
|
// Font texture atlas
|
|
22328
22287
|
var text = shape.text;
|
|
22329
|
-
var
|
|
22330
|
-
if (0 <
|
|
22331
|
-
fontAtlases.add(text.family,
|
|
22288
|
+
var textCharacters = text.characters;
|
|
22289
|
+
if (0 < textCharacters.length) {
|
|
22290
|
+
fontAtlases.add(text.family, textCharacters, text.nacharacters);
|
|
22332
22291
|
}
|
|
22333
22292
|
};
|
|
22334
22293
|
EShapeRenderer.prototype.updateAtlases = function (shapes, atlas, fontAtlases, defaultTexture, baseTexture) {
|
|
@@ -28695,6 +28654,74 @@ var DDynamicTextMeasureResult = /** @class */ (function () {
|
|
|
28695
28654
|
return DDynamicTextMeasureResult;
|
|
28696
28655
|
}());
|
|
28697
28656
|
|
|
28657
|
+
/*
|
|
28658
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
28659
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
28660
|
+
*/
|
|
28661
|
+
var UtilCharacterIterator = /** @class */ (function () {
|
|
28662
|
+
function UtilCharacterIterator() {
|
|
28663
|
+
this.target = "";
|
|
28664
|
+
this.position = 0;
|
|
28665
|
+
}
|
|
28666
|
+
UtilCharacterIterator.prototype.init = function (target) {
|
|
28667
|
+
this.target = target;
|
|
28668
|
+
this.position = 0;
|
|
28669
|
+
};
|
|
28670
|
+
UtilCharacterIterator.prototype.hasNext = function () {
|
|
28671
|
+
return this.position < this.target.length;
|
|
28672
|
+
};
|
|
28673
|
+
UtilCharacterIterator.prototype.findNextBreak = function (target, istart) {
|
|
28674
|
+
var iend = target.length;
|
|
28675
|
+
for (var i = istart; i < iend; ++i) {
|
|
28676
|
+
var code = target.charCodeAt(i);
|
|
28677
|
+
if (!this.isLowSurrogate(code) && !this.isVariationSelector(code)) {
|
|
28678
|
+
return i;
|
|
28679
|
+
}
|
|
28680
|
+
}
|
|
28681
|
+
return iend;
|
|
28682
|
+
};
|
|
28683
|
+
UtilCharacterIterator.prototype.isHighSurrogate = function (code) {
|
|
28684
|
+
return 0xd800 <= code && code <= 0xdbff;
|
|
28685
|
+
};
|
|
28686
|
+
UtilCharacterIterator.prototype.isLowSurrogate = function (code) {
|
|
28687
|
+
return 0xdc00 <= code && code <= 0xdfff;
|
|
28688
|
+
};
|
|
28689
|
+
UtilCharacterIterator.prototype.isVariationSelector = function (code) {
|
|
28690
|
+
return 0xfe00 <= code && code <= 0xfe0f;
|
|
28691
|
+
};
|
|
28692
|
+
UtilCharacterIterator.prototype.next = function () {
|
|
28693
|
+
var target = this.target;
|
|
28694
|
+
var position = this.position;
|
|
28695
|
+
var nextBreak = this.findNextBreak(target, position + 1);
|
|
28696
|
+
var result = target.substring(position, nextBreak);
|
|
28697
|
+
this.position = nextBreak;
|
|
28698
|
+
return result;
|
|
28699
|
+
};
|
|
28700
|
+
/**
|
|
28701
|
+
* Closes this iterator.
|
|
28702
|
+
*
|
|
28703
|
+
* @returns true if closed.
|
|
28704
|
+
*/
|
|
28705
|
+
UtilCharacterIterator.prototype.close = function () {
|
|
28706
|
+
var length = this.target.length;
|
|
28707
|
+
if (this.position < length) {
|
|
28708
|
+
this.position = length;
|
|
28709
|
+
return true;
|
|
28710
|
+
}
|
|
28711
|
+
return false;
|
|
28712
|
+
};
|
|
28713
|
+
UtilCharacterIterator.from = function (target) {
|
|
28714
|
+
if (UtilCharacterIterator._instance == null) {
|
|
28715
|
+
UtilCharacterIterator._instance = new UtilCharacterIterator();
|
|
28716
|
+
}
|
|
28717
|
+
var instance = UtilCharacterIterator._instance;
|
|
28718
|
+
instance.init(target);
|
|
28719
|
+
return instance;
|
|
28720
|
+
};
|
|
28721
|
+
UtilCharacterIterator._instance = null;
|
|
28722
|
+
return UtilCharacterIterator;
|
|
28723
|
+
}());
|
|
28724
|
+
|
|
28698
28725
|
/*
|
|
28699
28726
|
* Copyright (C) 2019 Toshiba Corporation
|
|
28700
28727
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -28705,7 +28732,6 @@ var DDynamicTextStyleWordWrap = {
|
|
|
28705
28732
|
BREAK_ALL: 2
|
|
28706
28733
|
};
|
|
28707
28734
|
|
|
28708
|
-
var NEW_LINE = "\n";
|
|
28709
28735
|
var DDynamicTextMeasure = /** @class */ (function () {
|
|
28710
28736
|
function DDynamicTextMeasure() {
|
|
28711
28737
|
}
|
|
@@ -28775,7 +28801,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28775
28801
|
while (iterator.hasNext()) {
|
|
28776
28802
|
var characterPosition = iterator.position;
|
|
28777
28803
|
var character = iterator.next();
|
|
28778
|
-
if (character === NEW_LINE) {
|
|
28804
|
+
if (character === Character.NEW_LINE) {
|
|
28779
28805
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28780
28806
|
result.newLine(lineHeight);
|
|
28781
28807
|
}
|
|
@@ -28807,7 +28833,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28807
28833
|
DDynamicTextMeasure.measure1b = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28808
28834
|
while (iterator.hasNext()) {
|
|
28809
28835
|
var character = iterator.next();
|
|
28810
|
-
if (character === NEW_LINE) {
|
|
28836
|
+
if (character === Character.NEW_LINE) {
|
|
28811
28837
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28812
28838
|
result.newLine(lineHeight);
|
|
28813
28839
|
}
|
|
@@ -28838,7 +28864,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28838
28864
|
DDynamicTextMeasure.measure1 = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28839
28865
|
while (iterator.hasNext()) {
|
|
28840
28866
|
var character = iterator.next();
|
|
28841
|
-
if (character === NEW_LINE) {
|
|
28867
|
+
if (character === Character.NEW_LINE) {
|
|
28842
28868
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28843
28869
|
result.newLine(lineHeight);
|
|
28844
28870
|
}
|
|
@@ -28870,7 +28896,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28870
28896
|
while (iterator.hasNext()) {
|
|
28871
28897
|
var characterPosition = iterator.position;
|
|
28872
28898
|
var character = iterator.next();
|
|
28873
|
-
if (character === NEW_LINE) {
|
|
28899
|
+
if (character === Character.NEW_LINE) {
|
|
28874
28900
|
result.newLine(lineHeight);
|
|
28875
28901
|
}
|
|
28876
28902
|
else {
|
|
@@ -28892,7 +28918,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28892
28918
|
DDynamicTextMeasure.measure2b = function (iterator, clippingWidth, lineHeight, atlas, result) {
|
|
28893
28919
|
while (iterator.hasNext()) {
|
|
28894
28920
|
var character = iterator.next();
|
|
28895
|
-
if (character === NEW_LINE) {
|
|
28921
|
+
if (character === Character.NEW_LINE) {
|
|
28896
28922
|
result.newLine(lineHeight);
|
|
28897
28923
|
}
|
|
28898
28924
|
else {
|
|
@@ -28913,7 +28939,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28913
28939
|
DDynamicTextMeasure.measure2 = function (iterator, clippingWidth, lineHeight, atlas, result) {
|
|
28914
28940
|
while (iterator.hasNext()) {
|
|
28915
28941
|
var character = iterator.next();
|
|
28916
|
-
if (character === NEW_LINE) {
|
|
28942
|
+
if (character === Character.NEW_LINE) {
|
|
28917
28943
|
result.newLine(lineHeight);
|
|
28918
28944
|
}
|
|
28919
28945
|
else {
|
|
@@ -28933,7 +28959,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28933
28959
|
DDynamicTextMeasure.measure3 = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28934
28960
|
while (iterator.hasNext()) {
|
|
28935
28961
|
var character = iterator.next();
|
|
28936
|
-
if (character === NEW_LINE) {
|
|
28962
|
+
if (character === Character.NEW_LINE) {
|
|
28937
28963
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28938
28964
|
result.newLine(lineHeight);
|
|
28939
28965
|
}
|
|
@@ -28957,7 +28983,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28957
28983
|
DDynamicTextMeasure.measure4 = function (iterator, lineHeight, atlas, result) {
|
|
28958
28984
|
while (iterator.hasNext()) {
|
|
28959
28985
|
var character = iterator.next();
|
|
28960
|
-
if (character === NEW_LINE) {
|
|
28986
|
+
if (character === Character.NEW_LINE) {
|
|
28961
28987
|
result.newLine(lineHeight);
|
|
28962
28988
|
}
|
|
28963
28989
|
else {
|
|
@@ -28970,7 +28996,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28970
28996
|
};
|
|
28971
28997
|
DDynamicTextMeasure.measure5 = function (iterator, clippingWidth, lineHeight, atlas, result, close) {
|
|
28972
28998
|
result.clipped = true;
|
|
28973
|
-
var dots = atlas.get(
|
|
28999
|
+
var dots = atlas.get(Character.DOTS);
|
|
28974
29000
|
if (dots != null) {
|
|
28975
29001
|
while (!result.isPushable(clippingWidth, dots)) {
|
|
28976
29002
|
if (!result.pop()) {
|
|
@@ -28986,7 +29012,7 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
28986
29012
|
}
|
|
28987
29013
|
else {
|
|
28988
29014
|
while (iterator.hasNext()) {
|
|
28989
|
-
if (iterator.next() === NEW_LINE) {
|
|
29015
|
+
if (iterator.next() === Character.NEW_LINE) {
|
|
28990
29016
|
result.newLine(lineHeight);
|
|
28991
29017
|
break;
|
|
28992
29018
|
}
|
|
@@ -29070,47 +29096,61 @@ var DDynamicTextMeasure = /** @class */ (function () {
|
|
|
29070
29096
|
var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
29071
29097
|
__extends(DDynamicTextGeometry, _super);
|
|
29072
29098
|
function DDynamicTextGeometry() {
|
|
29073
|
-
var
|
|
29099
|
+
var _a, _b, _c;
|
|
29100
|
+
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
29101
|
_this.width = 0;
|
|
29075
29102
|
_this.height = 0;
|
|
29076
29103
|
_this.scale = 1;
|
|
29077
29104
|
_this.scaled = false;
|
|
29078
29105
|
_this.clipped = false;
|
|
29106
|
+
_this.vertexBuffer = _this.getBuffer("aVertexPosition");
|
|
29107
|
+
_this.vertices = DDynamicTextGeometry.VERTICES;
|
|
29108
|
+
_this.uvBuffer = _this.getBuffer("aTextureCoord");
|
|
29109
|
+
_this.uvs = DDynamicTextGeometry.UVS;
|
|
29110
|
+
_this.indexBuffer = _this.getIndex();
|
|
29111
|
+
_this.indices = DDynamicTextGeometry.INDICES;
|
|
29112
|
+
_this.nchars = 0;
|
|
29079
29113
|
return _this;
|
|
29080
29114
|
}
|
|
29081
29115
|
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
29116
|
var result = DDynamicTextMeasure.measure(text, atlas, modifier);
|
|
29086
|
-
var
|
|
29087
|
-
var
|
|
29088
|
-
if (
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
|
|
29098
|
-
|
|
29117
|
+
var resultCount = result.count;
|
|
29118
|
+
var nchars = ((resultCount >> 3) + (resultCount & 0x7 ? 1 : 0)) << 3;
|
|
29119
|
+
if (this.nchars < nchars) {
|
|
29120
|
+
this.nchars = nchars;
|
|
29121
|
+
var nvertex = nchars << 3;
|
|
29122
|
+
this.vertices = new Float32Array(nvertex);
|
|
29123
|
+
this.uvs = new Float32Array(nvertex);
|
|
29124
|
+
this.vertexBuffer.data = this.vertices;
|
|
29125
|
+
this.uvBuffer.data = this.uvs;
|
|
29126
|
+
var nindex = (nchars << 2) + (nchars << 1);
|
|
29127
|
+
this.indices = new Uint16Array(nindex);
|
|
29128
|
+
this.indexBuffer.data = this.indices;
|
|
29129
|
+
this.initIndices(this.indices);
|
|
29130
|
+
this.indexBuffer.update();
|
|
29131
|
+
}
|
|
29132
|
+
else {
|
|
29133
|
+
nchars = this.nchars;
|
|
29134
|
+
}
|
|
29135
|
+
if (nchars <= 0) {
|
|
29136
|
+
return;
|
|
29137
|
+
}
|
|
29138
|
+
var vertices = this.vertices;
|
|
29139
|
+
var uvs = this.uvs;
|
|
29099
29140
|
if (atlas != null) {
|
|
29100
|
-
var count = result.count;
|
|
29101
29141
|
var characters = result.characters;
|
|
29102
29142
|
var scale = result.scale;
|
|
29103
|
-
|
|
29143
|
+
var fw = 1 / atlas.width;
|
|
29144
|
+
var fh = 1 / atlas.height;
|
|
29145
|
+
for (var i = 0; i < resultCount; ++i) {
|
|
29104
29146
|
var character = characters[i];
|
|
29105
29147
|
var cx = character.x;
|
|
29106
29148
|
var cy = character.y;
|
|
29107
29149
|
var cc = character.character;
|
|
29108
|
-
|
|
29109
|
-
var h = atlas.height;
|
|
29110
|
-
this.writeCharacter(vertices, uvs, indices, i, cx, cy, scale, cc, w, h);
|
|
29150
|
+
this.fill(vertices, uvs, i, cx, cy, scale, cc, fw, fh);
|
|
29111
29151
|
}
|
|
29112
|
-
for (var i =
|
|
29113
|
-
this.
|
|
29152
|
+
for (var i = resultCount; i < nchars; ++i) {
|
|
29153
|
+
this.fillBlank(vertices, uvs, i);
|
|
29114
29154
|
}
|
|
29115
29155
|
this.width = result.width * scale;
|
|
29116
29156
|
this.height = result.height * scale;
|
|
@@ -29119,8 +29159,8 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29119
29159
|
this.clipped = result.clipped;
|
|
29120
29160
|
}
|
|
29121
29161
|
else {
|
|
29122
|
-
for (var i = 0
|
|
29123
|
-
this.
|
|
29162
|
+
for (var i = 0; i < nchars; ++i) {
|
|
29163
|
+
this.fillBlank(vertices, uvs, i);
|
|
29124
29164
|
}
|
|
29125
29165
|
this.width = 0;
|
|
29126
29166
|
this.height = 0;
|
|
@@ -29128,11 +29168,10 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29128
29168
|
this.scaled = false;
|
|
29129
29169
|
this.clipped = false;
|
|
29130
29170
|
}
|
|
29131
|
-
vertexBuffer.update();
|
|
29132
|
-
uvBuffer.update();
|
|
29133
|
-
indexBuffer.update();
|
|
29171
|
+
this.vertexBuffer.update();
|
|
29172
|
+
this.uvBuffer.update();
|
|
29134
29173
|
};
|
|
29135
|
-
DDynamicTextGeometry.prototype.
|
|
29174
|
+
DDynamicTextGeometry.prototype.fill = function (vertices, uvs, index, x, y, scale, character, fw, fh) {
|
|
29136
29175
|
var cx = character.x;
|
|
29137
29176
|
var cy = character.y;
|
|
29138
29177
|
var cw = character.width;
|
|
@@ -29151,10 +29190,10 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29151
29190
|
vertices[iv + 5] = y1;
|
|
29152
29191
|
vertices[iv + 6] = x0;
|
|
29153
29192
|
vertices[iv + 7] = y1;
|
|
29154
|
-
var u0 = cx
|
|
29155
|
-
var v0 = cy
|
|
29156
|
-
var u1 = (cx + cw)
|
|
29157
|
-
var v1 = (cy + ch)
|
|
29193
|
+
var u0 = cx * fw;
|
|
29194
|
+
var v0 = cy * fh;
|
|
29195
|
+
var u1 = (cx + cw) * fw;
|
|
29196
|
+
var v1 = (cy + ch) * fh;
|
|
29158
29197
|
uvs[iv + 0] = u0;
|
|
29159
29198
|
uvs[iv + 1] = v0;
|
|
29160
29199
|
uvs[iv + 2] = u1;
|
|
@@ -29163,16 +29202,8 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29163
29202
|
uvs[iv + 5] = v1;
|
|
29164
29203
|
uvs[iv + 6] = u0;
|
|
29165
29204
|
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) {
|
|
29205
|
+
};
|
|
29206
|
+
DDynamicTextGeometry.prototype.fillBlank = function (vertices, uvs, index) {
|
|
29176
29207
|
var iv = index << 3;
|
|
29177
29208
|
vertices[iv + 0] = 0;
|
|
29178
29209
|
vertices[iv + 1] = 0;
|
|
@@ -29190,14 +29221,16 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
|
29190
29221
|
uvs[iv + 5] = 0;
|
|
29191
29222
|
uvs[iv + 6] = 0;
|
|
29192
29223
|
uvs[iv + 7] = 0;
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
|
|
29200
|
-
|
|
29224
|
+
};
|
|
29225
|
+
DDynamicTextGeometry.prototype.initIndices = function (indices) {
|
|
29226
|
+
for (var iv = 0, ivmax = this.nchars << 2, ii = 0; iv < ivmax; iv += 4, ii += 6) {
|
|
29227
|
+
indices[ii] = iv;
|
|
29228
|
+
indices[ii + 1] = iv + 1;
|
|
29229
|
+
indices[ii + 2] = iv + 3;
|
|
29230
|
+
indices[ii + 3] = iv + 1;
|
|
29231
|
+
indices[ii + 4] = iv + 2;
|
|
29232
|
+
indices[ii + 5] = iv + 3;
|
|
29233
|
+
}
|
|
29201
29234
|
};
|
|
29202
29235
|
return DDynamicTextGeometry;
|
|
29203
29236
|
}(pixi_js.MeshGeometry));
|
|
@@ -70090,26 +70123,26 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70090
70123
|
var padding = this.toPadding(fontSize);
|
|
70091
70124
|
this._padding = padding;
|
|
70092
70125
|
this._font = new DynamicFontAtlasFont(fontId, fontSize, fontColor, padding);
|
|
70093
|
-
this._characters = {};
|
|
70094
|
-
this._length = 0;
|
|
70095
70126
|
this._unrefCount = 0;
|
|
70096
70127
|
this._width = 1;
|
|
70097
70128
|
this._height = 1;
|
|
70098
|
-
this._revision = 0;
|
|
70099
70129
|
this._revisionUpdated = 0;
|
|
70100
70130
|
this._texture = pixi_js.Texture.from(this._canvas, {
|
|
70101
70131
|
mipmap: pixi_js.MIPMAP_MODES.OFF,
|
|
70102
70132
|
resolution: resolution,
|
|
70103
70133
|
scaleMode: pixi_js.SCALE_MODES.NEAREST
|
|
70104
70134
|
});
|
|
70105
|
-
var characters =
|
|
70106
|
-
|
|
70107
|
-
|
|
70108
|
-
|
|
70109
|
-
for (var i = 0, imax =
|
|
70110
|
-
var
|
|
70111
|
-
|
|
70112
|
-
}
|
|
70135
|
+
var characters = new Map();
|
|
70136
|
+
characters.set(Character.SPACE, this.newChar(Character.SPACE, DynamicFontAtlasCharacterType.SPACE_R));
|
|
70137
|
+
characters.set(Character.TAB, this.newChar(Character.SOFT_TAB, DynamicFontAtlasCharacterType.SPACE_R));
|
|
70138
|
+
characters.set(Character.DOTS, this.newChar(Character.DOTS, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
70139
|
+
for (var i = 0, imax = Character.ASCII.length; i < imax; ++i) {
|
|
70140
|
+
var ac = Character.ASCII[i];
|
|
70141
|
+
characters.set(ac, this.newChar(ac, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
70142
|
+
}
|
|
70143
|
+
this._characters = characters;
|
|
70144
|
+
this._createds = new Map();
|
|
70145
|
+
this._revision = 1;
|
|
70113
70146
|
}
|
|
70114
70147
|
DynamicFontAtlas.prototype.toPadding = function (fontSize) {
|
|
70115
70148
|
return Math.max(3, Math.ceil(fontSize * 0.2));
|
|
@@ -70163,86 +70196,106 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70163
70196
|
enumerable: false,
|
|
70164
70197
|
configurable: true
|
|
70165
70198
|
});
|
|
70166
|
-
DynamicFontAtlas.prototype.
|
|
70167
|
-
|
|
70168
|
-
|
|
70169
|
-
|
|
70170
|
-
|
|
70171
|
-
|
|
70199
|
+
DynamicFontAtlas.prototype.newChar = function (character, type) {
|
|
70200
|
+
var advance = this.getAdvance(character);
|
|
70201
|
+
var padding = this._padding;
|
|
70202
|
+
var width = Math.ceil(padding + advance + padding);
|
|
70203
|
+
var height = this.font.height;
|
|
70204
|
+
return new DynamicFontAtlasCharacter(type, character, -width, // Setting X and Y to zeros leads to render the character at the UV coordinate (0, 0).
|
|
70205
|
+
-height, width, height, advance);
|
|
70206
|
+
};
|
|
70207
|
+
DynamicFontAtlas.prototype.add = function (characters, type) {
|
|
70208
|
+
var cs = this._characters;
|
|
70209
|
+
var cds = this._createds;
|
|
70210
|
+
for (var i = 0, imax = characters.length; i < imax;) {
|
|
70211
|
+
if (characters.charCodeAt(i) <= 0xff) {
|
|
70212
|
+
// Ignore ASCII characters
|
|
70213
|
+
i += 1;
|
|
70214
|
+
continue;
|
|
70215
|
+
}
|
|
70216
|
+
var j = i + 1;
|
|
70217
|
+
for (; j < imax; ++j) {
|
|
70218
|
+
var cc = characters.charCodeAt(j);
|
|
70219
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
70220
|
+
// Low surrogate
|
|
70221
|
+
// Variation selector
|
|
70222
|
+
continue;
|
|
70223
|
+
}
|
|
70224
|
+
break;
|
|
70225
|
+
}
|
|
70226
|
+
// Increment the reference count or create a new one
|
|
70227
|
+
var nac = characters.substring(i, j);
|
|
70228
|
+
var c = cs.get(nac);
|
|
70229
|
+
if (c != null) {
|
|
70230
|
+
if (!(c.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
70231
|
+
if (c.ref === 0) {
|
|
70172
70232
|
this._unrefCount -= 1;
|
|
70173
70233
|
}
|
|
70174
|
-
|
|
70234
|
+
c.ref += 1;
|
|
70175
70235
|
}
|
|
70176
70236
|
}
|
|
70177
70237
|
else {
|
|
70178
|
-
var
|
|
70179
|
-
|
|
70180
|
-
|
|
70181
|
-
|
|
70182
|
-
|
|
70183
|
-
|
|
70184
|
-
|
|
70238
|
+
var cd = cds.get(nac);
|
|
70239
|
+
if (cd != null) {
|
|
70240
|
+
cd.ref = 1;
|
|
70241
|
+
cs.set(nac, cd);
|
|
70242
|
+
}
|
|
70243
|
+
else {
|
|
70244
|
+
var newCharacter = this.newChar(nac, type);
|
|
70245
|
+
cs.set(nac, newCharacter);
|
|
70246
|
+
cds.set(nac, newCharacter);
|
|
70247
|
+
}
|
|
70185
70248
|
this._revision += 1;
|
|
70186
70249
|
}
|
|
70250
|
+
// Go to the next
|
|
70251
|
+
i = j;
|
|
70187
70252
|
}
|
|
70188
70253
|
};
|
|
70189
|
-
DynamicFontAtlas.prototype.
|
|
70190
|
-
|
|
70191
|
-
|
|
70192
|
-
|
|
70193
|
-
|
|
70194
|
-
|
|
70195
|
-
|
|
70196
|
-
|
|
70197
|
-
|
|
70198
|
-
|
|
70199
|
-
|
|
70200
|
-
|
|
70201
|
-
|
|
70202
|
-
|
|
70203
|
-
|
|
70204
|
-
|
|
70205
|
-
|
|
70206
|
-
|
|
70207
|
-
|
|
70208
|
-
|
|
70209
|
-
|
|
70254
|
+
DynamicFontAtlas.prototype.remove = function (characters) {
|
|
70255
|
+
var cs = this._characters;
|
|
70256
|
+
for (var i = 0, imax = characters.length; i < imax;) {
|
|
70257
|
+
if (characters.charCodeAt(i) <= 0xff) {
|
|
70258
|
+
// Ignore ASCII characters
|
|
70259
|
+
i += 1;
|
|
70260
|
+
continue;
|
|
70261
|
+
}
|
|
70262
|
+
var j = i + 1;
|
|
70263
|
+
for (; j < imax; ++j) {
|
|
70264
|
+
var cc = characters.charCodeAt(j);
|
|
70265
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
70266
|
+
// Low surrogate
|
|
70267
|
+
// Variation selector
|
|
70268
|
+
continue;
|
|
70269
|
+
}
|
|
70270
|
+
break;
|
|
70271
|
+
}
|
|
70272
|
+
// Decrement the reference count
|
|
70273
|
+
var nac = characters.substring(i, j);
|
|
70274
|
+
var c = cs.get(nac);
|
|
70275
|
+
if (c != null && 0 < c.ref && !(c.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
70276
|
+
c.ref -= 1;
|
|
70277
|
+
if (c.ref === 0) {
|
|
70210
70278
|
this._unrefCount += 1;
|
|
70211
70279
|
}
|
|
70212
70280
|
}
|
|
70281
|
+
// Go to the next
|
|
70282
|
+
i = j;
|
|
70213
70283
|
}
|
|
70214
70284
|
};
|
|
70215
|
-
DynamicFontAtlas.prototype.
|
|
70216
|
-
|
|
70217
|
-
|
|
70218
|
-
|
|
70219
|
-
if (
|
|
70220
|
-
delete
|
|
70285
|
+
DynamicFontAtlas.prototype.cleanup = function () {
|
|
70286
|
+
var characters = this._characters;
|
|
70287
|
+
if (characters.size >> 1 <= this._unrefCount) {
|
|
70288
|
+
characters.forEach(function (char, id) {
|
|
70289
|
+
if (char.ref <= 0) {
|
|
70290
|
+
characters.delete(id);
|
|
70221
70291
|
}
|
|
70222
|
-
}
|
|
70223
|
-
this._length -= this._unrefCount;
|
|
70292
|
+
});
|
|
70224
70293
|
this._revision += 1;
|
|
70225
70294
|
this._unrefCount = 0;
|
|
70226
70295
|
}
|
|
70227
70296
|
};
|
|
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
70297
|
DynamicFontAtlas.prototype.get = function (id) {
|
|
70245
|
-
return this._characters
|
|
70298
|
+
return this._characters.get(id);
|
|
70246
70299
|
};
|
|
70247
70300
|
DynamicFontAtlas.prototype.getAdvance = function (target) {
|
|
70248
70301
|
var context = this.getContext();
|
|
@@ -70281,52 +70334,50 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70281
70334
|
return context;
|
|
70282
70335
|
};
|
|
70283
70336
|
DynamicFontAtlas.prototype.update = function () {
|
|
70284
|
-
this.
|
|
70337
|
+
this.cleanup();
|
|
70285
70338
|
if (this._revisionUpdated < this._revision) {
|
|
70286
70339
|
this._revisionUpdated = this._revision;
|
|
70287
70340
|
var canvas = this._canvas;
|
|
70288
70341
|
if (canvas != null) {
|
|
70289
70342
|
var font = this._font;
|
|
70290
|
-
var
|
|
70343
|
+
var fontHeight_1 = font.height;
|
|
70291
70344
|
var characters = this._characters;
|
|
70292
|
-
var
|
|
70293
|
-
var
|
|
70294
|
-
var
|
|
70295
|
-
var
|
|
70296
|
-
|
|
70297
|
-
|
|
70298
|
-
|
|
70299
|
-
|
|
70300
|
-
y += fontHeight;
|
|
70345
|
+
var width_1 = (this._width = this.toPowerOf2(Math.ceil(Math.sqrt(characters.size)) * fontHeight_1));
|
|
70346
|
+
var offsetX_1 = this._padding;
|
|
70347
|
+
var x_1 = 0;
|
|
70348
|
+
var y_1 = 0;
|
|
70349
|
+
characters.forEach(function (character) {
|
|
70350
|
+
if (width_1 <= x_1 + character.width) {
|
|
70351
|
+
x_1 = 0;
|
|
70352
|
+
y_1 += fontHeight_1;
|
|
70301
70353
|
}
|
|
70302
|
-
character.x =
|
|
70303
|
-
character.y =
|
|
70304
|
-
character.origin.x =
|
|
70305
|
-
|
|
70306
|
-
}
|
|
70307
|
-
var height = (this._height =
|
|
70354
|
+
character.x = x_1;
|
|
70355
|
+
character.y = y_1;
|
|
70356
|
+
character.origin.x = x_1 + offsetX_1;
|
|
70357
|
+
x_1 += character.width;
|
|
70358
|
+
});
|
|
70359
|
+
var height = (this._height = y_1 + fontHeight_1);
|
|
70308
70360
|
// Make an input canvas
|
|
70309
70361
|
// Here, we need to reset the context because
|
|
70310
70362
|
// context settings will be lost when we set the width/height.
|
|
70311
70363
|
var baseTexture = this._texture.baseTexture;
|
|
70312
70364
|
var resolution = baseTexture.resolution;
|
|
70313
|
-
var realWidth = Math.ceil(
|
|
70365
|
+
var realWidth = Math.ceil(width_1 * resolution);
|
|
70314
70366
|
var realHeight = Math.ceil(height * resolution);
|
|
70315
70367
|
canvas.width = realWidth;
|
|
70316
70368
|
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();
|
|
70369
|
+
var context_1 = this.getContext();
|
|
70370
|
+
if (context_1 != null) {
|
|
70371
|
+
UtilFont.measure(context_1, font);
|
|
70372
|
+
var offsetY_1 = Math.round((fontHeight_1 - (font.ascent + font.descent)) * 0.5 + font.ascent);
|
|
70373
|
+
context_1.save();
|
|
70374
|
+
context_1.scale(resolution, resolution);
|
|
70375
|
+
context_1.clearRect(0, 0, width_1, height);
|
|
70376
|
+
characters.forEach(function (character) {
|
|
70377
|
+
character.origin.y = character.y + offsetY_1;
|
|
70378
|
+
context_1.fillText(character.character, character.origin.x, character.origin.y);
|
|
70379
|
+
});
|
|
70380
|
+
context_1.restore();
|
|
70330
70381
|
}
|
|
70331
70382
|
baseTexture.setRealSize(realWidth, realHeight);
|
|
70332
70383
|
return true;
|
|
@@ -70342,7 +70393,7 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70342
70393
|
};
|
|
70343
70394
|
Object.defineProperty(DynamicFontAtlas.prototype, "length", {
|
|
70344
70395
|
get: function () {
|
|
70345
|
-
return this.
|
|
70396
|
+
return this._characters.size;
|
|
70346
70397
|
},
|
|
70347
70398
|
enumerable: false,
|
|
70348
70399
|
configurable: true
|
|
@@ -70352,10 +70403,9 @@ var DynamicFontAtlas = /** @class */ (function () {
|
|
|
70352
70403
|
if (canvas != null) {
|
|
70353
70404
|
this._canvas = null;
|
|
70354
70405
|
}
|
|
70355
|
-
|
|
70356
|
-
|
|
70357
|
-
|
|
70358
|
-
}
|
|
70406
|
+
this._characters.clear();
|
|
70407
|
+
this._createds.clear();
|
|
70408
|
+
this._unrefCount = 0;
|
|
70359
70409
|
};
|
|
70360
70410
|
DynamicFontAtlas.prototype.toPowerOf2 = function (size) {
|
|
70361
70411
|
var result = 32;
|
|
@@ -70404,7 +70454,7 @@ var DynamicFontAtlases = /** @class */ (function () {
|
|
|
70404
70454
|
atlas = new DynamicFontAtlas(fontId, fontSize, fontColor, this._resolution);
|
|
70405
70455
|
colorToAtlas.set(fontColor, atlas);
|
|
70406
70456
|
}
|
|
70407
|
-
atlas.add(targets);
|
|
70457
|
+
atlas.add(targets, DynamicFontAtlasCharacterType.LETTER);
|
|
70408
70458
|
};
|
|
70409
70459
|
DynamicFontAtlases.prototype.remove = function (fontId, fontColor, targets) {
|
|
70410
70460
|
var colorToAtlas = this._atlases.get(fontId);
|
|
@@ -77676,22 +77726,7 @@ var DPane = /** @class */ (function (_super) {
|
|
|
77676
77726
|
});
|
|
77677
77727
|
};
|
|
77678
77728
|
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
|
-
}
|
|
77729
|
+
// DO NOTHING
|
|
77695
77730
|
};
|
|
77696
77731
|
DPane.prototype.initScrollBar = function (scrollbar) {
|
|
77697
77732
|
var _this = this;
|
|
@@ -77764,14 +77799,18 @@ var DPane = /** @class */ (function (_super) {
|
|
|
77764
77799
|
};
|
|
77765
77800
|
DPane.prototype.getOverflowMask = function () {
|
|
77766
77801
|
var result = this._overflowMask;
|
|
77767
|
-
if (result
|
|
77768
|
-
result =
|
|
77802
|
+
if (result === undefined) {
|
|
77803
|
+
result = this.newOverflowMask();
|
|
77769
77804
|
this._overflowMask = result;
|
|
77770
|
-
this.reflowable.add(result);
|
|
77771
|
-
this.toDirty();
|
|
77772
77805
|
}
|
|
77773
77806
|
return result;
|
|
77774
77807
|
};
|
|
77808
|
+
DPane.prototype.newOverflowMask = function () {
|
|
77809
|
+
var result = new DBaseOverflowMask(this);
|
|
77810
|
+
this.reflowable.add(result);
|
|
77811
|
+
this.toDirty();
|
|
77812
|
+
return result;
|
|
77813
|
+
};
|
|
77775
77814
|
DPane.prototype.onWheel = function (e, deltas, global) {
|
|
77776
77815
|
var content = this.content;
|
|
77777
77816
|
var x = this.getWheelContentX(content, deltas.deltaX * deltas.lowest);
|
|
@@ -100706,6 +100745,7 @@ exports.BuilderTriangleRounded = BuilderTriangleRounded;
|
|
|
100706
100745
|
exports.CIRCLE_INDEX_COUNT = CIRCLE_INDEX_COUNT;
|
|
100707
100746
|
exports.CIRCLE_VERTEX_COUNT = CIRCLE_VERTEX_COUNT;
|
|
100708
100747
|
exports.CIRCLE_WORLD_SIZE = CIRCLE_WORLD_SIZE;
|
|
100748
|
+
exports.Character = Character;
|
|
100709
100749
|
exports.DAlignHorizontal = DAlignHorizontal;
|
|
100710
100750
|
exports.DAlignVertical = DAlignVertical;
|
|
100711
100751
|
exports.DAlignWith = DAlignWith;
|