@wcardinal/wcardinal-ui 0.424.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-chart-axis-guide-simple.d.ts +8 -1
- 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-chart-axis-guide-simple.js +54 -26
- package/dist/wcardinal/ui/d-chart-axis-guide-simple.js.map +1 -1
- 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 +545 -478
- package/dist/wcardinal-ui.js +545 -478
- 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.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
|
|
|
@@ -355,91 +355,6 @@
|
|
|
355
355
|
uvs[++iuv] = textureUvs.y2;
|
|
356
356
|
};
|
|
357
357
|
|
|
358
|
-
/*
|
|
359
|
-
* Copyright (C) 2019 Toshiba Corporation
|
|
360
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
361
|
-
*/
|
|
362
|
-
var UtilCharacterIterator = /** @class */ (function () {
|
|
363
|
-
function UtilCharacterIterator() {
|
|
364
|
-
this.target = "";
|
|
365
|
-
this.position = 0;
|
|
366
|
-
}
|
|
367
|
-
UtilCharacterIterator.prototype.init = function (target) {
|
|
368
|
-
this.target = target;
|
|
369
|
-
this.position = 0;
|
|
370
|
-
};
|
|
371
|
-
UtilCharacterIterator.prototype.hasNext = function () {
|
|
372
|
-
return this.position < this.target.length;
|
|
373
|
-
};
|
|
374
|
-
UtilCharacterIterator.prototype.findNextBreak = function (target, istart) {
|
|
375
|
-
var iend = target.length;
|
|
376
|
-
for (var i = istart; i < iend; ++i) {
|
|
377
|
-
var code = target.charCodeAt(i);
|
|
378
|
-
if (!this.isLowSurrogate(code) && !this.isVariationSelector(code)) {
|
|
379
|
-
return i;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
return iend;
|
|
383
|
-
};
|
|
384
|
-
UtilCharacterIterator.prototype.isHighSurrogate = function (code) {
|
|
385
|
-
return 0xd800 <= code && code <= 0xdbff;
|
|
386
|
-
};
|
|
387
|
-
UtilCharacterIterator.prototype.isLowSurrogate = function (code) {
|
|
388
|
-
return 0xdc00 <= code && code <= 0xdfff;
|
|
389
|
-
};
|
|
390
|
-
UtilCharacterIterator.prototype.isVariationSelector = function (code) {
|
|
391
|
-
return 0xfe00 <= code && code <= 0xfe0f;
|
|
392
|
-
};
|
|
393
|
-
UtilCharacterIterator.prototype.next = function () {
|
|
394
|
-
var target = this.target;
|
|
395
|
-
var position = this.position;
|
|
396
|
-
var nextBreak = this.findNextBreak(target, position + 1);
|
|
397
|
-
var result = target.substring(position, nextBreak);
|
|
398
|
-
this.position = nextBreak;
|
|
399
|
-
return result;
|
|
400
|
-
};
|
|
401
|
-
/**
|
|
402
|
-
* Advances the position if the next character is not equal to
|
|
403
|
-
* the given `except`.
|
|
404
|
-
*
|
|
405
|
-
* @param except
|
|
406
|
-
* @return true if the position is advanced
|
|
407
|
-
*/
|
|
408
|
-
UtilCharacterIterator.prototype.advance = function (except) {
|
|
409
|
-
var target = this.target;
|
|
410
|
-
var position = this.position;
|
|
411
|
-
var nextBreak = this.findNextBreak(target, position + 1);
|
|
412
|
-
if (target.substring(position, nextBreak) !== except) {
|
|
413
|
-
this.position = nextBreak;
|
|
414
|
-
return true;
|
|
415
|
-
}
|
|
416
|
-
return false;
|
|
417
|
-
};
|
|
418
|
-
/**
|
|
419
|
-
* Closes this iterator.
|
|
420
|
-
*
|
|
421
|
-
* @returns true if closed.
|
|
422
|
-
*/
|
|
423
|
-
UtilCharacterIterator.prototype.close = function () {
|
|
424
|
-
var length = this.target.length;
|
|
425
|
-
if (this.position < length) {
|
|
426
|
-
this.position = length;
|
|
427
|
-
return true;
|
|
428
|
-
}
|
|
429
|
-
return false;
|
|
430
|
-
};
|
|
431
|
-
UtilCharacterIterator.from = function (target) {
|
|
432
|
-
if (UtilCharacterIterator._instance == null) {
|
|
433
|
-
UtilCharacterIterator._instance = new UtilCharacterIterator();
|
|
434
|
-
}
|
|
435
|
-
var instance = UtilCharacterIterator._instance;
|
|
436
|
-
instance.init(target);
|
|
437
|
-
return instance;
|
|
438
|
-
};
|
|
439
|
-
UtilCharacterIterator._instance = null;
|
|
440
|
-
return UtilCharacterIterator;
|
|
441
|
-
}());
|
|
442
|
-
|
|
443
358
|
/*
|
|
444
359
|
* Copyright (C) 2019 Toshiba Corporation
|
|
445
360
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -498,6 +413,19 @@
|
|
|
498
413
|
return Math.sqrt(dx01 * dx01 + dy01 * dy01);
|
|
499
414
|
};
|
|
500
415
|
|
|
416
|
+
/*
|
|
417
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
418
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
419
|
+
*/
|
|
420
|
+
var Character = {
|
|
421
|
+
ASCII: "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
|
|
422
|
+
SPACE: " ",
|
|
423
|
+
TAB: "\t",
|
|
424
|
+
SOFT_TAB: " ",
|
|
425
|
+
DOTS: "...",
|
|
426
|
+
NEW_LINE: "\n"
|
|
427
|
+
};
|
|
428
|
+
|
|
501
429
|
var TEXT_VERTEX_COUNT = 4;
|
|
502
430
|
var TEXT_VERTEX_COUNT_SHIFT = 2;
|
|
503
431
|
var TEXT_INDEX_COUNT = 2;
|
|
@@ -844,7 +772,7 @@
|
|
|
844
772
|
return EShapeTextAlignVertical.OUTSIDE_TOP;
|
|
845
773
|
}
|
|
846
774
|
};
|
|
847
|
-
var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY, sizeX, sizeY, textAtlas, textSize,
|
|
775
|
+
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) {
|
|
848
776
|
// Calculate the transformed positions
|
|
849
777
|
//
|
|
850
778
|
// 0 1
|
|
@@ -936,15 +864,14 @@
|
|
|
936
864
|
var lineWidth = 0;
|
|
937
865
|
var lineCount = 1;
|
|
938
866
|
var textAtlasCharacters = textAtlas.characters;
|
|
939
|
-
var iterator = UtilCharacterIterator.from(textValue);
|
|
940
867
|
var advancePrevious = 0;
|
|
941
|
-
|
|
942
|
-
var character =
|
|
943
|
-
if (character !==
|
|
868
|
+
for (var i = 0, imax = textCharacters.length; i < imax; ++i) {
|
|
869
|
+
var character = textCharacters[i];
|
|
870
|
+
if (character !== Character.NEW_LINE) {
|
|
944
871
|
if (0 < advancePrevious) {
|
|
945
872
|
lineWidth += Math.max(0, advancePrevious + textSpacingHorizontal);
|
|
946
873
|
}
|
|
947
|
-
var data = textAtlasCharacters
|
|
874
|
+
var data = textAtlasCharacters.get(character);
|
|
948
875
|
if (data) {
|
|
949
876
|
advancePrevious = data.advance;
|
|
950
877
|
heightChar = data.height;
|
|
@@ -1088,12 +1015,11 @@
|
|
|
1088
1015
|
var cy3 = by3;
|
|
1089
1016
|
lineWidth = 0;
|
|
1090
1017
|
advancePrevious = 0;
|
|
1091
|
-
iterator.position = 0;
|
|
1092
1018
|
lineCount = 0;
|
|
1093
1019
|
var iv = voffset * 2;
|
|
1094
|
-
for (
|
|
1095
|
-
var character =
|
|
1096
|
-
if (character !==
|
|
1020
|
+
for (var i = 0, imax = textCharacters.length; i < imax; i += 1, iv += 8) {
|
|
1021
|
+
var character = textCharacters[i];
|
|
1022
|
+
if (character !== Character.NEW_LINE) {
|
|
1097
1023
|
var lineWidthPrevious = lineWidth;
|
|
1098
1024
|
if (0 < advancePrevious) {
|
|
1099
1025
|
lineWidth += Math.max(0, advancePrevious + textSpacingHorizontal);
|
|
@@ -1104,12 +1030,12 @@
|
|
|
1104
1030
|
cy0 = by0 + ay;
|
|
1105
1031
|
cx3 = bx3 + ax;
|
|
1106
1032
|
cy3 = by3 + ay;
|
|
1107
|
-
var data = textAtlasCharacters
|
|
1033
|
+
var data = textAtlasCharacters.get(character);
|
|
1108
1034
|
lineCount += 1;
|
|
1109
1035
|
if (data) {
|
|
1110
1036
|
var advance = data.advance;
|
|
1111
1037
|
if (lineWidthMaximum < (lineWidth + advance) * scaleX) {
|
|
1112
|
-
var dots = textAtlasCharacters
|
|
1038
|
+
var dots = textAtlasCharacters.get(Character.DOTS);
|
|
1113
1039
|
if (dots) {
|
|
1114
1040
|
if (1 < lineCount &&
|
|
1115
1041
|
lineWidthMaximum < (lineWidth + dots.advance) * scaleX) {
|
|
@@ -1126,9 +1052,10 @@
|
|
|
1126
1052
|
advancePrevious = dots.advance;
|
|
1127
1053
|
writeCharacter(vertices, uvs, iv, dots, textAtlas, snx, sny, cx0, cy0, cx3, cy3, duvx01, duvy01, duvx03, duvy03, uvx0, uvy0);
|
|
1128
1054
|
for (iv += 8; true; iv += 8) {
|
|
1129
|
-
if (
|
|
1055
|
+
if (i + 1 < imax && textCharacters[i + 1] !== Character.NEW_LINE) {
|
|
1130
1056
|
writeCharacterEmpty(vertices, uvs, iv, cx0, cy0, cx3, cy3, uvx0, uvy0, uvx3, uvy3);
|
|
1131
1057
|
lineCount += 1;
|
|
1058
|
+
i += 1;
|
|
1132
1059
|
}
|
|
1133
1060
|
else {
|
|
1134
1061
|
iv -= 8;
|
|
@@ -7797,6 +7724,9 @@
|
|
|
7797
7724
|
this.padding = new EShapeTextOffsetImpl(parent, 10, 10);
|
|
7798
7725
|
this._clipping = false;
|
|
7799
7726
|
this._fitting = false;
|
|
7727
|
+
this._characters = [];
|
|
7728
|
+
this._nacharacters = [];
|
|
7729
|
+
this.updateCharacters(value);
|
|
7800
7730
|
}
|
|
7801
7731
|
Object.defineProperty(EShapeTextImpl.prototype, "enable", {
|
|
7802
7732
|
get: function () {
|
|
@@ -7823,7 +7753,8 @@
|
|
|
7823
7753
|
if (this._plength < length_1) {
|
|
7824
7754
|
this._plength = length_1;
|
|
7825
7755
|
}
|
|
7826
|
-
|
|
7756
|
+
this.updateCharacters(value);
|
|
7757
|
+
if (this.isCompatible()) {
|
|
7827
7758
|
this._parent.updateUploaded();
|
|
7828
7759
|
}
|
|
7829
7760
|
else {
|
|
@@ -7835,7 +7766,78 @@
|
|
|
7835
7766
|
enumerable: false,
|
|
7836
7767
|
configurable: true
|
|
7837
7768
|
});
|
|
7838
|
-
EShapeTextImpl.prototype
|
|
7769
|
+
Object.defineProperty(EShapeTextImpl.prototype, "characters", {
|
|
7770
|
+
get: function () {
|
|
7771
|
+
return this._characters;
|
|
7772
|
+
},
|
|
7773
|
+
enumerable: false,
|
|
7774
|
+
configurable: true
|
|
7775
|
+
});
|
|
7776
|
+
Object.defineProperty(EShapeTextImpl.prototype, "nacharacters", {
|
|
7777
|
+
get: function () {
|
|
7778
|
+
return this._nacharacters;
|
|
7779
|
+
},
|
|
7780
|
+
enumerable: false,
|
|
7781
|
+
configurable: true
|
|
7782
|
+
});
|
|
7783
|
+
EShapeTextImpl.prototype.updateCharacters = function (value) {
|
|
7784
|
+
var characters = this._characters;
|
|
7785
|
+
var charactersLength = characters.length;
|
|
7786
|
+
var icharacters = 0;
|
|
7787
|
+
var nacharacters = this._nacharacters;
|
|
7788
|
+
var nacharactersLength = nacharacters.length;
|
|
7789
|
+
var inacharacters = 0;
|
|
7790
|
+
for (var i = 0, imax = value.length; i < imax;) {
|
|
7791
|
+
if (value.charCodeAt(i) <= 0xff) {
|
|
7792
|
+
// Add an ASCII character
|
|
7793
|
+
var ac = value.substring(i, i + 1);
|
|
7794
|
+
if (icharacters < charactersLength) {
|
|
7795
|
+
characters[icharacters] = ac;
|
|
7796
|
+
}
|
|
7797
|
+
else {
|
|
7798
|
+
characters.push(ac);
|
|
7799
|
+
}
|
|
7800
|
+
icharacters += 1;
|
|
7801
|
+
i += 1;
|
|
7802
|
+
continue;
|
|
7803
|
+
}
|
|
7804
|
+
var j = i + 1;
|
|
7805
|
+
for (; j < imax; ++j) {
|
|
7806
|
+
var cc = value.charCodeAt(j);
|
|
7807
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
7808
|
+
// Low surrogate
|
|
7809
|
+
// Variation selector
|
|
7810
|
+
continue;
|
|
7811
|
+
}
|
|
7812
|
+
break;
|
|
7813
|
+
}
|
|
7814
|
+
// Add an non-ascii character
|
|
7815
|
+
var nac = value.substring(i, j);
|
|
7816
|
+
if (icharacters < charactersLength) {
|
|
7817
|
+
characters[icharacters] = nac;
|
|
7818
|
+
}
|
|
7819
|
+
else {
|
|
7820
|
+
characters.push(nac);
|
|
7821
|
+
}
|
|
7822
|
+
icharacters += 1;
|
|
7823
|
+
if (inacharacters < nacharactersLength) {
|
|
7824
|
+
nacharacters[inacharacters] = nac;
|
|
7825
|
+
}
|
|
7826
|
+
else {
|
|
7827
|
+
nacharacters.push(nac);
|
|
7828
|
+
}
|
|
7829
|
+
inacharacters += 1;
|
|
7830
|
+
// Go to the next
|
|
7831
|
+
i = j;
|
|
7832
|
+
}
|
|
7833
|
+
if (icharacters < charactersLength) {
|
|
7834
|
+
characters.length = icharacters;
|
|
7835
|
+
}
|
|
7836
|
+
if (inacharacters < nacharactersLength) {
|
|
7837
|
+
nacharacters.length = inacharacters;
|
|
7838
|
+
}
|
|
7839
|
+
};
|
|
7840
|
+
EShapeTextImpl.prototype.isCompatible = function () {
|
|
7839
7841
|
// Compatibility check
|
|
7840
7842
|
var parent = this._parent;
|
|
7841
7843
|
var uploaded = parent.uploaded;
|
|
@@ -7844,18 +7846,17 @@
|
|
|
7844
7846
|
}
|
|
7845
7847
|
// Character code check
|
|
7846
7848
|
var atlas = this.atlas;
|
|
7847
|
-
|
|
7848
|
-
if (characters != null) {
|
|
7849
|
-
for (var i = 0, imax = value.length; i < imax; ++i) {
|
|
7850
|
-
var char = value[i];
|
|
7851
|
-
if (!(char in characters)) {
|
|
7852
|
-
return false;
|
|
7853
|
-
}
|
|
7854
|
-
}
|
|
7855
|
-
}
|
|
7856
|
-
else {
|
|
7849
|
+
if (atlas == null) {
|
|
7857
7850
|
return false;
|
|
7858
7851
|
}
|
|
7852
|
+
var atlasCharacters = atlas.characters;
|
|
7853
|
+
var nacharacters = this._nacharacters;
|
|
7854
|
+
for (var i = 0, imax = nacharacters.length; i < imax; ++i) {
|
|
7855
|
+
if (!atlasCharacters.has(nacharacters[i])) {
|
|
7856
|
+
return false;
|
|
7857
|
+
}
|
|
7858
|
+
}
|
|
7859
|
+
// Done
|
|
7859
7860
|
return true;
|
|
7860
7861
|
};
|
|
7861
7862
|
Object.defineProperty(EShapeTextImpl.prototype, "length", {
|
|
@@ -8010,7 +8011,8 @@
|
|
|
8010
8011
|
if (this._plength < length_2) {
|
|
8011
8012
|
this._plength = length_2;
|
|
8012
8013
|
}
|
|
8013
|
-
|
|
8014
|
+
this.updateCharacters(value);
|
|
8015
|
+
if (this.isCompatible()) {
|
|
8014
8016
|
isChangedUploaded = true;
|
|
8015
8017
|
}
|
|
8016
8018
|
else {
|
|
@@ -8841,7 +8843,7 @@
|
|
|
8841
8843
|
textWorld = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];
|
|
8842
8844
|
text.world = textWorld;
|
|
8843
8845
|
}
|
|
8844
|
-
buildTextVertex(buffer.vertices, buffer.uvs, this.vertexOffset, this.vertexCount, 0, 0, shapeSize.x, shapeSize.y, textAtlas, textSize,
|
|
8846
|
+
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);
|
|
8845
8847
|
}
|
|
8846
8848
|
};
|
|
8847
8849
|
BuilderText.prototype.updateColor = function (buffer, shape) {
|
|
@@ -21156,12 +21158,6 @@
|
|
|
21156
21158
|
return DynamicAtlasItemFontAtlas;
|
|
21157
21159
|
}(DynamicAtlasItem));
|
|
21158
21160
|
|
|
21159
|
-
/*
|
|
21160
|
-
* Copyright (C) 2019 Toshiba Corporation
|
|
21161
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
21162
|
-
*/
|
|
21163
|
-
var ASCII_CHARACTERS = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
|
|
21164
|
-
|
|
21165
21161
|
/*
|
|
21166
21162
|
* Copyright (C) 2019 Toshiba Corporation
|
|
21167
21163
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -21181,7 +21177,7 @@
|
|
|
21181
21177
|
var DynamicFontAtlasCharacter = /** @class */ (function () {
|
|
21182
21178
|
function DynamicFontAtlasCharacter(type, character, x, y, width, height, advance) {
|
|
21183
21179
|
this.ref = 1;
|
|
21184
|
-
this.life =
|
|
21180
|
+
this.life = DynamicFontAtlasCharacter.LIFE;
|
|
21185
21181
|
this.character = character;
|
|
21186
21182
|
this.x = x;
|
|
21187
21183
|
this.y = y;
|
|
@@ -21191,6 +21187,7 @@
|
|
|
21191
21187
|
this.origin = new DynamicFontAtlasCharacterOrigin(0, 0);
|
|
21192
21188
|
this.type = type;
|
|
21193
21189
|
}
|
|
21190
|
+
DynamicFontAtlasCharacter.LIFE = 10;
|
|
21194
21191
|
return DynamicFontAtlasCharacter;
|
|
21195
21192
|
}());
|
|
21196
21193
|
|
|
@@ -21610,10 +21607,17 @@
|
|
|
21610
21607
|
this._generator = DynamicSDFFontGenerator.getInstance().init();
|
|
21611
21608
|
this._canvas = document.createElement("canvas");
|
|
21612
21609
|
this._font = new DynamicSDFFontAtlasFont(fontFamily);
|
|
21613
|
-
this._characters = {};
|
|
21614
|
-
this._length = 0;
|
|
21615
21610
|
this._width = 1;
|
|
21616
21611
|
this._height = 1;
|
|
21612
|
+
var characters = new Map();
|
|
21613
|
+
characters.set(Character.SPACE, this.newChar(Character.SPACE, DynamicFontAtlasCharacterType.SPACE_R));
|
|
21614
|
+
characters.set(Character.TAB, this.newChar(Character.SOFT_TAB, DynamicFontAtlasCharacterType.SPACE_R));
|
|
21615
|
+
characters.set(Character.DOTS, this.newChar(Character.DOTS, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
21616
|
+
for (var i = 0, imax = Character.ASCII.length; i < imax; ++i) {
|
|
21617
|
+
var ac = Character.ASCII[i];
|
|
21618
|
+
characters.set(ac, this.newChar(ac, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
21619
|
+
}
|
|
21620
|
+
this._characters = characters;
|
|
21617
21621
|
this._isDirty = true;
|
|
21618
21622
|
}
|
|
21619
21623
|
Object.defineProperty(DynamicSDFFontAtlas.prototype, "id", {
|
|
@@ -21671,143 +21675,109 @@
|
|
|
21671
21675
|
configurable: true
|
|
21672
21676
|
});
|
|
21673
21677
|
DynamicSDFFontAtlas.prototype.begin = function () {
|
|
21674
|
-
this.
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
}
|
|
21678
|
+
this._characters.forEach(function (character) {
|
|
21679
|
+
if (!(character.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
21680
|
+
character.ref = 0;
|
|
21681
|
+
}
|
|
21682
|
+
});
|
|
21679
21683
|
};
|
|
21680
21684
|
DynamicSDFFontAtlas.prototype.end = function () {
|
|
21685
|
+
var _this = this;
|
|
21681
21686
|
var characters = this._characters;
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21688
|
-
this._isDirty = true;
|
|
21687
|
+
characters.forEach(function (character, id) {
|
|
21688
|
+
if (character.ref <= 0 && !(character.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
21689
|
+
character.life -= 1;
|
|
21690
|
+
if (character.life <= 0) {
|
|
21691
|
+
characters.delete(id);
|
|
21692
|
+
_this._isDirty = true;
|
|
21689
21693
|
}
|
|
21690
21694
|
}
|
|
21691
|
-
}
|
|
21695
|
+
});
|
|
21692
21696
|
};
|
|
21693
|
-
DynamicSDFFontAtlas.prototype.
|
|
21694
|
-
|
|
21695
|
-
this.addChar("\t", " ", DynamicFontAtlasCharacterType.SPACE_R);
|
|
21696
|
-
this.addChar("...", "...", DynamicFontAtlasCharacterType.LETTER_RNB);
|
|
21697
|
-
for (var i = 0, imax = ASCII_CHARACTERS.length; i < imax; ++i) {
|
|
21698
|
-
var char = ASCII_CHARACTERS[i];
|
|
21699
|
-
this.addChar(char, char, DynamicFontAtlasCharacterType.LETTER_RNB);
|
|
21700
|
-
}
|
|
21697
|
+
DynamicSDFFontAtlas.prototype.newChar = function (character, type) {
|
|
21698
|
+
return new DynamicFontAtlasCharacter(type, character, 0, 0, 1, 1, 0);
|
|
21701
21699
|
};
|
|
21702
|
-
DynamicSDFFontAtlas.prototype.
|
|
21703
|
-
var
|
|
21704
|
-
|
|
21705
|
-
var
|
|
21700
|
+
DynamicSDFFontAtlas.prototype.add = function (characters, nacharacters) {
|
|
21701
|
+
var cs = this._characters;
|
|
21702
|
+
for (var i = 0, imax = nacharacters.length; i < imax; ++i) {
|
|
21703
|
+
var nac = nacharacters[i];
|
|
21704
|
+
var data = cs.get(nac);
|
|
21706
21705
|
if (data != null) {
|
|
21707
|
-
if (data.ref <= 0) {
|
|
21708
|
-
this._length += 1;
|
|
21709
|
-
}
|
|
21710
21706
|
data.ref += 1;
|
|
21711
21707
|
}
|
|
21712
21708
|
else {
|
|
21713
|
-
|
|
21714
|
-
this._length += 1;
|
|
21709
|
+
cs.set(nac, this.newChar(nac, DynamicFontAtlasCharacterType.LETTER));
|
|
21715
21710
|
this._isDirty = true;
|
|
21716
21711
|
}
|
|
21717
21712
|
}
|
|
21718
21713
|
};
|
|
21719
|
-
DynamicSDFFontAtlas.prototype.isIgnored = function (character) {
|
|
21720
|
-
switch (character) {
|
|
21721
|
-
case "\n": // Line feed
|
|
21722
|
-
return true;
|
|
21723
|
-
case "\r": // Carriage return
|
|
21724
|
-
return true;
|
|
21725
|
-
case "\v": // Vertical tab
|
|
21726
|
-
return true;
|
|
21727
|
-
case "\f": // Form feed
|
|
21728
|
-
return true;
|
|
21729
|
-
case "\u0085": // Next line
|
|
21730
|
-
return true;
|
|
21731
|
-
}
|
|
21732
|
-
return false;
|
|
21733
|
-
};
|
|
21734
|
-
DynamicSDFFontAtlas.prototype.add = function (characters, type) {
|
|
21735
|
-
if (type === void 0) { type = DynamicFontAtlasCharacterType.LETTER; }
|
|
21736
|
-
var iterator = UtilCharacterIterator.from(characters);
|
|
21737
|
-
while (iterator.hasNext()) {
|
|
21738
|
-
var character = iterator.next();
|
|
21739
|
-
this.addChar(character, character, type);
|
|
21740
|
-
}
|
|
21741
|
-
};
|
|
21742
21714
|
DynamicSDFFontAtlas.prototype.get = function (id) {
|
|
21743
|
-
return this._characters
|
|
21715
|
+
return this._characters.get(id);
|
|
21744
21716
|
};
|
|
21745
21717
|
DynamicSDFFontAtlas.prototype.update = function () {
|
|
21746
21718
|
if (this._isDirty) {
|
|
21747
21719
|
var canvas = this._canvas;
|
|
21748
21720
|
var generator = this._generator;
|
|
21749
21721
|
if (canvas != null && generator != null) {
|
|
21750
|
-
var
|
|
21751
|
-
if (
|
|
21722
|
+
var context_1 = canvas.getContext("2d");
|
|
21723
|
+
if (context_1 != null) {
|
|
21752
21724
|
this._isDirty = false;
|
|
21753
21725
|
var font = this._font;
|
|
21726
|
+
var fontSize_1 = font.size + 14;
|
|
21754
21727
|
var characters = this._characters;
|
|
21755
|
-
var
|
|
21756
|
-
|
|
21757
|
-
this._width = width;
|
|
21728
|
+
var width_1 = this.toPowerOf2(Math.ceil(Math.sqrt(characters.size)) * fontSize_1);
|
|
21729
|
+
this._width = width_1;
|
|
21758
21730
|
var fontStyle = (font.italic ? "italic " : "") + (font.size + "px ") + font.id;
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
UtilFont.measure(
|
|
21768
|
-
var
|
|
21769
|
-
var
|
|
21770
|
-
var
|
|
21771
|
-
var
|
|
21772
|
-
|
|
21773
|
-
var
|
|
21774
|
-
var
|
|
21775
|
-
var
|
|
21776
|
-
|
|
21777
|
-
|
|
21778
|
-
|
|
21779
|
-
y += characterSize;
|
|
21731
|
+
context_1.font = fontStyle;
|
|
21732
|
+
context_1.textAlign = "left";
|
|
21733
|
+
context_1.textBaseline = "alphabetic";
|
|
21734
|
+
context_1.lineWidth = 0;
|
|
21735
|
+
context_1.lineCap = "round";
|
|
21736
|
+
context_1.lineJoin = "miter";
|
|
21737
|
+
context_1.miterLimit = 10;
|
|
21738
|
+
context_1.fillStyle = "#FFFFFF";
|
|
21739
|
+
UtilFont.measure(context_1, font);
|
|
21740
|
+
var offsetX_1 = 7;
|
|
21741
|
+
var offsetY_1 = Math.round((fontSize_1 - (font.ascent + font.descent)) * 0.5 + font.ascent);
|
|
21742
|
+
var x_1 = 0;
|
|
21743
|
+
var y_1 = 0;
|
|
21744
|
+
characters.forEach(function (character) {
|
|
21745
|
+
var advance = context_1.measureText(character.character).width;
|
|
21746
|
+
var characterWidth = Math.ceil(offsetX_1 + advance + offsetX_1);
|
|
21747
|
+
var characterHeight = fontSize_1;
|
|
21748
|
+
if (width_1 <= x_1 + characterWidth) {
|
|
21749
|
+
x_1 = 0;
|
|
21750
|
+
y_1 += fontSize_1;
|
|
21780
21751
|
}
|
|
21781
|
-
|
|
21782
|
-
|
|
21783
|
-
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
}
|
|
21790
|
-
var height = (this._height =
|
|
21752
|
+
character.x = x_1;
|
|
21753
|
+
character.y = y_1;
|
|
21754
|
+
character.width = characterWidth;
|
|
21755
|
+
character.height = characterHeight;
|
|
21756
|
+
character.advance = advance;
|
|
21757
|
+
character.origin.x = x_1 + offsetX_1;
|
|
21758
|
+
character.origin.y = y_1 + offsetY_1;
|
|
21759
|
+
x_1 += characterWidth;
|
|
21760
|
+
});
|
|
21761
|
+
var height = (this._height = y_1 + fontSize_1);
|
|
21791
21762
|
// Make a input canvas
|
|
21792
21763
|
// Here, we need to reset the context because
|
|
21793
21764
|
// context settings will be lost when we set the width/height.
|
|
21794
|
-
canvas.width =
|
|
21765
|
+
canvas.width = width_1;
|
|
21795
21766
|
canvas.height = height;
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
}
|
|
21767
|
+
context_1.font = fontStyle;
|
|
21768
|
+
context_1.textAlign = "left";
|
|
21769
|
+
context_1.textBaseline = "alphabetic";
|
|
21770
|
+
context_1.lineWidth = 0;
|
|
21771
|
+
context_1.lineCap = "round";
|
|
21772
|
+
context_1.lineJoin = "miter";
|
|
21773
|
+
context_1.miterLimit = 10;
|
|
21774
|
+
context_1.fillStyle = "#FFFFFF";
|
|
21775
|
+
context_1.clearRect(0, 0, width_1, height);
|
|
21776
|
+
characters.forEach(function (character) {
|
|
21777
|
+
context_1.fillText(character.character, character.origin.x, character.origin.y);
|
|
21778
|
+
});
|
|
21809
21779
|
// Convert to SDF font texture
|
|
21810
|
-
generator.updateTexture(
|
|
21780
|
+
generator.updateTexture(width_1, height, canvas);
|
|
21811
21781
|
generator.render();
|
|
21812
21782
|
generator.read(canvas);
|
|
21813
21783
|
return true;
|
|
@@ -21818,7 +21788,7 @@
|
|
|
21818
21788
|
};
|
|
21819
21789
|
Object.defineProperty(DynamicSDFFontAtlas.prototype, "length", {
|
|
21820
21790
|
get: function () {
|
|
21821
|
-
return this.
|
|
21791
|
+
return this._characters.size;
|
|
21822
21792
|
},
|
|
21823
21793
|
enumerable: false,
|
|
21824
21794
|
configurable: true
|
|
@@ -21843,10 +21813,7 @@
|
|
|
21843
21813
|
if (canvas != null) {
|
|
21844
21814
|
this._canvas = null;
|
|
21845
21815
|
}
|
|
21846
|
-
|
|
21847
|
-
for (var id in characters) {
|
|
21848
|
-
delete characters[id];
|
|
21849
|
-
}
|
|
21816
|
+
this._characters.clear();
|
|
21850
21817
|
};
|
|
21851
21818
|
DynamicSDFFontAtlas.prototype.toPowerOf2 = function (size) {
|
|
21852
21819
|
var result = 32;
|
|
@@ -21864,52 +21831,45 @@
|
|
|
21864
21831
|
*/
|
|
21865
21832
|
var DynamicSDFFontAtlases = /** @class */ (function () {
|
|
21866
21833
|
function DynamicSDFFontAtlases() {
|
|
21867
|
-
this._atlases =
|
|
21834
|
+
this._atlases = new Map();
|
|
21868
21835
|
}
|
|
21869
21836
|
DynamicSDFFontAtlases.prototype.begin = function () {
|
|
21870
|
-
|
|
21871
|
-
for (var family in atlases) {
|
|
21872
|
-
var atlas = atlases[family];
|
|
21837
|
+
this._atlases.forEach(function (atlas) {
|
|
21873
21838
|
atlas.begin();
|
|
21874
|
-
}
|
|
21839
|
+
});
|
|
21875
21840
|
};
|
|
21876
21841
|
DynamicSDFFontAtlases.prototype.end = function () {
|
|
21877
21842
|
var atlases = this._atlases;
|
|
21878
|
-
|
|
21879
|
-
var atlas = atlases[family];
|
|
21880
|
-
if (0 < atlas.length) {
|
|
21881
|
-
atlas.addAscii();
|
|
21882
|
-
}
|
|
21843
|
+
atlases.forEach(function (atlas, family) {
|
|
21883
21844
|
atlas.end();
|
|
21884
21845
|
if (atlas.length <= 0) {
|
|
21885
21846
|
atlas.destroy();
|
|
21886
|
-
delete
|
|
21847
|
+
atlases.delete(family);
|
|
21887
21848
|
}
|
|
21888
|
-
}
|
|
21849
|
+
});
|
|
21889
21850
|
};
|
|
21890
|
-
DynamicSDFFontAtlases.prototype.add = function (family,
|
|
21891
|
-
var
|
|
21851
|
+
DynamicSDFFontAtlases.prototype.add = function (family, characters, nacharacters) {
|
|
21852
|
+
var atlases = this._atlases;
|
|
21853
|
+
var atlas = atlases.get(family);
|
|
21892
21854
|
if (atlas != null) {
|
|
21893
|
-
atlas.add(
|
|
21855
|
+
atlas.add(characters, nacharacters);
|
|
21894
21856
|
}
|
|
21895
21857
|
else {
|
|
21896
21858
|
var newAtlas = new DynamicSDFFontAtlas(family);
|
|
21897
|
-
newAtlas.add(
|
|
21898
|
-
|
|
21859
|
+
newAtlas.add(characters, nacharacters);
|
|
21860
|
+
atlases.set(family, newAtlas);
|
|
21899
21861
|
}
|
|
21900
21862
|
};
|
|
21901
21863
|
DynamicSDFFontAtlases.prototype.get = function (family) {
|
|
21902
|
-
var atlas = this._atlases
|
|
21864
|
+
var atlas = this._atlases.get(family);
|
|
21903
21865
|
if (atlas != null) {
|
|
21904
21866
|
return atlas;
|
|
21905
21867
|
}
|
|
21906
21868
|
return null;
|
|
21907
21869
|
};
|
|
21908
21870
|
DynamicSDFFontAtlases.prototype.update = function (baseAtlas) {
|
|
21909
|
-
var atlases = this._atlases;
|
|
21910
21871
|
var baseTexture = baseAtlas.getBaseTexture();
|
|
21911
|
-
|
|
21912
|
-
var atlas = atlases[family];
|
|
21872
|
+
this._atlases.forEach(function (atlas) {
|
|
21913
21873
|
if (atlas.update()) {
|
|
21914
21874
|
var atlasId = atlas.id;
|
|
21915
21875
|
var item = baseAtlas.get(atlasId);
|
|
@@ -21927,15 +21887,14 @@
|
|
|
21927
21887
|
baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
|
|
21928
21888
|
}
|
|
21929
21889
|
}
|
|
21930
|
-
}
|
|
21890
|
+
});
|
|
21931
21891
|
};
|
|
21932
21892
|
DynamicSDFFontAtlases.prototype.destroy = function () {
|
|
21933
21893
|
var atlases = this._atlases;
|
|
21934
|
-
|
|
21935
|
-
var atlas = atlases[family];
|
|
21894
|
+
atlases.forEach(function (atlas) {
|
|
21936
21895
|
atlas.destroy();
|
|
21937
|
-
}
|
|
21938
|
-
|
|
21896
|
+
});
|
|
21897
|
+
atlases.clear();
|
|
21939
21898
|
};
|
|
21940
21899
|
return DynamicSDFFontAtlases;
|
|
21941
21900
|
}());
|
|
@@ -22323,9 +22282,9 @@
|
|
|
22323
22282
|
}
|
|
22324
22283
|
// Font texture atlas
|
|
22325
22284
|
var text = shape.text;
|
|
22326
|
-
var
|
|
22327
|
-
if (0 <
|
|
22328
|
-
fontAtlases.add(text.family,
|
|
22285
|
+
var textCharacters = text.characters;
|
|
22286
|
+
if (0 < textCharacters.length) {
|
|
22287
|
+
fontAtlases.add(text.family, textCharacters, text.nacharacters);
|
|
22329
22288
|
}
|
|
22330
22289
|
};
|
|
22331
22290
|
EShapeRenderer.prototype.updateAtlases = function (shapes, atlas, fontAtlases, defaultTexture, baseTexture) {
|
|
@@ -28692,6 +28651,74 @@
|
|
|
28692
28651
|
return DDynamicTextMeasureResult;
|
|
28693
28652
|
}());
|
|
28694
28653
|
|
|
28654
|
+
/*
|
|
28655
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
28656
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
28657
|
+
*/
|
|
28658
|
+
var UtilCharacterIterator = /** @class */ (function () {
|
|
28659
|
+
function UtilCharacterIterator() {
|
|
28660
|
+
this.target = "";
|
|
28661
|
+
this.position = 0;
|
|
28662
|
+
}
|
|
28663
|
+
UtilCharacterIterator.prototype.init = function (target) {
|
|
28664
|
+
this.target = target;
|
|
28665
|
+
this.position = 0;
|
|
28666
|
+
};
|
|
28667
|
+
UtilCharacterIterator.prototype.hasNext = function () {
|
|
28668
|
+
return this.position < this.target.length;
|
|
28669
|
+
};
|
|
28670
|
+
UtilCharacterIterator.prototype.findNextBreak = function (target, istart) {
|
|
28671
|
+
var iend = target.length;
|
|
28672
|
+
for (var i = istart; i < iend; ++i) {
|
|
28673
|
+
var code = target.charCodeAt(i);
|
|
28674
|
+
if (!this.isLowSurrogate(code) && !this.isVariationSelector(code)) {
|
|
28675
|
+
return i;
|
|
28676
|
+
}
|
|
28677
|
+
}
|
|
28678
|
+
return iend;
|
|
28679
|
+
};
|
|
28680
|
+
UtilCharacterIterator.prototype.isHighSurrogate = function (code) {
|
|
28681
|
+
return 0xd800 <= code && code <= 0xdbff;
|
|
28682
|
+
};
|
|
28683
|
+
UtilCharacterIterator.prototype.isLowSurrogate = function (code) {
|
|
28684
|
+
return 0xdc00 <= code && code <= 0xdfff;
|
|
28685
|
+
};
|
|
28686
|
+
UtilCharacterIterator.prototype.isVariationSelector = function (code) {
|
|
28687
|
+
return 0xfe00 <= code && code <= 0xfe0f;
|
|
28688
|
+
};
|
|
28689
|
+
UtilCharacterIterator.prototype.next = function () {
|
|
28690
|
+
var target = this.target;
|
|
28691
|
+
var position = this.position;
|
|
28692
|
+
var nextBreak = this.findNextBreak(target, position + 1);
|
|
28693
|
+
var result = target.substring(position, nextBreak);
|
|
28694
|
+
this.position = nextBreak;
|
|
28695
|
+
return result;
|
|
28696
|
+
};
|
|
28697
|
+
/**
|
|
28698
|
+
* Closes this iterator.
|
|
28699
|
+
*
|
|
28700
|
+
* @returns true if closed.
|
|
28701
|
+
*/
|
|
28702
|
+
UtilCharacterIterator.prototype.close = function () {
|
|
28703
|
+
var length = this.target.length;
|
|
28704
|
+
if (this.position < length) {
|
|
28705
|
+
this.position = length;
|
|
28706
|
+
return true;
|
|
28707
|
+
}
|
|
28708
|
+
return false;
|
|
28709
|
+
};
|
|
28710
|
+
UtilCharacterIterator.from = function (target) {
|
|
28711
|
+
if (UtilCharacterIterator._instance == null) {
|
|
28712
|
+
UtilCharacterIterator._instance = new UtilCharacterIterator();
|
|
28713
|
+
}
|
|
28714
|
+
var instance = UtilCharacterIterator._instance;
|
|
28715
|
+
instance.init(target);
|
|
28716
|
+
return instance;
|
|
28717
|
+
};
|
|
28718
|
+
UtilCharacterIterator._instance = null;
|
|
28719
|
+
return UtilCharacterIterator;
|
|
28720
|
+
}());
|
|
28721
|
+
|
|
28695
28722
|
/*
|
|
28696
28723
|
* Copyright (C) 2019 Toshiba Corporation
|
|
28697
28724
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -28702,7 +28729,6 @@
|
|
|
28702
28729
|
BREAK_ALL: 2
|
|
28703
28730
|
};
|
|
28704
28731
|
|
|
28705
|
-
var NEW_LINE = "\n";
|
|
28706
28732
|
var DDynamicTextMeasure = /** @class */ (function () {
|
|
28707
28733
|
function DDynamicTextMeasure() {
|
|
28708
28734
|
}
|
|
@@ -28772,7 +28798,7 @@
|
|
|
28772
28798
|
while (iterator.hasNext()) {
|
|
28773
28799
|
var characterPosition = iterator.position;
|
|
28774
28800
|
var character = iterator.next();
|
|
28775
|
-
if (character === NEW_LINE) {
|
|
28801
|
+
if (character === Character.NEW_LINE) {
|
|
28776
28802
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28777
28803
|
result.newLine(lineHeight);
|
|
28778
28804
|
}
|
|
@@ -28804,7 +28830,7 @@
|
|
|
28804
28830
|
DDynamicTextMeasure.measure1b = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28805
28831
|
while (iterator.hasNext()) {
|
|
28806
28832
|
var character = iterator.next();
|
|
28807
|
-
if (character === NEW_LINE) {
|
|
28833
|
+
if (character === Character.NEW_LINE) {
|
|
28808
28834
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28809
28835
|
result.newLine(lineHeight);
|
|
28810
28836
|
}
|
|
@@ -28835,7 +28861,7 @@
|
|
|
28835
28861
|
DDynamicTextMeasure.measure1 = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28836
28862
|
while (iterator.hasNext()) {
|
|
28837
28863
|
var character = iterator.next();
|
|
28838
|
-
if (character === NEW_LINE) {
|
|
28864
|
+
if (character === Character.NEW_LINE) {
|
|
28839
28865
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28840
28866
|
result.newLine(lineHeight);
|
|
28841
28867
|
}
|
|
@@ -28867,7 +28893,7 @@
|
|
|
28867
28893
|
while (iterator.hasNext()) {
|
|
28868
28894
|
var characterPosition = iterator.position;
|
|
28869
28895
|
var character = iterator.next();
|
|
28870
|
-
if (character === NEW_LINE) {
|
|
28896
|
+
if (character === Character.NEW_LINE) {
|
|
28871
28897
|
result.newLine(lineHeight);
|
|
28872
28898
|
}
|
|
28873
28899
|
else {
|
|
@@ -28889,7 +28915,7 @@
|
|
|
28889
28915
|
DDynamicTextMeasure.measure2b = function (iterator, clippingWidth, lineHeight, atlas, result) {
|
|
28890
28916
|
while (iterator.hasNext()) {
|
|
28891
28917
|
var character = iterator.next();
|
|
28892
|
-
if (character === NEW_LINE) {
|
|
28918
|
+
if (character === Character.NEW_LINE) {
|
|
28893
28919
|
result.newLine(lineHeight);
|
|
28894
28920
|
}
|
|
28895
28921
|
else {
|
|
@@ -28910,7 +28936,7 @@
|
|
|
28910
28936
|
DDynamicTextMeasure.measure2 = function (iterator, clippingWidth, lineHeight, atlas, result) {
|
|
28911
28937
|
while (iterator.hasNext()) {
|
|
28912
28938
|
var character = iterator.next();
|
|
28913
|
-
if (character === NEW_LINE) {
|
|
28939
|
+
if (character === Character.NEW_LINE) {
|
|
28914
28940
|
result.newLine(lineHeight);
|
|
28915
28941
|
}
|
|
28916
28942
|
else {
|
|
@@ -28930,7 +28956,7 @@
|
|
|
28930
28956
|
DDynamicTextMeasure.measure3 = function (iterator, clippingWidth, clippingHeight, fontHeight, lineHeight, atlas, result) {
|
|
28931
28957
|
while (iterator.hasNext()) {
|
|
28932
28958
|
var character = iterator.next();
|
|
28933
|
-
if (character === NEW_LINE) {
|
|
28959
|
+
if (character === Character.NEW_LINE) {
|
|
28934
28960
|
if (result.isPushableAtNewLine(clippingHeight, lineHeight, fontHeight)) {
|
|
28935
28961
|
result.newLine(lineHeight);
|
|
28936
28962
|
}
|
|
@@ -28954,7 +28980,7 @@
|
|
|
28954
28980
|
DDynamicTextMeasure.measure4 = function (iterator, lineHeight, atlas, result) {
|
|
28955
28981
|
while (iterator.hasNext()) {
|
|
28956
28982
|
var character = iterator.next();
|
|
28957
|
-
if (character === NEW_LINE) {
|
|
28983
|
+
if (character === Character.NEW_LINE) {
|
|
28958
28984
|
result.newLine(lineHeight);
|
|
28959
28985
|
}
|
|
28960
28986
|
else {
|
|
@@ -28967,7 +28993,7 @@
|
|
|
28967
28993
|
};
|
|
28968
28994
|
DDynamicTextMeasure.measure5 = function (iterator, clippingWidth, lineHeight, atlas, result, close) {
|
|
28969
28995
|
result.clipped = true;
|
|
28970
|
-
var dots = atlas.get(
|
|
28996
|
+
var dots = atlas.get(Character.DOTS);
|
|
28971
28997
|
if (dots != null) {
|
|
28972
28998
|
while (!result.isPushable(clippingWidth, dots)) {
|
|
28973
28999
|
if (!result.pop()) {
|
|
@@ -28983,7 +29009,7 @@
|
|
|
28983
29009
|
}
|
|
28984
29010
|
else {
|
|
28985
29011
|
while (iterator.hasNext()) {
|
|
28986
|
-
if (iterator.next() === NEW_LINE) {
|
|
29012
|
+
if (iterator.next() === Character.NEW_LINE) {
|
|
28987
29013
|
result.newLine(lineHeight);
|
|
28988
29014
|
break;
|
|
28989
29015
|
}
|
|
@@ -29067,47 +29093,61 @@
|
|
|
29067
29093
|
var DDynamicTextGeometry = /** @class */ (function (_super) {
|
|
29068
29094
|
__extends(DDynamicTextGeometry, _super);
|
|
29069
29095
|
function DDynamicTextGeometry() {
|
|
29070
|
-
var
|
|
29096
|
+
var _a, _b, _c;
|
|
29097
|
+
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;
|
|
29071
29098
|
_this.width = 0;
|
|
29072
29099
|
_this.height = 0;
|
|
29073
29100
|
_this.scale = 1;
|
|
29074
29101
|
_this.scaled = false;
|
|
29075
29102
|
_this.clipped = false;
|
|
29103
|
+
_this.vertexBuffer = _this.getBuffer("aVertexPosition");
|
|
29104
|
+
_this.vertices = DDynamicTextGeometry.VERTICES;
|
|
29105
|
+
_this.uvBuffer = _this.getBuffer("aTextureCoord");
|
|
29106
|
+
_this.uvs = DDynamicTextGeometry.UVS;
|
|
29107
|
+
_this.indexBuffer = _this.getIndex();
|
|
29108
|
+
_this.indices = DDynamicTextGeometry.INDICES;
|
|
29109
|
+
_this.nchars = 0;
|
|
29076
29110
|
return _this;
|
|
29077
29111
|
}
|
|
29078
29112
|
DDynamicTextGeometry.prototype.update = function (text, atlas, modifier) {
|
|
29079
|
-
var vertexBuffer = this.getBuffer("aVertexPosition");
|
|
29080
|
-
var uvBuffer = this.getBuffer("aTextureCoord");
|
|
29081
|
-
var indexBuffer = this.getIndex();
|
|
29082
29113
|
var result = DDynamicTextMeasure.measure(text, atlas, modifier);
|
|
29083
|
-
var
|
|
29084
|
-
var
|
|
29085
|
-
if (
|
|
29086
|
-
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29114
|
+
var resultCount = result.count;
|
|
29115
|
+
var nchars = ((resultCount >> 3) + (resultCount & 0x7 ? 1 : 0)) << 3;
|
|
29116
|
+
if (this.nchars < nchars) {
|
|
29117
|
+
this.nchars = nchars;
|
|
29118
|
+
var nvertex = nchars << 3;
|
|
29119
|
+
this.vertices = new Float32Array(nvertex);
|
|
29120
|
+
this.uvs = new Float32Array(nvertex);
|
|
29121
|
+
this.vertexBuffer.data = this.vertices;
|
|
29122
|
+
this.uvBuffer.data = this.uvs;
|
|
29123
|
+
var nindex = (nchars << 2) + (nchars << 1);
|
|
29124
|
+
this.indices = new Uint16Array(nindex);
|
|
29125
|
+
this.indexBuffer.data = this.indices;
|
|
29126
|
+
this.initIndices(this.indices);
|
|
29127
|
+
this.indexBuffer.update();
|
|
29128
|
+
}
|
|
29129
|
+
else {
|
|
29130
|
+
nchars = this.nchars;
|
|
29131
|
+
}
|
|
29132
|
+
if (nchars <= 0) {
|
|
29133
|
+
return;
|
|
29134
|
+
}
|
|
29135
|
+
var vertices = this.vertices;
|
|
29136
|
+
var uvs = this.uvs;
|
|
29096
29137
|
if (atlas != null) {
|
|
29097
|
-
var count = result.count;
|
|
29098
29138
|
var characters = result.characters;
|
|
29099
29139
|
var scale = result.scale;
|
|
29100
|
-
|
|
29140
|
+
var fw = 1 / atlas.width;
|
|
29141
|
+
var fh = 1 / atlas.height;
|
|
29142
|
+
for (var i = 0; i < resultCount; ++i) {
|
|
29101
29143
|
var character = characters[i];
|
|
29102
29144
|
var cx = character.x;
|
|
29103
29145
|
var cy = character.y;
|
|
29104
29146
|
var cc = character.character;
|
|
29105
|
-
|
|
29106
|
-
var h = atlas.height;
|
|
29107
|
-
this.writeCharacter(vertices, uvs, indices, i, cx, cy, scale, cc, w, h);
|
|
29147
|
+
this.fill(vertices, uvs, i, cx, cy, scale, cc, fw, fh);
|
|
29108
29148
|
}
|
|
29109
|
-
for (var i =
|
|
29110
|
-
this.
|
|
29149
|
+
for (var i = resultCount; i < nchars; ++i) {
|
|
29150
|
+
this.fillBlank(vertices, uvs, i);
|
|
29111
29151
|
}
|
|
29112
29152
|
this.width = result.width * scale;
|
|
29113
29153
|
this.height = result.height * scale;
|
|
@@ -29116,8 +29156,8 @@
|
|
|
29116
29156
|
this.clipped = result.clipped;
|
|
29117
29157
|
}
|
|
29118
29158
|
else {
|
|
29119
|
-
for (var i = 0
|
|
29120
|
-
this.
|
|
29159
|
+
for (var i = 0; i < nchars; ++i) {
|
|
29160
|
+
this.fillBlank(vertices, uvs, i);
|
|
29121
29161
|
}
|
|
29122
29162
|
this.width = 0;
|
|
29123
29163
|
this.height = 0;
|
|
@@ -29125,11 +29165,10 @@
|
|
|
29125
29165
|
this.scaled = false;
|
|
29126
29166
|
this.clipped = false;
|
|
29127
29167
|
}
|
|
29128
|
-
vertexBuffer.update();
|
|
29129
|
-
uvBuffer.update();
|
|
29130
|
-
indexBuffer.update();
|
|
29168
|
+
this.vertexBuffer.update();
|
|
29169
|
+
this.uvBuffer.update();
|
|
29131
29170
|
};
|
|
29132
|
-
DDynamicTextGeometry.prototype.
|
|
29171
|
+
DDynamicTextGeometry.prototype.fill = function (vertices, uvs, index, x, y, scale, character, fw, fh) {
|
|
29133
29172
|
var cx = character.x;
|
|
29134
29173
|
var cy = character.y;
|
|
29135
29174
|
var cw = character.width;
|
|
@@ -29148,10 +29187,10 @@
|
|
|
29148
29187
|
vertices[iv + 5] = y1;
|
|
29149
29188
|
vertices[iv + 6] = x0;
|
|
29150
29189
|
vertices[iv + 7] = y1;
|
|
29151
|
-
var u0 = cx
|
|
29152
|
-
var v0 = cy
|
|
29153
|
-
var u1 = (cx + cw)
|
|
29154
|
-
var v1 = (cy + ch)
|
|
29190
|
+
var u0 = cx * fw;
|
|
29191
|
+
var v0 = cy * fh;
|
|
29192
|
+
var u1 = (cx + cw) * fw;
|
|
29193
|
+
var v1 = (cy + ch) * fh;
|
|
29155
29194
|
uvs[iv + 0] = u0;
|
|
29156
29195
|
uvs[iv + 1] = v0;
|
|
29157
29196
|
uvs[iv + 2] = u1;
|
|
@@ -29160,16 +29199,8 @@
|
|
|
29160
29199
|
uvs[iv + 5] = v1;
|
|
29161
29200
|
uvs[iv + 6] = u0;
|
|
29162
29201
|
uvs[iv + 7] = v1;
|
|
29163
|
-
|
|
29164
|
-
|
|
29165
|
-
indices[ii + 0] = vo + 0;
|
|
29166
|
-
indices[ii + 1] = vo + 1;
|
|
29167
|
-
indices[ii + 2] = vo + 3;
|
|
29168
|
-
indices[ii + 3] = vo + 1;
|
|
29169
|
-
indices[ii + 4] = vo + 2;
|
|
29170
|
-
indices[ii + 5] = vo + 3;
|
|
29171
|
-
};
|
|
29172
|
-
DDynamicTextGeometry.prototype.writeCharacterEmpty = function (vertices, uvs, indices, index) {
|
|
29202
|
+
};
|
|
29203
|
+
DDynamicTextGeometry.prototype.fillBlank = function (vertices, uvs, index) {
|
|
29173
29204
|
var iv = index << 3;
|
|
29174
29205
|
vertices[iv + 0] = 0;
|
|
29175
29206
|
vertices[iv + 1] = 0;
|
|
@@ -29187,14 +29218,16 @@
|
|
|
29187
29218
|
uvs[iv + 5] = 0;
|
|
29188
29219
|
uvs[iv + 6] = 0;
|
|
29189
29220
|
uvs[iv + 7] = 0;
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29221
|
+
};
|
|
29222
|
+
DDynamicTextGeometry.prototype.initIndices = function (indices) {
|
|
29223
|
+
for (var iv = 0, ivmax = this.nchars << 2, ii = 0; iv < ivmax; iv += 4, ii += 6) {
|
|
29224
|
+
indices[ii] = iv;
|
|
29225
|
+
indices[ii + 1] = iv + 1;
|
|
29226
|
+
indices[ii + 2] = iv + 3;
|
|
29227
|
+
indices[ii + 3] = iv + 1;
|
|
29228
|
+
indices[ii + 4] = iv + 2;
|
|
29229
|
+
indices[ii + 5] = iv + 3;
|
|
29230
|
+
}
|
|
29198
29231
|
};
|
|
29199
29232
|
return DDynamicTextGeometry;
|
|
29200
29233
|
}(pixi_js.MeshGeometry));
|
|
@@ -48249,26 +48282,26 @@
|
|
|
48249
48282
|
var padding = this.toPadding(fontSize);
|
|
48250
48283
|
this._padding = padding;
|
|
48251
48284
|
this._font = new DynamicFontAtlasFont(fontId, fontSize, fontColor, padding);
|
|
48252
|
-
this._characters = {};
|
|
48253
|
-
this._length = 0;
|
|
48254
48285
|
this._unrefCount = 0;
|
|
48255
48286
|
this._width = 1;
|
|
48256
48287
|
this._height = 1;
|
|
48257
|
-
this._revision = 0;
|
|
48258
48288
|
this._revisionUpdated = 0;
|
|
48259
48289
|
this._texture = pixi_js.Texture.from(this._canvas, {
|
|
48260
48290
|
mipmap: pixi_js.MIPMAP_MODES.OFF,
|
|
48261
48291
|
resolution: resolution,
|
|
48262
48292
|
scaleMode: pixi_js.SCALE_MODES.NEAREST
|
|
48263
48293
|
});
|
|
48264
|
-
var characters =
|
|
48265
|
-
|
|
48266
|
-
|
|
48267
|
-
|
|
48268
|
-
for (var i = 0, imax =
|
|
48269
|
-
var
|
|
48270
|
-
|
|
48271
|
-
}
|
|
48294
|
+
var characters = new Map();
|
|
48295
|
+
characters.set(Character.SPACE, this.newChar(Character.SPACE, DynamicFontAtlasCharacterType.SPACE_R));
|
|
48296
|
+
characters.set(Character.TAB, this.newChar(Character.SOFT_TAB, DynamicFontAtlasCharacterType.SPACE_R));
|
|
48297
|
+
characters.set(Character.DOTS, this.newChar(Character.DOTS, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
48298
|
+
for (var i = 0, imax = Character.ASCII.length; i < imax; ++i) {
|
|
48299
|
+
var ac = Character.ASCII[i];
|
|
48300
|
+
characters.set(ac, this.newChar(ac, DynamicFontAtlasCharacterType.LETTER_RNB));
|
|
48301
|
+
}
|
|
48302
|
+
this._characters = characters;
|
|
48303
|
+
this._createds = new Map();
|
|
48304
|
+
this._revision = 1;
|
|
48272
48305
|
}
|
|
48273
48306
|
DynamicFontAtlas.prototype.toPadding = function (fontSize) {
|
|
48274
48307
|
return Math.max(3, Math.ceil(fontSize * 0.2));
|
|
@@ -48322,86 +48355,106 @@
|
|
|
48322
48355
|
enumerable: false,
|
|
48323
48356
|
configurable: true
|
|
48324
48357
|
});
|
|
48325
|
-
DynamicFontAtlas.prototype.
|
|
48326
|
-
|
|
48327
|
-
|
|
48328
|
-
|
|
48329
|
-
|
|
48330
|
-
|
|
48358
|
+
DynamicFontAtlas.prototype.newChar = function (character, type) {
|
|
48359
|
+
var advance = this.getAdvance(character);
|
|
48360
|
+
var padding = this._padding;
|
|
48361
|
+
var width = Math.ceil(padding + advance + padding);
|
|
48362
|
+
var height = this.font.height;
|
|
48363
|
+
return new DynamicFontAtlasCharacter(type, character, -width, // Setting X and Y to zeros leads to render the character at the UV coordinate (0, 0).
|
|
48364
|
+
-height, width, height, advance);
|
|
48365
|
+
};
|
|
48366
|
+
DynamicFontAtlas.prototype.add = function (characters, type) {
|
|
48367
|
+
var cs = this._characters;
|
|
48368
|
+
var cds = this._createds;
|
|
48369
|
+
for (var i = 0, imax = characters.length; i < imax;) {
|
|
48370
|
+
if (characters.charCodeAt(i) <= 0xff) {
|
|
48371
|
+
// Ignore ASCII characters
|
|
48372
|
+
i += 1;
|
|
48373
|
+
continue;
|
|
48374
|
+
}
|
|
48375
|
+
var j = i + 1;
|
|
48376
|
+
for (; j < imax; ++j) {
|
|
48377
|
+
var cc = characters.charCodeAt(j);
|
|
48378
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
48379
|
+
// Low surrogate
|
|
48380
|
+
// Variation selector
|
|
48381
|
+
continue;
|
|
48382
|
+
}
|
|
48383
|
+
break;
|
|
48384
|
+
}
|
|
48385
|
+
// Increment the reference count or create a new one
|
|
48386
|
+
var nac = characters.substring(i, j);
|
|
48387
|
+
var c = cs.get(nac);
|
|
48388
|
+
if (c != null) {
|
|
48389
|
+
if (!(c.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
48390
|
+
if (c.ref === 0) {
|
|
48331
48391
|
this._unrefCount -= 1;
|
|
48332
48392
|
}
|
|
48333
|
-
|
|
48393
|
+
c.ref += 1;
|
|
48334
48394
|
}
|
|
48335
48395
|
}
|
|
48336
48396
|
else {
|
|
48337
|
-
var
|
|
48338
|
-
|
|
48339
|
-
|
|
48340
|
-
|
|
48341
|
-
|
|
48342
|
-
|
|
48343
|
-
|
|
48397
|
+
var cd = cds.get(nac);
|
|
48398
|
+
if (cd != null) {
|
|
48399
|
+
cd.ref = 1;
|
|
48400
|
+
cs.set(nac, cd);
|
|
48401
|
+
}
|
|
48402
|
+
else {
|
|
48403
|
+
var newCharacter = this.newChar(nac, type);
|
|
48404
|
+
cs.set(nac, newCharacter);
|
|
48405
|
+
cds.set(nac, newCharacter);
|
|
48406
|
+
}
|
|
48344
48407
|
this._revision += 1;
|
|
48345
48408
|
}
|
|
48409
|
+
// Go to the next
|
|
48410
|
+
i = j;
|
|
48346
48411
|
}
|
|
48347
48412
|
};
|
|
48348
|
-
DynamicFontAtlas.prototype.
|
|
48349
|
-
|
|
48350
|
-
|
|
48351
|
-
|
|
48352
|
-
|
|
48353
|
-
|
|
48354
|
-
|
|
48355
|
-
|
|
48356
|
-
|
|
48357
|
-
|
|
48358
|
-
|
|
48359
|
-
|
|
48360
|
-
|
|
48361
|
-
|
|
48362
|
-
|
|
48363
|
-
|
|
48364
|
-
|
|
48365
|
-
|
|
48366
|
-
|
|
48367
|
-
|
|
48368
|
-
|
|
48413
|
+
DynamicFontAtlas.prototype.remove = function (characters) {
|
|
48414
|
+
var cs = this._characters;
|
|
48415
|
+
for (var i = 0, imax = characters.length; i < imax;) {
|
|
48416
|
+
if (characters.charCodeAt(i) <= 0xff) {
|
|
48417
|
+
// Ignore ASCII characters
|
|
48418
|
+
i += 1;
|
|
48419
|
+
continue;
|
|
48420
|
+
}
|
|
48421
|
+
var j = i + 1;
|
|
48422
|
+
for (; j < imax; ++j) {
|
|
48423
|
+
var cc = characters.charCodeAt(j);
|
|
48424
|
+
if ((0xdc00 <= cc && cc <= 0xdfff) || (0xfe00 <= cc && cc <= 0xfe0f)) {
|
|
48425
|
+
// Low surrogate
|
|
48426
|
+
// Variation selector
|
|
48427
|
+
continue;
|
|
48428
|
+
}
|
|
48429
|
+
break;
|
|
48430
|
+
}
|
|
48431
|
+
// Decrement the reference count
|
|
48432
|
+
var nac = characters.substring(i, j);
|
|
48433
|
+
var c = cs.get(nac);
|
|
48434
|
+
if (c != null && 0 < c.ref && !(c.type & DynamicFontAtlasCharacterType.RESERVED)) {
|
|
48435
|
+
c.ref -= 1;
|
|
48436
|
+
if (c.ref === 0) {
|
|
48369
48437
|
this._unrefCount += 1;
|
|
48370
48438
|
}
|
|
48371
48439
|
}
|
|
48440
|
+
// Go to the next
|
|
48441
|
+
i = j;
|
|
48372
48442
|
}
|
|
48373
48443
|
};
|
|
48374
|
-
DynamicFontAtlas.prototype.
|
|
48375
|
-
|
|
48376
|
-
|
|
48377
|
-
|
|
48378
|
-
if (
|
|
48379
|
-
delete
|
|
48444
|
+
DynamicFontAtlas.prototype.cleanup = function () {
|
|
48445
|
+
var characters = this._characters;
|
|
48446
|
+
if (characters.size >> 1 <= this._unrefCount) {
|
|
48447
|
+
characters.forEach(function (char, id) {
|
|
48448
|
+
if (char.ref <= 0) {
|
|
48449
|
+
characters.delete(id);
|
|
48380
48450
|
}
|
|
48381
|
-
}
|
|
48382
|
-
this._length -= this._unrefCount;
|
|
48451
|
+
});
|
|
48383
48452
|
this._revision += 1;
|
|
48384
48453
|
this._unrefCount = 0;
|
|
48385
48454
|
}
|
|
48386
48455
|
};
|
|
48387
|
-
DynamicFontAtlas.prototype.add = function (targets, type) {
|
|
48388
|
-
if (type === void 0) { type = DynamicFontAtlasCharacterType.LETTER; }
|
|
48389
|
-
var characters = this._characters;
|
|
48390
|
-
var iterator = UtilCharacterIterator.from(targets);
|
|
48391
|
-
while (iterator.hasNext()) {
|
|
48392
|
-
var character = iterator.next();
|
|
48393
|
-
this.add_(character, character, characters, type);
|
|
48394
|
-
}
|
|
48395
|
-
};
|
|
48396
|
-
DynamicFontAtlas.prototype.remove = function (targets) {
|
|
48397
|
-
var characters = this._characters;
|
|
48398
|
-
var iterator = UtilCharacterIterator.from(targets);
|
|
48399
|
-
while (iterator.hasNext()) {
|
|
48400
|
-
this.remove_(iterator.next(), characters);
|
|
48401
|
-
}
|
|
48402
|
-
};
|
|
48403
48456
|
DynamicFontAtlas.prototype.get = function (id) {
|
|
48404
|
-
return this._characters
|
|
48457
|
+
return this._characters.get(id);
|
|
48405
48458
|
};
|
|
48406
48459
|
DynamicFontAtlas.prototype.getAdvance = function (target) {
|
|
48407
48460
|
var context = this.getContext();
|
|
@@ -48440,52 +48493,50 @@
|
|
|
48440
48493
|
return context;
|
|
48441
48494
|
};
|
|
48442
48495
|
DynamicFontAtlas.prototype.update = function () {
|
|
48443
|
-
this.
|
|
48496
|
+
this.cleanup();
|
|
48444
48497
|
if (this._revisionUpdated < this._revision) {
|
|
48445
48498
|
this._revisionUpdated = this._revision;
|
|
48446
48499
|
var canvas = this._canvas;
|
|
48447
48500
|
if (canvas != null) {
|
|
48448
48501
|
var font = this._font;
|
|
48449
|
-
var
|
|
48502
|
+
var fontHeight_1 = font.height;
|
|
48450
48503
|
var characters = this._characters;
|
|
48451
|
-
var
|
|
48452
|
-
var
|
|
48453
|
-
var
|
|
48454
|
-
var
|
|
48455
|
-
|
|
48456
|
-
|
|
48457
|
-
|
|
48458
|
-
|
|
48459
|
-
y += fontHeight;
|
|
48504
|
+
var width_1 = (this._width = this.toPowerOf2(Math.ceil(Math.sqrt(characters.size)) * fontHeight_1));
|
|
48505
|
+
var offsetX_1 = this._padding;
|
|
48506
|
+
var x_1 = 0;
|
|
48507
|
+
var y_1 = 0;
|
|
48508
|
+
characters.forEach(function (character) {
|
|
48509
|
+
if (width_1 <= x_1 + character.width) {
|
|
48510
|
+
x_1 = 0;
|
|
48511
|
+
y_1 += fontHeight_1;
|
|
48460
48512
|
}
|
|
48461
|
-
character.x =
|
|
48462
|
-
character.y =
|
|
48463
|
-
character.origin.x =
|
|
48464
|
-
|
|
48465
|
-
}
|
|
48466
|
-
var height = (this._height =
|
|
48513
|
+
character.x = x_1;
|
|
48514
|
+
character.y = y_1;
|
|
48515
|
+
character.origin.x = x_1 + offsetX_1;
|
|
48516
|
+
x_1 += character.width;
|
|
48517
|
+
});
|
|
48518
|
+
var height = (this._height = y_1 + fontHeight_1);
|
|
48467
48519
|
// Make an input canvas
|
|
48468
48520
|
// Here, we need to reset the context because
|
|
48469
48521
|
// context settings will be lost when we set the width/height.
|
|
48470
48522
|
var baseTexture = this._texture.baseTexture;
|
|
48471
48523
|
var resolution = baseTexture.resolution;
|
|
48472
|
-
var realWidth = Math.ceil(
|
|
48524
|
+
var realWidth = Math.ceil(width_1 * resolution);
|
|
48473
48525
|
var realHeight = Math.ceil(height * resolution);
|
|
48474
48526
|
canvas.width = realWidth;
|
|
48475
48527
|
canvas.height = realHeight;
|
|
48476
|
-
var
|
|
48477
|
-
if (
|
|
48478
|
-
UtilFont.measure(
|
|
48479
|
-
var
|
|
48480
|
-
|
|
48481
|
-
|
|
48482
|
-
|
|
48483
|
-
|
|
48484
|
-
|
|
48485
|
-
character.origin.
|
|
48486
|
-
|
|
48487
|
-
|
|
48488
|
-
context.restore();
|
|
48528
|
+
var context_1 = this.getContext();
|
|
48529
|
+
if (context_1 != null) {
|
|
48530
|
+
UtilFont.measure(context_1, font);
|
|
48531
|
+
var offsetY_1 = Math.round((fontHeight_1 - (font.ascent + font.descent)) * 0.5 + font.ascent);
|
|
48532
|
+
context_1.save();
|
|
48533
|
+
context_1.scale(resolution, resolution);
|
|
48534
|
+
context_1.clearRect(0, 0, width_1, height);
|
|
48535
|
+
characters.forEach(function (character) {
|
|
48536
|
+
character.origin.y = character.y + offsetY_1;
|
|
48537
|
+
context_1.fillText(character.character, character.origin.x, character.origin.y);
|
|
48538
|
+
});
|
|
48539
|
+
context_1.restore();
|
|
48489
48540
|
}
|
|
48490
48541
|
baseTexture.setRealSize(realWidth, realHeight);
|
|
48491
48542
|
return true;
|
|
@@ -48501,7 +48552,7 @@
|
|
|
48501
48552
|
};
|
|
48502
48553
|
Object.defineProperty(DynamicFontAtlas.prototype, "length", {
|
|
48503
48554
|
get: function () {
|
|
48504
|
-
return this.
|
|
48555
|
+
return this._characters.size;
|
|
48505
48556
|
},
|
|
48506
48557
|
enumerable: false,
|
|
48507
48558
|
configurable: true
|
|
@@ -48511,10 +48562,9 @@
|
|
|
48511
48562
|
if (canvas != null) {
|
|
48512
48563
|
this._canvas = null;
|
|
48513
48564
|
}
|
|
48514
|
-
|
|
48515
|
-
|
|
48516
|
-
|
|
48517
|
-
}
|
|
48565
|
+
this._characters.clear();
|
|
48566
|
+
this._createds.clear();
|
|
48567
|
+
this._unrefCount = 0;
|
|
48518
48568
|
};
|
|
48519
48569
|
DynamicFontAtlas.prototype.toPowerOf2 = function (size) {
|
|
48520
48570
|
var result = 32;
|
|
@@ -48563,7 +48613,7 @@
|
|
|
48563
48613
|
atlas = new DynamicFontAtlas(fontId, fontSize, fontColor, this._resolution);
|
|
48564
48614
|
colorToAtlas.set(fontColor, atlas);
|
|
48565
48615
|
}
|
|
48566
|
-
atlas.add(targets);
|
|
48616
|
+
atlas.add(targets, DynamicFontAtlasCharacterType.LETTER);
|
|
48567
48617
|
};
|
|
48568
48618
|
DynamicFontAtlases.prototype.remove = function (fontId, fontColor, targets) {
|
|
48569
48619
|
var colorToAtlas = this._atlases.get(fontId);
|
|
@@ -56495,22 +56545,7 @@
|
|
|
56495
56545
|
});
|
|
56496
56546
|
};
|
|
56497
56547
|
DPane.prototype.onScrollBarUpdate = function (isRegionVisible) {
|
|
56498
|
-
|
|
56499
|
-
if (overflowMask != null) {
|
|
56500
|
-
var content = this.content;
|
|
56501
|
-
if (isRegionVisible) {
|
|
56502
|
-
if (content.mask !== overflowMask) {
|
|
56503
|
-
content.mask = overflowMask;
|
|
56504
|
-
DApplications.update(this);
|
|
56505
|
-
}
|
|
56506
|
-
}
|
|
56507
|
-
else {
|
|
56508
|
-
if (content.mask) {
|
|
56509
|
-
content.mask = null;
|
|
56510
|
-
DApplications.update(this);
|
|
56511
|
-
}
|
|
56512
|
-
}
|
|
56513
|
-
}
|
|
56548
|
+
// DO NOTHING
|
|
56514
56549
|
};
|
|
56515
56550
|
DPane.prototype.initScrollBar = function (scrollbar) {
|
|
56516
56551
|
var _this = this;
|
|
@@ -56583,14 +56618,18 @@
|
|
|
56583
56618
|
};
|
|
56584
56619
|
DPane.prototype.getOverflowMask = function () {
|
|
56585
56620
|
var result = this._overflowMask;
|
|
56586
|
-
if (result
|
|
56587
|
-
result =
|
|
56621
|
+
if (result === undefined) {
|
|
56622
|
+
result = this.newOverflowMask();
|
|
56588
56623
|
this._overflowMask = result;
|
|
56589
|
-
this.reflowable.add(result);
|
|
56590
|
-
this.toDirty();
|
|
56591
56624
|
}
|
|
56592
56625
|
return result;
|
|
56593
56626
|
};
|
|
56627
|
+
DPane.prototype.newOverflowMask = function () {
|
|
56628
|
+
var result = new DBaseOverflowMask(this);
|
|
56629
|
+
this.reflowable.add(result);
|
|
56630
|
+
this.toDirty();
|
|
56631
|
+
return result;
|
|
56632
|
+
};
|
|
56594
56633
|
DPane.prototype.onWheel = function (e, deltas, global) {
|
|
56595
56634
|
var content = this.content;
|
|
56596
56635
|
var x = this.getWheelContentX(content, deltas.deltaX * deltas.lowest);
|
|
@@ -59337,11 +59376,17 @@
|
|
|
59337
59376
|
|
|
59338
59377
|
var DChartAxisGuideSimple = /** @class */ (function () {
|
|
59339
59378
|
function DChartAxisGuideSimple(options) {
|
|
59340
|
-
var _a;
|
|
59379
|
+
var _a, _b;
|
|
59341
59380
|
this._options = options;
|
|
59342
59381
|
this._index = 0;
|
|
59343
|
-
|
|
59344
|
-
|
|
59382
|
+
if (options != null) {
|
|
59383
|
+
this._position = (_a = options.position) !== null && _a !== void 0 ? _a : 0;
|
|
59384
|
+
this._fixed = (_b = options.fixed) !== null && _b !== void 0 ? _b : false;
|
|
59385
|
+
}
|
|
59386
|
+
else {
|
|
59387
|
+
this._position = 0;
|
|
59388
|
+
this._fixed = false;
|
|
59389
|
+
}
|
|
59345
59390
|
this._isShown = true;
|
|
59346
59391
|
}
|
|
59347
59392
|
Object.defineProperty(DChartAxisGuideSimple.prototype, "shape", {
|
|
@@ -59410,42 +59455,63 @@
|
|
|
59410
59455
|
var plotAreaY = plotAreaBounds.y;
|
|
59411
59456
|
var plotAreaWidth = plotAreaBounds.width;
|
|
59412
59457
|
var plotAreaHeight = plotAreaBounds.height;
|
|
59413
|
-
var transform = plotArea.container.transform.localTransform;
|
|
59414
59458
|
var offset = axis.padding * index;
|
|
59415
59459
|
switch (axis.position) {
|
|
59416
59460
|
case DChartAxisPosition.TOP:
|
|
59417
59461
|
case DChartAxisPosition.BOTTOM:
|
|
59418
|
-
var
|
|
59419
|
-
|
|
59420
|
-
var work = this._work;
|
|
59421
|
-
work.set(coordinateX.transform.map(coordinateX.map(this._position)), 0);
|
|
59422
|
-
transform.apply(work, work);
|
|
59423
|
-
var x = work.x;
|
|
59424
|
-
shape.update(axis.position, x, plotAreaY + plotAreaHeight * 0.5, this._isShown && plotAreaX <= x && x <= plotAreaX + plotAreaWidth, plotAreaWidth, plotAreaHeight, offset);
|
|
59425
|
-
}
|
|
59426
|
-
else {
|
|
59427
|
-
shape.update(axis.position, plotAreaX, plotAreaY + plotAreaHeight * 0.5, false, plotAreaWidth, plotAreaHeight, offset);
|
|
59428
|
-
}
|
|
59462
|
+
var x = this.getPositionX(axis, plotArea, plotAreaX);
|
|
59463
|
+
shape.update(axis.position, x, plotAreaY + plotAreaHeight * 0.5, this._isShown && plotAreaX <= x && x <= plotAreaX + plotAreaWidth, plotAreaWidth, plotAreaHeight, offset);
|
|
59429
59464
|
break;
|
|
59430
59465
|
case DChartAxisPosition.LEFT:
|
|
59431
59466
|
case DChartAxisPosition.RIGHT:
|
|
59432
|
-
var
|
|
59433
|
-
|
|
59434
|
-
var work = this._work;
|
|
59435
|
-
work.set(0, coordinateY.transform.map(coordinateY.map(this._position)));
|
|
59436
|
-
transform.apply(work, work);
|
|
59437
|
-
var y = work.y;
|
|
59438
|
-
shape.update(axis.position, plotAreaX + plotAreaWidth * 0.5, y, this._isShown && plotAreaY <= y && y <= plotAreaY + plotAreaHeight, plotAreaWidth, plotAreaHeight, offset);
|
|
59439
|
-
}
|
|
59440
|
-
else {
|
|
59441
|
-
shape.update(axis.position, plotAreaX + plotAreaWidth * 0.5, plotAreaY, false, plotAreaWidth, plotAreaHeight, offset);
|
|
59442
|
-
}
|
|
59467
|
+
var y = this.getPositionY(axis, plotArea, plotAreaY);
|
|
59468
|
+
shape.update(axis.position, plotAreaX + plotAreaWidth * 0.5, y, this._isShown && plotAreaY <= y && y <= plotAreaY + plotAreaHeight, plotAreaWidth, plotAreaHeight, offset);
|
|
59443
59469
|
break;
|
|
59444
59470
|
}
|
|
59445
59471
|
return true;
|
|
59446
59472
|
}
|
|
59447
59473
|
return false;
|
|
59448
59474
|
};
|
|
59475
|
+
DChartAxisGuideSimple.prototype.getPositionX = function (axis, plotArea, plotAreaX) {
|
|
59476
|
+
var _a, _b;
|
|
59477
|
+
if (this._fixed) {
|
|
59478
|
+
var work = ((_a = DChartAxisGuideSimple.WORK_REGION) !== null && _a !== void 0 ? _a : (DChartAxisGuideSimple.WORK_REGION = new DChartRegionImpl(0, 0)));
|
|
59479
|
+
plotArea.getPixelDomain(work);
|
|
59480
|
+
return work.from + this._position * (work.to - work.from);
|
|
59481
|
+
}
|
|
59482
|
+
else {
|
|
59483
|
+
var coordinateX = plotArea.coordinate.x.get(axis.coordinate);
|
|
59484
|
+
if (coordinateX) {
|
|
59485
|
+
var work = ((_b = DChartAxisGuideSimple.WORK_POINT) !== null && _b !== void 0 ? _b : (DChartAxisGuideSimple.WORK_POINT = new pixi_js.Point()));
|
|
59486
|
+
work.set(coordinateX.transform.map(coordinateX.map(this._position)), 0);
|
|
59487
|
+
plotArea.container.transform.localTransform.apply(work, work);
|
|
59488
|
+
return work.x;
|
|
59489
|
+
}
|
|
59490
|
+
else {
|
|
59491
|
+
return plotAreaX - 100;
|
|
59492
|
+
}
|
|
59493
|
+
}
|
|
59494
|
+
};
|
|
59495
|
+
DChartAxisGuideSimple.prototype.getPositionY = function (axis, plotArea, plotAreaY) {
|
|
59496
|
+
var _a, _b;
|
|
59497
|
+
if (this._fixed) {
|
|
59498
|
+
var work = ((_a = DChartAxisGuideSimple.WORK_REGION) !== null && _a !== void 0 ? _a : (DChartAxisGuideSimple.WORK_REGION = new DChartRegionImpl(0, 0)));
|
|
59499
|
+
plotArea.getPixelRange(work);
|
|
59500
|
+
return work.to + (1 - this._position) * (work.from - work.to);
|
|
59501
|
+
}
|
|
59502
|
+
else {
|
|
59503
|
+
var coordinateY = plotArea.coordinate.y.get(axis.coordinate);
|
|
59504
|
+
if (coordinateY) {
|
|
59505
|
+
var work = ((_b = DChartAxisGuideSimple.WORK_POINT) !== null && _b !== void 0 ? _b : (DChartAxisGuideSimple.WORK_POINT = new pixi_js.Point()));
|
|
59506
|
+
work.set(0, coordinateY.transform.map(coordinateY.map(this._position)));
|
|
59507
|
+
plotArea.container.transform.localTransform.apply(work, work);
|
|
59508
|
+
return work.y;
|
|
59509
|
+
}
|
|
59510
|
+
else {
|
|
59511
|
+
return plotAreaY - 100;
|
|
59512
|
+
}
|
|
59513
|
+
}
|
|
59514
|
+
};
|
|
59449
59515
|
DChartAxisGuideSimple.prototype.destroy = function () {
|
|
59450
59516
|
var shape = this._shape;
|
|
59451
59517
|
if (shape != null) {
|
|
@@ -80110,6 +80176,7 @@
|
|
|
80110
80176
|
FormatNodey: FormatNodey,
|
|
80111
80177
|
FormatNodez: FormatNodez,
|
|
80112
80178
|
FormatNodes: FormatNodes,
|
|
80179
|
+
Character: Character,
|
|
80113
80180
|
DynamicAtlasItemEmpty: DynamicAtlasItemEmpty,
|
|
80114
80181
|
DynamicAtlasItemFontAtlas: DynamicAtlasItemFontAtlas,
|
|
80115
80182
|
DynamicAtlasItemImage: DynamicAtlasItemImage,
|