@wcardinal/wcardinal-ui 0.417.0 → 0.418.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.
Files changed (42) hide show
  1. package/dist/types/wcardinal/ui/util/dynamic-font-atlas-font.d.ts +1 -0
  2. package/dist/types/wcardinal/ui/util/dynamic-sdf-font-atlas-font.d.ts +12 -0
  3. package/dist/types/wcardinal/ui/util/dynamic-sdf-font-atlas.d.ts +2 -9
  4. package/dist/types/wcardinal/ui/util/index.d.ts +1 -0
  5. package/dist/types/wcardinal/ui/util/util-font.d.ts +7 -2
  6. package/dist/wcardinal/ui/theme/dark/d-theme-dark-font.js +1 -1
  7. package/dist/wcardinal/ui/theme/dark/d-theme-dark-font.js.map +1 -1
  8. package/dist/wcardinal/ui/theme/white/d-theme-white-font.js +1 -1
  9. package/dist/wcardinal/ui/theme/white/d-theme-white-font.js.map +1 -1
  10. package/dist/wcardinal/ui/util/dynamic-font-atlas-font.js +3 -4
  11. package/dist/wcardinal/ui/util/dynamic-font-atlas-font.js.map +1 -1
  12. package/dist/wcardinal/ui/util/dynamic-font-atlas.js +5 -3
  13. package/dist/wcardinal/ui/util/dynamic-font-atlas.js.map +1 -1
  14. package/dist/wcardinal/ui/util/dynamic-sdf-font-atlas-font.js +30 -0
  15. package/dist/wcardinal/ui/util/dynamic-sdf-font-atlas-font.js.map +1 -0
  16. package/dist/wcardinal/ui/util/dynamic-sdf-font-atlas.js +13 -27
  17. package/dist/wcardinal/ui/util/dynamic-sdf-font-atlas.js.map +1 -1
  18. package/dist/wcardinal/ui/util/index.js +1 -0
  19. package/dist/wcardinal/ui/util/index.js.map +1 -1
  20. package/dist/wcardinal/ui/util/util-font.js +14 -21
  21. package/dist/wcardinal/ui/util/util-font.js.map +1 -1
  22. package/dist/wcardinal-ui-theme-dark-en-us.js +2 -2
  23. package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
  24. package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
  25. package/dist/wcardinal-ui-theme-dark-ja-jp.js +2 -2
  26. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
  27. package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
  28. package/dist/wcardinal-ui-theme-dark.js +2 -2
  29. package/dist/wcardinal-ui-theme-dark.min.js +2 -2
  30. package/dist/wcardinal-ui-theme-white-en-us.js +2 -2
  31. package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
  32. package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
  33. package/dist/wcardinal-ui-theme-white-ja-jp.js +2 -2
  34. package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
  35. package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
  36. package/dist/wcardinal-ui-theme-white.js +2 -2
  37. package/dist/wcardinal-ui-theme-white.min.js +2 -2
  38. package/dist/wcardinal-ui.cjs.js +113 -106
  39. package/dist/wcardinal-ui.js +111 -104
  40. package/dist/wcardinal-ui.min.js +2 -2
  41. package/dist/wcardinal-ui.min.js.map +1 -1
  42. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.417.0
2
+ Winter Cardinal UI v0.418.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -21224,6 +21224,34 @@ var DynamicFontAtlasCharacterType = {
21224
21224
  LETTER_RNB: LETTER_RNB
21225
21225
  };
21226
21226
 
21227
+ /*
21228
+ * Copyright (C) 2019 Toshiba Corporation
21229
+ * SPDX-License-Identifier: Apache-2.0
21230
+ */
21231
+ var DynamicSDFFontAtlasFont = /** @class */ (function () {
21232
+ function DynamicSDFFontAtlasFont(fontFamily) {
21233
+ this.id = DynamicSDFFontAtlasFont.toFontFamily(fontFamily);
21234
+ this.size = 32;
21235
+ this.italic = false;
21236
+ this.measured = false;
21237
+ this.ascent = 0;
21238
+ this.descent = 0;
21239
+ }
21240
+ DynamicSDFFontAtlasFont.toFontFamily = function (fontFamily) {
21241
+ return fontFamily === "auto" ? DynamicSDFFontAtlasFont.getAutoFontFamily() : fontFamily;
21242
+ };
21243
+ DynamicSDFFontAtlasFont.getAutoFontFamily = function () {
21244
+ if (DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO == null) {
21245
+ DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO = DThemes.getInstance()
21246
+ .get("DBase")
21247
+ .getFontFamilly();
21248
+ }
21249
+ return DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO;
21250
+ };
21251
+ DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO = null;
21252
+ return DynamicSDFFontAtlasFont;
21253
+ }());
21254
+
21227
21255
  /*
21228
21256
  * Copyright (C) 2019 Toshiba Corporation
21229
21257
  * SPDX-License-Identifier: Apache-2.0
@@ -21512,6 +21540,69 @@ var DynamicSDFFontGenerator = /** @class */ (function () {
21512
21540
  return DynamicSDFFontGenerator;
21513
21541
  }());
21514
21542
 
21543
+ /*
21544
+ * Copyright (C) 2019 Toshiba Corporation
21545
+ * SPDX-License-Identifier: Apache-2.0
21546
+ */
21547
+ var UtilFont = /** @class */ (function () {
21548
+ function UtilFont() {
21549
+ }
21550
+ UtilFont.measure = function (context, font) {
21551
+ if (!font.measured) {
21552
+ if ("fontBoundingBoxAscent" in window.TextMetrics.prototype) {
21553
+ var metrics = context.measureText(pixi_js.TextMetrics.METRICS_STRING);
21554
+ font.ascent = metrics.fontBoundingBoxAscent;
21555
+ font.descent = metrics.fontBoundingBoxDescent;
21556
+ }
21557
+ else {
21558
+ var measured = pixi_js.TextMetrics.measureFont(font.id);
21559
+ font.ascent = measured.ascent;
21560
+ font.descent = measured.descent;
21561
+ }
21562
+ font.measured = true;
21563
+ }
21564
+ };
21565
+ UtilFont.toSize = function (font) {
21566
+ this.setup(font);
21567
+ return parseFloat(window.getComputedStyle(this._span).fontSize);
21568
+ };
21569
+ UtilFont.setup = function (font) {
21570
+ var span = this._span;
21571
+ if (span == null) {
21572
+ span = document.createElement("span");
21573
+ span.innerText = "|ÉqÅ";
21574
+ span.style.border = "none";
21575
+ span.style.margin = "0px";
21576
+ this._span = span;
21577
+ }
21578
+ var block = this._block;
21579
+ if (block == null) {
21580
+ block = document.createElement("div");
21581
+ block.style.display = "inline-block";
21582
+ block.style.width = "0px";
21583
+ block.style.height = "0px";
21584
+ block.style.border = "none";
21585
+ block.style.margin = "0px";
21586
+ block.style.verticalAlign = "baseline";
21587
+ this._block = block;
21588
+ }
21589
+ var div = this._div;
21590
+ if (div == null) {
21591
+ div = document.createElement("div");
21592
+ div.style.position = "absolute";
21593
+ div.style.padding = "0px";
21594
+ div.style.margin = "0px";
21595
+ div.style.visibility = "hidden";
21596
+ div.appendChild(span);
21597
+ div.appendChild(block);
21598
+ document.body.appendChild(div);
21599
+ this._div = div;
21600
+ }
21601
+ span.style.font = font;
21602
+ };
21603
+ return UtilFont;
21604
+ }());
21605
+
21515
21606
  /*
21516
21607
  * Copyright (C) 2019 Toshiba Corporation
21517
21608
  * SPDX-License-Identifier: Apache-2.0
@@ -21521,11 +21612,7 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
21521
21612
  this._id = "font-atlas:".concat(fontFamily);
21522
21613
  this._generator = DynamicSDFFontGenerator.getInstance().init();
21523
21614
  this._canvas = document.createElement("canvas");
21524
- this._font = {
21525
- family: DynamicSDFFontAtlas.toFontFamily(fontFamily),
21526
- size: 32,
21527
- italic: false
21528
- };
21615
+ this._font = new DynamicSDFFontAtlasFont(fontFamily);
21529
21616
  this._characters = {};
21530
21617
  this._length = 0;
21531
21618
  this._width = 1;
@@ -21544,7 +21631,7 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
21544
21631
  return this._font;
21545
21632
  },
21546
21633
  set: function (font) {
21547
- this._font.family = font.family;
21634
+ this._font.id = font.id;
21548
21635
  this._font.size = font.size;
21549
21636
  this._font.italic = font.italic;
21550
21637
  },
@@ -21669,19 +21756,20 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
21669
21756
  var font = this._font;
21670
21757
  var characters = this._characters;
21671
21758
  var characterSize = font.size + 14;
21672
- var width = DynamicSDFFontAtlas.toPowerOf2(Math.ceil(Math.sqrt(this._length)) * characterSize);
21759
+ var width = this.toPowerOf2(Math.ceil(Math.sqrt(this._length)) * characterSize);
21673
21760
  this._width = width;
21674
- var fontStyle = (font.italic ? "italic " : "") + (font.size + "px ") + font.family;
21761
+ var fontStyle = (font.italic ? "italic " : "") + (font.size + "px ") + font.id;
21675
21762
  context.font = fontStyle;
21676
21763
  context.textAlign = "left";
21677
- context.textBaseline = "middle";
21764
+ context.textBaseline = "alphabetic";
21678
21765
  context.lineWidth = 0;
21679
21766
  context.lineCap = "round";
21680
21767
  context.lineJoin = "miter";
21681
- context.miterLimit = 0;
21768
+ context.miterLimit = 10;
21682
21769
  context.fillStyle = "#FFFFFF";
21770
+ UtilFont.measure(context, font);
21683
21771
  var offsetX = 7;
21684
- var offsetY = characterSize >> 1;
21772
+ var offsetY = Math.round((characterSize - (font.ascent + font.descent)) * 0.5 + font.ascent);
21685
21773
  var x = 0;
21686
21774
  var y = 0;
21687
21775
  for (var id in characters) {
@@ -21710,11 +21798,11 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
21710
21798
  canvas.height = height;
21711
21799
  context.font = fontStyle;
21712
21800
  context.textAlign = "left";
21713
- context.textBaseline = "middle";
21801
+ context.textBaseline = "alphabetic";
21714
21802
  context.lineWidth = 0;
21715
21803
  context.lineCap = "round";
21716
21804
  context.lineJoin = "miter";
21717
- context.miterLimit = 4;
21805
+ context.miterLimit = 10;
21718
21806
  context.fillStyle = "#FFFFFF";
21719
21807
  context.clearRect(0, 0, width, height);
21720
21808
  for (var id in characters) {
@@ -21763,25 +21851,13 @@ var DynamicSDFFontAtlas = /** @class */ (function () {
21763
21851
  delete characters[id];
21764
21852
  }
21765
21853
  };
21766
- DynamicSDFFontAtlas.toFontFamily = function (fontFamily) {
21767
- return fontFamily === "auto" ? DynamicSDFFontAtlas.getAutoFontFamily() : fontFamily;
21768
- };
21769
- DynamicSDFFontAtlas.toPowerOf2 = function (size) {
21854
+ DynamicSDFFontAtlas.prototype.toPowerOf2 = function (size) {
21770
21855
  var result = 32;
21771
21856
  while (result < size) {
21772
21857
  result <<= 1;
21773
21858
  }
21774
21859
  return result;
21775
21860
  };
21776
- DynamicSDFFontAtlas.getAutoFontFamily = function () {
21777
- if (DynamicSDFFontAtlas.FONT_FAMILY_AUTO == null) {
21778
- DynamicSDFFontAtlas.FONT_FAMILY_AUTO = DThemes.getInstance()
21779
- .get("DBase")
21780
- .getFontFamilly();
21781
- }
21782
- return DynamicSDFFontAtlas.FONT_FAMILY_AUTO;
21783
- };
21784
- DynamicSDFFontAtlas.FONT_FAMILY_AUTO = null;
21785
21861
  return DynamicSDFFontAtlas;
21786
21862
  }());
21787
21863
 
@@ -29126,77 +29202,6 @@ var DDynamicTextGeometry = /** @class */ (function (_super) {
29126
29202
  return DDynamicTextGeometry;
29127
29203
  }(pixi_js.MeshGeometry));
29128
29204
 
29129
- /*
29130
- * Copyright (C) 2019 Toshiba Corporation
29131
- * SPDX-License-Identifier: Apache-2.0
29132
- */
29133
- var UtilFont = /** @class */ (function () {
29134
- function UtilFont() {
29135
- }
29136
- UtilFont.measure = function (font) {
29137
- var results = this._results;
29138
- if (results == null) {
29139
- results = new Map();
29140
- this._results = results;
29141
- }
29142
- var result = results.get(font);
29143
- if (result != null) {
29144
- return result;
29145
- }
29146
- this.setup(font);
29147
- var blockRect = this._block.getBoundingClientRect();
29148
- var blockRectTop = blockRect.top;
29149
- var spanRect = this._span.getBoundingClientRect();
29150
- var ascent = blockRectTop - spanRect.top;
29151
- var descent = spanRect.bottom - blockRectTop;
29152
- result = {
29153
- ascent: ascent,
29154
- descent: descent
29155
- };
29156
- results.set(font, result);
29157
- return result;
29158
- };
29159
- UtilFont.toSize = function (font) {
29160
- this.setup(font);
29161
- return parseFloat(window.getComputedStyle(this._span).fontSize);
29162
- };
29163
- UtilFont.setup = function (font) {
29164
- var span = this._span;
29165
- if (span == null) {
29166
- span = document.createElement("span");
29167
- span.innerText = "|ÉqÅ";
29168
- span.style.border = "none";
29169
- span.style.margin = "0px";
29170
- this._span = span;
29171
- }
29172
- var block = this._block;
29173
- if (block == null) {
29174
- block = document.createElement("div");
29175
- block.style.display = "inline-block";
29176
- block.style.width = "0px";
29177
- block.style.height = "0px";
29178
- block.style.border = "none";
29179
- block.style.margin = "0px";
29180
- block.style.verticalAlign = "baseline";
29181
- this._block = block;
29182
- }
29183
- var div = this._div;
29184
- if (div == null) {
29185
- div = document.createElement("div");
29186
- div.style.position = "absolute";
29187
- div.style.padding = "0px";
29188
- div.style.margin = "0px";
29189
- div.style.visibility = "hidden";
29190
- div.appendChild(span);
29191
- div.appendChild(block);
29192
- document.body.appendChild(div);
29193
- this._div = div;
29194
- }
29195
- span.style.font = font;
29196
- };
29197
- return UtilFont;
29198
- }());
29199
-
29200
29205
  /*
29201
29206
  * Copyright (C) 2019 Toshiba Corporation
29202
29207
  * SPDX-License-Identifier: Apache-2.0
@@ -48452,7 +48457,7 @@ var DThemeWhiteFont = /** @class */ (function () {
48452
48457
  function DThemeWhiteFont() {
48453
48458
  }
48454
48459
  DThemeWhiteFont.prototype.getFontFamilly = function () {
48455
- return "\"Helvetica Neue\",\"Helvetica\",\"Hiragino Sans\",\"Hiragino Kaku Gothic ProN\",\"BIZ UDPGothic\",\"Arial\",\"Yu Gothic\",\"Meiryo\",sans-serif";
48460
+ return "\"Helvetica Neue\",\"Helvetica\",\"Hiragino Sans\",\"Hiragino Kaku Gothic ProN\",\"BIZ UDPGothic\",\"Arial\",\"Yu Gothic UI\",\"Meiryo UI\",sans-serif";
48456
48461
  };
48457
48462
  DThemeWhiteFont.prototype.getFontSize = function () {
48458
48463
  return 14;
@@ -59601,7 +59606,7 @@ var DThemeDarkFont = /** @class */ (function () {
59601
59606
  function DThemeDarkFont() {
59602
59607
  }
59603
59608
  DThemeDarkFont.prototype.getFontFamilly = function () {
59604
- return "\"Helvetica Neue\",\"Helvetica\",\"Hiragino Sans\",\"Hiragino Kaku Gothic ProN\",\"BIZ UDPGothic\",\"Arial\",\"Yu Gothic\",\"Meiryo\",sans-serif";
59609
+ return "\"Helvetica Neue\",\"Helvetica\",\"Hiragino Sans\",\"Hiragino Kaku Gothic ProN\",\"BIZ UDPGothic\",\"Arial\",\"Yu Gothic UI\",\"Meiryo UI\",sans-serif";
59605
59610
  };
59606
59611
  DThemeDarkFont.prototype.getFontSize = function () {
59607
59612
  return 14;
@@ -70060,9 +70065,9 @@ var DynamicFontAtlasFont = /** @class */ (function () {
70060
70065
  this.size = size;
70061
70066
  this.color = pixi_js.utils.hex2string(color);
70062
70067
  this.height = size + padding * 2;
70063
- var metrics = UtilFont.measure(fontId);
70064
- this.ascent = metrics.ascent;
70065
- this.descent = metrics.descent;
70068
+ this.measured = false;
70069
+ this.ascent = 0;
70070
+ this.descent = 0;
70066
70071
  }
70067
70072
  return DynamicFontAtlasFont;
70068
70073
  }());
@@ -70263,7 +70268,7 @@ var DynamicFontAtlas = /** @class */ (function () {
70263
70268
  context.lineWidth = 0;
70264
70269
  context.lineCap = "round";
70265
70270
  context.lineJoin = "miter";
70266
- context.miterLimit = 0;
70271
+ context.miterLimit = 10;
70267
70272
  context.fillStyle = font.color;
70268
70273
  context.strokeStyle = "#0000ff";
70269
70274
  }
@@ -70280,7 +70285,6 @@ var DynamicFontAtlas = /** @class */ (function () {
70280
70285
  var characters = this._characters;
70281
70286
  var width = (this._width = this.toPowerOf2(Math.ceil(Math.sqrt(this._length)) * fontHeight));
70282
70287
  var offsetX = this._padding;
70283
- var offsetY = Math.round((fontHeight - (font.ascent + font.descent)) * 0.5 + font.ascent);
70284
70288
  var x = 0;
70285
70289
  var y = 0;
70286
70290
  for (var key in characters) {
@@ -70292,7 +70296,6 @@ var DynamicFontAtlas = /** @class */ (function () {
70292
70296
  character.x = x;
70293
70297
  character.y = y;
70294
70298
  character.origin.x = x + offsetX;
70295
- character.origin.y = y + offsetY;
70296
70299
  x += character.width;
70297
70300
  }
70298
70301
  var height = (this._height = y + fontHeight);
@@ -70307,11 +70310,14 @@ var DynamicFontAtlas = /** @class */ (function () {
70307
70310
  canvas.height = realHeight;
70308
70311
  var context = this.getContext();
70309
70312
  if (context != null) {
70313
+ UtilFont.measure(context, font);
70314
+ var offsetY = Math.round((fontHeight - (font.ascent + font.descent)) * 0.5 + font.ascent);
70310
70315
  context.save();
70311
70316
  context.scale(resolution, resolution);
70312
70317
  context.clearRect(0, 0, width, height);
70313
70318
  for (var key in characters) {
70314
70319
  var character = characters[key];
70320
+ character.origin.y = character.y + offsetY;
70315
70321
  context.fillText(key, character.origin.x, character.origin.y);
70316
70322
  }
70317
70323
  context.restore();
@@ -100681,6 +100687,7 @@ exports.DynamicFontAtlasCharacterType = DynamicFontAtlasCharacterType;
100681
100687
  exports.DynamicFontAtlasFont = DynamicFontAtlasFont;
100682
100688
  exports.DynamicFontAtlases = DynamicFontAtlases;
100683
100689
  exports.DynamicSDFFontAtlas = DynamicSDFFontAtlas;
100690
+ exports.DynamicSDFFontAtlasFont = DynamicSDFFontAtlasFont;
100684
100691
  exports.DynamicSDFFontAtlases = DynamicSDFFontAtlases;
100685
100692
  exports.DynamicSDFFontGenerator = DynamicSDFFontGenerator;
100686
100693
  exports.EShapeAcceptorEdgeSide = EShapeAcceptorEdgeSide;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.417.0
2
+ Winter Cardinal UI v0.418.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -21221,6 +21221,34 @@
21221
21221
  LETTER_RNB: LETTER_RNB
21222
21222
  };
21223
21223
 
21224
+ /*
21225
+ * Copyright (C) 2019 Toshiba Corporation
21226
+ * SPDX-License-Identifier: Apache-2.0
21227
+ */
21228
+ var DynamicSDFFontAtlasFont = /** @class */ (function () {
21229
+ function DynamicSDFFontAtlasFont(fontFamily) {
21230
+ this.id = DynamicSDFFontAtlasFont.toFontFamily(fontFamily);
21231
+ this.size = 32;
21232
+ this.italic = false;
21233
+ this.measured = false;
21234
+ this.ascent = 0;
21235
+ this.descent = 0;
21236
+ }
21237
+ DynamicSDFFontAtlasFont.toFontFamily = function (fontFamily) {
21238
+ return fontFamily === "auto" ? DynamicSDFFontAtlasFont.getAutoFontFamily() : fontFamily;
21239
+ };
21240
+ DynamicSDFFontAtlasFont.getAutoFontFamily = function () {
21241
+ if (DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO == null) {
21242
+ DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO = DThemes.getInstance()
21243
+ .get("DBase")
21244
+ .getFontFamilly();
21245
+ }
21246
+ return DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO;
21247
+ };
21248
+ DynamicSDFFontAtlasFont.FONT_FAMILY_AUTO = null;
21249
+ return DynamicSDFFontAtlasFont;
21250
+ }());
21251
+
21224
21252
  /*
21225
21253
  * Copyright (C) 2019 Toshiba Corporation
21226
21254
  * SPDX-License-Identifier: Apache-2.0
@@ -21509,6 +21537,69 @@
21509
21537
  return DynamicSDFFontGenerator;
21510
21538
  }());
21511
21539
 
21540
+ /*
21541
+ * Copyright (C) 2019 Toshiba Corporation
21542
+ * SPDX-License-Identifier: Apache-2.0
21543
+ */
21544
+ var UtilFont = /** @class */ (function () {
21545
+ function UtilFont() {
21546
+ }
21547
+ UtilFont.measure = function (context, font) {
21548
+ if (!font.measured) {
21549
+ if ("fontBoundingBoxAscent" in window.TextMetrics.prototype) {
21550
+ var metrics = context.measureText(pixi_js.TextMetrics.METRICS_STRING);
21551
+ font.ascent = metrics.fontBoundingBoxAscent;
21552
+ font.descent = metrics.fontBoundingBoxDescent;
21553
+ }
21554
+ else {
21555
+ var measured = pixi_js.TextMetrics.measureFont(font.id);
21556
+ font.ascent = measured.ascent;
21557
+ font.descent = measured.descent;
21558
+ }
21559
+ font.measured = true;
21560
+ }
21561
+ };
21562
+ UtilFont.toSize = function (font) {
21563
+ this.setup(font);
21564
+ return parseFloat(window.getComputedStyle(this._span).fontSize);
21565
+ };
21566
+ UtilFont.setup = function (font) {
21567
+ var span = this._span;
21568
+ if (span == null) {
21569
+ span = document.createElement("span");
21570
+ span.innerText = "|ÉqÅ";
21571
+ span.style.border = "none";
21572
+ span.style.margin = "0px";
21573
+ this._span = span;
21574
+ }
21575
+ var block = this._block;
21576
+ if (block == null) {
21577
+ block = document.createElement("div");
21578
+ block.style.display = "inline-block";
21579
+ block.style.width = "0px";
21580
+ block.style.height = "0px";
21581
+ block.style.border = "none";
21582
+ block.style.margin = "0px";
21583
+ block.style.verticalAlign = "baseline";
21584
+ this._block = block;
21585
+ }
21586
+ var div = this._div;
21587
+ if (div == null) {
21588
+ div = document.createElement("div");
21589
+ div.style.position = "absolute";
21590
+ div.style.padding = "0px";
21591
+ div.style.margin = "0px";
21592
+ div.style.visibility = "hidden";
21593
+ div.appendChild(span);
21594
+ div.appendChild(block);
21595
+ document.body.appendChild(div);
21596
+ this._div = div;
21597
+ }
21598
+ span.style.font = font;
21599
+ };
21600
+ return UtilFont;
21601
+ }());
21602
+
21512
21603
  /*
21513
21604
  * Copyright (C) 2019 Toshiba Corporation
21514
21605
  * SPDX-License-Identifier: Apache-2.0
@@ -21518,11 +21609,7 @@
21518
21609
  this._id = "font-atlas:".concat(fontFamily);
21519
21610
  this._generator = DynamicSDFFontGenerator.getInstance().init();
21520
21611
  this._canvas = document.createElement("canvas");
21521
- this._font = {
21522
- family: DynamicSDFFontAtlas.toFontFamily(fontFamily),
21523
- size: 32,
21524
- italic: false
21525
- };
21612
+ this._font = new DynamicSDFFontAtlasFont(fontFamily);
21526
21613
  this._characters = {};
21527
21614
  this._length = 0;
21528
21615
  this._width = 1;
@@ -21541,7 +21628,7 @@
21541
21628
  return this._font;
21542
21629
  },
21543
21630
  set: function (font) {
21544
- this._font.family = font.family;
21631
+ this._font.id = font.id;
21545
21632
  this._font.size = font.size;
21546
21633
  this._font.italic = font.italic;
21547
21634
  },
@@ -21666,19 +21753,20 @@
21666
21753
  var font = this._font;
21667
21754
  var characters = this._characters;
21668
21755
  var characterSize = font.size + 14;
21669
- var width = DynamicSDFFontAtlas.toPowerOf2(Math.ceil(Math.sqrt(this._length)) * characterSize);
21756
+ var width = this.toPowerOf2(Math.ceil(Math.sqrt(this._length)) * characterSize);
21670
21757
  this._width = width;
21671
- var fontStyle = (font.italic ? "italic " : "") + (font.size + "px ") + font.family;
21758
+ var fontStyle = (font.italic ? "italic " : "") + (font.size + "px ") + font.id;
21672
21759
  context.font = fontStyle;
21673
21760
  context.textAlign = "left";
21674
- context.textBaseline = "middle";
21761
+ context.textBaseline = "alphabetic";
21675
21762
  context.lineWidth = 0;
21676
21763
  context.lineCap = "round";
21677
21764
  context.lineJoin = "miter";
21678
- context.miterLimit = 0;
21765
+ context.miterLimit = 10;
21679
21766
  context.fillStyle = "#FFFFFF";
21767
+ UtilFont.measure(context, font);
21680
21768
  var offsetX = 7;
21681
- var offsetY = characterSize >> 1;
21769
+ var offsetY = Math.round((characterSize - (font.ascent + font.descent)) * 0.5 + font.ascent);
21682
21770
  var x = 0;
21683
21771
  var y = 0;
21684
21772
  for (var id in characters) {
@@ -21707,11 +21795,11 @@
21707
21795
  canvas.height = height;
21708
21796
  context.font = fontStyle;
21709
21797
  context.textAlign = "left";
21710
- context.textBaseline = "middle";
21798
+ context.textBaseline = "alphabetic";
21711
21799
  context.lineWidth = 0;
21712
21800
  context.lineCap = "round";
21713
21801
  context.lineJoin = "miter";
21714
- context.miterLimit = 4;
21802
+ context.miterLimit = 10;
21715
21803
  context.fillStyle = "#FFFFFF";
21716
21804
  context.clearRect(0, 0, width, height);
21717
21805
  for (var id in characters) {
@@ -21760,25 +21848,13 @@
21760
21848
  delete characters[id];
21761
21849
  }
21762
21850
  };
21763
- DynamicSDFFontAtlas.toFontFamily = function (fontFamily) {
21764
- return fontFamily === "auto" ? DynamicSDFFontAtlas.getAutoFontFamily() : fontFamily;
21765
- };
21766
- DynamicSDFFontAtlas.toPowerOf2 = function (size) {
21851
+ DynamicSDFFontAtlas.prototype.toPowerOf2 = function (size) {
21767
21852
  var result = 32;
21768
21853
  while (result < size) {
21769
21854
  result <<= 1;
21770
21855
  }
21771
21856
  return result;
21772
21857
  };
21773
- DynamicSDFFontAtlas.getAutoFontFamily = function () {
21774
- if (DynamicSDFFontAtlas.FONT_FAMILY_AUTO == null) {
21775
- DynamicSDFFontAtlas.FONT_FAMILY_AUTO = DThemes.getInstance()
21776
- .get("DBase")
21777
- .getFontFamilly();
21778
- }
21779
- return DynamicSDFFontAtlas.FONT_FAMILY_AUTO;
21780
- };
21781
- DynamicSDFFontAtlas.FONT_FAMILY_AUTO = null;
21782
21858
  return DynamicSDFFontAtlas;
21783
21859
  }());
21784
21860
 
@@ -29123,77 +29199,6 @@
29123
29199
  return DDynamicTextGeometry;
29124
29200
  }(pixi_js.MeshGeometry));
29125
29201
 
29126
- /*
29127
- * Copyright (C) 2019 Toshiba Corporation
29128
- * SPDX-License-Identifier: Apache-2.0
29129
- */
29130
- var UtilFont = /** @class */ (function () {
29131
- function UtilFont() {
29132
- }
29133
- UtilFont.measure = function (font) {
29134
- var results = this._results;
29135
- if (results == null) {
29136
- results = new Map();
29137
- this._results = results;
29138
- }
29139
- var result = results.get(font);
29140
- if (result != null) {
29141
- return result;
29142
- }
29143
- this.setup(font);
29144
- var blockRect = this._block.getBoundingClientRect();
29145
- var blockRectTop = blockRect.top;
29146
- var spanRect = this._span.getBoundingClientRect();
29147
- var ascent = blockRectTop - spanRect.top;
29148
- var descent = spanRect.bottom - blockRectTop;
29149
- result = {
29150
- ascent: ascent,
29151
- descent: descent
29152
- };
29153
- results.set(font, result);
29154
- return result;
29155
- };
29156
- UtilFont.toSize = function (font) {
29157
- this.setup(font);
29158
- return parseFloat(window.getComputedStyle(this._span).fontSize);
29159
- };
29160
- UtilFont.setup = function (font) {
29161
- var span = this._span;
29162
- if (span == null) {
29163
- span = document.createElement("span");
29164
- span.innerText = "|ÉqÅ";
29165
- span.style.border = "none";
29166
- span.style.margin = "0px";
29167
- this._span = span;
29168
- }
29169
- var block = this._block;
29170
- if (block == null) {
29171
- block = document.createElement("div");
29172
- block.style.display = "inline-block";
29173
- block.style.width = "0px";
29174
- block.style.height = "0px";
29175
- block.style.border = "none";
29176
- block.style.margin = "0px";
29177
- block.style.verticalAlign = "baseline";
29178
- this._block = block;
29179
- }
29180
- var div = this._div;
29181
- if (div == null) {
29182
- div = document.createElement("div");
29183
- div.style.position = "absolute";
29184
- div.style.padding = "0px";
29185
- div.style.margin = "0px";
29186
- div.style.visibility = "hidden";
29187
- div.appendChild(span);
29188
- div.appendChild(block);
29189
- document.body.appendChild(div);
29190
- this._div = div;
29191
- }
29192
- span.style.font = font;
29193
- };
29194
- return UtilFont;
29195
- }());
29196
-
29197
29202
  /*
29198
29203
  * Copyright (C) 2019 Toshiba Corporation
29199
29204
  * SPDX-License-Identifier: Apache-2.0
@@ -48225,9 +48230,9 @@
48225
48230
  this.size = size;
48226
48231
  this.color = pixi_js.utils.hex2string(color);
48227
48232
  this.height = size + padding * 2;
48228
- var metrics = UtilFont.measure(fontId);
48229
- this.ascent = metrics.ascent;
48230
- this.descent = metrics.descent;
48233
+ this.measured = false;
48234
+ this.ascent = 0;
48235
+ this.descent = 0;
48231
48236
  }
48232
48237
  return DynamicFontAtlasFont;
48233
48238
  }());
@@ -48428,7 +48433,7 @@
48428
48433
  context.lineWidth = 0;
48429
48434
  context.lineCap = "round";
48430
48435
  context.lineJoin = "miter";
48431
- context.miterLimit = 0;
48436
+ context.miterLimit = 10;
48432
48437
  context.fillStyle = font.color;
48433
48438
  context.strokeStyle = "#0000ff";
48434
48439
  }
@@ -48445,7 +48450,6 @@
48445
48450
  var characters = this._characters;
48446
48451
  var width = (this._width = this.toPowerOf2(Math.ceil(Math.sqrt(this._length)) * fontHeight));
48447
48452
  var offsetX = this._padding;
48448
- var offsetY = Math.round((fontHeight - (font.ascent + font.descent)) * 0.5 + font.ascent);
48449
48453
  var x = 0;
48450
48454
  var y = 0;
48451
48455
  for (var key in characters) {
@@ -48457,7 +48461,6 @@
48457
48461
  character.x = x;
48458
48462
  character.y = y;
48459
48463
  character.origin.x = x + offsetX;
48460
- character.origin.y = y + offsetY;
48461
48464
  x += character.width;
48462
48465
  }
48463
48466
  var height = (this._height = y + fontHeight);
@@ -48472,11 +48475,14 @@
48472
48475
  canvas.height = realHeight;
48473
48476
  var context = this.getContext();
48474
48477
  if (context != null) {
48478
+ UtilFont.measure(context, font);
48479
+ var offsetY = Math.round((fontHeight - (font.ascent + font.descent)) * 0.5 + font.ascent);
48475
48480
  context.save();
48476
48481
  context.scale(resolution, resolution);
48477
48482
  context.clearRect(0, 0, width, height);
48478
48483
  for (var key in characters) {
48479
48484
  var character = characters[key];
48485
+ character.origin.y = character.y + offsetY;
48480
48486
  context.fillText(key, character.origin.x, character.origin.y);
48481
48487
  }
48482
48488
  context.restore();
@@ -79071,6 +79077,7 @@
79071
79077
  DynamicFontAtlasFont: DynamicFontAtlasFont,
79072
79078
  DynamicFontAtlas: DynamicFontAtlas,
79073
79079
  DynamicFontAtlases: DynamicFontAtlases,
79080
+ DynamicSDFFontAtlasFont: DynamicSDFFontAtlasFont,
79074
79081
  DynamicSDFFontAtlas: DynamicSDFFontAtlas,
79075
79082
  DynamicSDFFontAtlases: DynamicSDFFontAtlases,
79076
79083
  DynamicSDFFontGenerator: DynamicSDFFontGenerator,