@awayjs/scene 0.13.224 → 0.13.233

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 (48) hide show
  1. package/bundle/awayjs-scene.umd.js +874 -392
  2. package/bundle/awayjs-scene.umd.js.map +1 -1
  3. package/bundle/awayjs-scene.umd.min.js.map +1 -1
  4. package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/lib/Settings.d.ts +3 -0
  7. package/dist/lib/Settings.d.ts.map +1 -1
  8. package/dist/lib/Settings.js +17 -2
  9. package/dist/lib/display/DisplayObjectContainer.d.ts +1 -0
  10. package/dist/lib/display/DisplayObjectContainer.d.ts.map +1 -1
  11. package/dist/lib/display/DisplayObjectContainer.js +4 -2
  12. package/dist/lib/display/TextField.d.ts +36 -5
  13. package/dist/lib/display/TextField.d.ts.map +1 -1
  14. package/dist/lib/display/TextField.js +227 -138
  15. package/dist/lib/image/SceneImage2D.d.ts.map +1 -1
  16. package/dist/lib/image/SceneImage2D.js +35 -8
  17. package/dist/lib/managers/MouseManager.js +1 -1
  18. package/dist/lib/text/FNTGenerator.d.ts +5 -4
  19. package/dist/lib/text/FNTGenerator.d.ts.map +1 -1
  20. package/dist/lib/text/FNTGenerator.js +15 -11
  21. package/dist/lib/text/FNTGeneratorCanvas.d.ts +23 -0
  22. package/dist/lib/text/FNTGeneratorCanvas.d.ts.map +1 -0
  23. package/dist/lib/text/FNTGeneratorCanvas.js +205 -0
  24. package/dist/lib/text/FNTGeneratrorBase.d.ts +8 -0
  25. package/dist/lib/text/FNTGeneratrorBase.d.ts.map +1 -0
  26. package/dist/lib/text/FNTGeneratrorBase.js +7 -0
  27. package/dist/lib/text/TesselatedFontChar.d.ts +6 -4
  28. package/dist/lib/text/TesselatedFontChar.d.ts.map +1 -1
  29. package/dist/lib/text/TesselatedFontChar.js +8 -3
  30. package/dist/lib/text/TesselatedFontTable.d.ts +19 -3
  31. package/dist/lib/text/TesselatedFontTable.d.ts.map +1 -1
  32. package/dist/lib/text/TesselatedFontTable.js +339 -225
  33. package/dist/lib/text/TextShape.d.ts +6 -3
  34. package/dist/lib/text/TextShape.d.ts.map +1 -1
  35. package/dist/lib/text/TextShape.js +27 -2
  36. package/index.ts +1 -1
  37. package/lib/Settings.ts +23 -3
  38. package/lib/display/DisplayObjectContainer.ts +4 -2
  39. package/lib/display/TextField.ts +317 -145
  40. package/lib/image/SceneImage2D.ts +84 -9
  41. package/lib/managers/MouseManager.ts +1 -1
  42. package/lib/text/FNTGenerator.ts +5 -7
  43. package/lib/text/FNTGeneratorCanvas.ts +288 -0
  44. package/lib/text/FNTGeneratrorBase.ts +11 -0
  45. package/lib/text/TesselatedFontChar.ts +8 -12
  46. package/lib/text/TesselatedFontTable.ts +438 -255
  47. package/lib/text/TextShape.ts +30 -3
  48. package/package.json +1 -1
@@ -1132,7 +1132,7 @@ var PrimitiveSpherePrefab = /** @class */ (function (_super) {
1132
1132
  }(PrimitivePrefabBase));
1133
1133
 
1134
1134
  var _a$1;
1135
- var Settings = {
1135
+ var Settings = _awayjs_core.ConfigManager.instance.addStore('scene', {
1136
1136
  /**
1137
1137
  * @description Force MSAA for rendering to image bitmap (WebGL2), 0 - disable, 1-16 - msaa quality
1138
1138
  */
@@ -1174,7 +1174,21 @@ var Settings = {
1174
1174
  * @description How many pixels can be processed on CPU for `copyPixel` operation for avoid run GPU
1175
1175
  */
1176
1176
  CPU_COPY_PIXELS_COUNT: 64 * 64,
1177
- };
1177
+ /**
1178
+ * @description Quality factor for pre-tesselated font shapes,
1179
+ * values greater 1 no make sense, 1/10 produce normal font result for small fonts (14px)
1180
+ */
1181
+ FONT_TESSELATION_QUALITY: 1 / 10,
1182
+ /**
1183
+ * @description Use unsafe FNT (pre-cached font shapes onto texture)
1184
+ */
1185
+ USE_UNSAFE_FNT: false,
1186
+ /**
1187
+ * @description Precision of text building for rounding a vertices placement of text shape.
1188
+ * Used for correction text blurring when pixel is missposited
1189
+ */
1190
+ TEXT_SHAPE_ROUND_PRECISION: 0.1,
1191
+ });
1178
1192
 
1179
1193
  /**
1180
1194
  * The DisplayObject class is the base class for all objects that can be
@@ -3087,8 +3101,9 @@ var DisplayObjectContainer = /** @class */ (function (_super) {
3087
3101
  */
3088
3102
  DisplayObjectContainer.prototype.getChildIndex = function (child) {
3089
3103
  var childIndex = this._children.indexOf(child);
3090
- if (childIndex == -1)
3091
- throw new _awayjs_core.ArgumentError('Child parameter is not a child of the caller');
3104
+ if (childIndex == -1) {
3105
+ throw DisplayObjectContainer.NO_CHILD_ERROR;
3106
+ }
3092
3107
  return childIndex;
3093
3108
  };
3094
3109
  /**
@@ -3306,6 +3321,7 @@ var DisplayObjectContainer = /** @class */ (function (_super) {
3306
3321
  _super.prototype._updateMaskMode.call(this);
3307
3322
  };
3308
3323
  DisplayObjectContainer.assetType = '[asset DisplayObjectContainer]';
3324
+ DisplayObjectContainer.NO_CHILD_ERROR = new _awayjs_core.ArgumentError('Child parameter is not a child of the caller');
3309
3325
  return DisplayObjectContainer;
3310
3326
  }(DisplayObject));
3311
3327
  _awayjs_view.PartitionBase.registerAbstraction(_awayjs_view.EntityNode, DisplayObjectContainer);
@@ -8441,7 +8457,15 @@ var TesselatedFontChar = /** @class */ (function () {
8441
8457
  if (fill_data === void 0) { fill_data = null; }
8442
8458
  if (stroke_data === void 0) { stroke_data = null; }
8443
8459
  if (fill_data_path === void 0) { fill_data_path = null; }
8460
+ this.fill_data = fill_data;
8461
+ this.stroke_data = stroke_data;
8462
+ this.fill_data_path = fill_data_path;
8444
8463
  this.fnt_channel = 0;
8464
+ /**
8465
+ * What is scale was used for generating last tesselation
8466
+ * Used for reduce a vertices count
8467
+ */
8468
+ this.lastTesselatedScale = 0;
8445
8469
  /**
8446
8470
  * the char_codes that this geom has kerning set for
8447
8471
  */
@@ -8450,9 +8474,6 @@ var TesselatedFontChar = /** @class */ (function () {
8450
8474
  * the kerning values per char_code
8451
8475
  */
8452
8476
  this.kerningValues = [];
8453
- this.fill_data = fill_data;
8454
- this.stroke_data = stroke_data;
8455
- this.fill_data_path = fill_data_path;
8456
8477
  }
8457
8478
  TesselatedFontChar.prototype.dispose = function () {
8458
8479
  if (this.stroke_data) {
@@ -8471,6 +8492,213 @@ var TesselatedFontChar = /** @class */ (function () {
8471
8492
  return TesselatedFontChar;
8472
8493
  }());
8473
8494
 
8495
+ var FNTGeneratorBase = /** @class */ (function () {
8496
+ function FNTGeneratorBase(_stage) {
8497
+ this._stage = _stage;
8498
+ }
8499
+ return FNTGeneratorBase;
8500
+ }());
8501
+
8502
+ var Bounds = /** @class */ (function () {
8503
+ function Bounds() {
8504
+ this.left = Number.MAX_VALUE;
8505
+ this.right = Number.MIN_VALUE;
8506
+ this.top = Number.MAX_VALUE;
8507
+ this.bottom = Number.MIN_VALUE;
8508
+ }
8509
+ Bounds.prototype.grown = function (x, y) {
8510
+ if (x < this.left)
8511
+ this.left = x;
8512
+ if (x > this.right)
8513
+ this.right = x;
8514
+ if (y < this.top)
8515
+ this.top = y;
8516
+ if (y > this.bottom)
8517
+ this.bottom = y;
8518
+ };
8519
+ Bounds.prototype.toRect = function () {
8520
+ return new _awayjs_core.Rectangle(this.left, this.top, this.right - this.left, this.bottom - this.top);
8521
+ };
8522
+ return Bounds;
8523
+ }());
8524
+ var FNTGeneratorCanvas = /** @class */ (function (_super) {
8525
+ __extends(FNTGeneratorCanvas, _super);
8526
+ function FNTGeneratorCanvas(stage, debug) {
8527
+ if (debug === void 0) { debug = false; }
8528
+ var _this = _super.call(this, stage) || this;
8529
+ /**
8530
+ * Debug mode.
8531
+ * Prevent OffscreenCanvas and prevent canvas clear.
8532
+ * Store canvas
8533
+ */
8534
+ _this.debug = false;
8535
+ _this.debug = debug;
8536
+ return _this;
8537
+ }
8538
+ FNTGeneratorCanvas.getCanvasContext = function (width, height, debug) {
8539
+ if (width === void 0) { width = 100; }
8540
+ if (height === void 0) { height = 100; }
8541
+ if (debug === void 0) { debug = false; }
8542
+ var canvas = ('OffscreenCanvas' in self && !debug)
8543
+ ? new self.OffscreenCanvas(width, height)
8544
+ : document.createElement('canvas');
8545
+ canvas.width = width;
8546
+ canvas.height = height;
8547
+ return canvas.getContext('2d', { desynchronized: true, alpha: true });
8548
+ };
8549
+ FNTGeneratorCanvas.freeCanvasContext = function (ctx) {
8550
+ if (ctx.canvas instanceof self.OffscreenCanvas) {
8551
+ return;
8552
+ }
8553
+ // safari bug with canvas leaks
8554
+ ctx.canvas.width = 0;
8555
+ ctx.canvas.height = 0;
8556
+ };
8557
+ FNTGeneratorCanvas.transformChar = function (char) {
8558
+ var fillData = char.fill_data_path;
8559
+ // empty command
8560
+ if (fillData.commands[0].length === 0 && fillData.commands.length === 1) {
8561
+ return null;
8562
+ }
8563
+ var path = new Path2D();
8564
+ var box = new Bounds();
8565
+ for (var i = 0; i < fillData.commands.length; i++) {
8566
+ var data = fillData.data[i];
8567
+ var commands = fillData.commands[i];
8568
+ var pointer = 0;
8569
+ for (var _i = 0, commands_1 = commands; _i < commands_1.length; _i++) {
8570
+ var command = commands_1[_i];
8571
+ switch (command) {
8572
+ case _awayjs_graphics.GraphicsPathCommand.MOVE_TO: {
8573
+ // flash path in twips, transform it
8574
+ var px = data[pointer++] / 20;
8575
+ var py = data[pointer++] / 20;
8576
+ box.grown(px, py);
8577
+ path.moveTo(px, py);
8578
+ break;
8579
+ }
8580
+ case _awayjs_graphics.GraphicsPathCommand.LINE_TO: {
8581
+ var px = data[pointer++] / 20;
8582
+ var py = data[pointer++] / 20;
8583
+ box.grown(px, py);
8584
+ path.lineTo(px, py);
8585
+ break;
8586
+ }
8587
+ case _awayjs_graphics.GraphicsPathCommand.CURVE_TO: {
8588
+ var cx = data[pointer++] / 20;
8589
+ var cy = data[pointer++] / 20;
8590
+ var dx = data[pointer++] / 20;
8591
+ var dy = data[pointer++] / 20;
8592
+ box.grown(cx, cy);
8593
+ box.grown(dx, dy);
8594
+ path.quadraticCurveTo(cx, cy, dx, dy);
8595
+ }
8596
+ }
8597
+ }
8598
+ //path.closePath();
8599
+ }
8600
+ return {
8601
+ path: path,
8602
+ char: char,
8603
+ rect: box.toRect(),
8604
+ };
8605
+ };
8606
+ FNTGeneratorCanvas.sortPatches = function (a, b) {
8607
+ return a.rect.height - b.rect.height;
8608
+ };
8609
+ FNTGeneratorCanvas.render = function (table, context, size, fontSize, padding) {
8610
+ if (fontSize === void 0) { fontSize = 0; }
8611
+ if (padding === void 0) { padding = 0; }
8612
+ var chars = table.get_font_chars();
8613
+ var patches = [];
8614
+ var doublePad = padding * 2;
8615
+ var totalArea = 0;
8616
+ var scale = 1;
8617
+ for (var _i = 0, chars_1 = chars; _i < chars_1.length; _i++) {
8618
+ var char = chars_1[_i];
8619
+ var path = FNTGeneratorCanvas.transformChar(char);
8620
+ if (!path) {
8621
+ continue;
8622
+ }
8623
+ totalArea += (doublePad + path.rect.width) * (doublePad + path.rect.height);
8624
+ patches.push(path);
8625
+ }
8626
+ patches.sort(FNTGeneratorCanvas.sortPatches);
8627
+ // TODO compute valid scale when fontSize is 0
8628
+ if (fontSize) {
8629
+ table.initFontSize(fontSize);
8630
+ scale = /* 20 * table._size_multiply **/ size / table.get_font_em_size();
8631
+ }
8632
+ /**
8633
+ * Render glyphs onto canvas
8634
+ * We will render glyphs as white and background as black transparent
8635
+ */
8636
+ context.save();
8637
+ context.clearRect(0, 0, size, size);
8638
+ context.fillStyle = '#fff';
8639
+ var tx = padding;
8640
+ var ty = padding;
8641
+ var maxHeight = 0;
8642
+ // pack glyph based on size
8643
+ for (var _a = 0, patches_1 = patches; _a < patches_1.length; _a++) {
8644
+ var path = patches_1[_a];
8645
+ if (!path.path) {
8646
+ continue;
8647
+ }
8648
+ // if overflow - jump next location
8649
+ if (tx + path.rect.width + doublePad >= size / scale) {
8650
+ tx = padding;
8651
+ ty += maxHeight + doublePad;
8652
+ maxHeight = 0;
8653
+ }
8654
+ /**
8655
+ * @todo Support multiple channel table data
8656
+ */
8657
+ if (ty + path.rect.height > size / scale) {
8658
+ console.warn('[FNTGeneratorCanvas] Font image overflow, font will corrupted!');
8659
+ }
8660
+ maxHeight = Math.max(path.rect.height, maxHeight);
8661
+ context.setTransform(scale, 0, 0, scale, (tx - path.rect.x) * scale, (ty - path.rect.y) * scale);
8662
+ context.fill(path.path);
8663
+ //context.strokeRect(path.rect.x,path.rect.y, path.rect.width, path.rect.height);
8664
+ path.char.fnt_rect = new _awayjs_core.Rectangle((path.rect.x) / path.char.char_width, (path.rect.y) / table.get_font_em_size(), path.rect.width / path.char.char_width, path.rect.height / table.get_font_em_size());
8665
+ path.char.fnt_uv = new _awayjs_core.Rectangle(tx * scale / size, ty * scale / size, path.rect.width * scale / size, path.rect.height * scale / size);
8666
+ /*
8667
+ path.char.fnt_uv = new Rectangle(
8668
+ (tx - path.rect.x) * scale / size,
8669
+ 1 - (ty - path.rect.y) * scale / scale,
8670
+ path.rect.width * scale / size,
8671
+ path.rect.height * scale / size
8672
+ );*/
8673
+ path.char.fnt_channel = 0;
8674
+ tx += path.rect.width + doublePad;
8675
+ }
8676
+ context.restore();
8677
+ };
8678
+ FNTGeneratorCanvas.prototype.generate = function (font, size, fontSize, padding) {
8679
+ var context = FNTGeneratorCanvas.getCanvasContext(size, size, this.debug);
8680
+ var bitmaps = [];
8681
+ for (var key in font.font_styles) {
8682
+ var table = font.font_styles[key];
8683
+ // render table in context
8684
+ FNTGeneratorCanvas.render(table, context, size, fontSize, padding);
8685
+ var data = context.getImageData(0, 0, size, size);
8686
+ var image = new _awayjs_stage.BitmapImage2D(size, size, true, 0, true, this._stage);
8687
+ image.setPixels(new _awayjs_core.Rectangle(0, 0, size, size), data.data);
8688
+ bitmaps.push(image);
8689
+ table.addFNTChannel(image);
8690
+ }
8691
+ if (!this.debug) {
8692
+ FNTGeneratorCanvas.freeCanvasContext(context);
8693
+ }
8694
+ else {
8695
+ this.canvas = context.canvas;
8696
+ }
8697
+ return bitmaps;
8698
+ };
8699
+ return FNTGeneratorCanvas;
8700
+ }(FNTGeneratorBase));
8701
+
8474
8702
  var ONCE_EMIT_TABLE = Object.create(null);
8475
8703
  function once$1(obj, key) {
8476
8704
  if (key === void 0) { key = ''; }
@@ -8541,59 +8769,19 @@ var TesselatedFontTable = /** @class */ (function (_super) {
8541
8769
  TesselatedFontTable.prototype.getGlyphCount = function () {
8542
8770
  return this._font_chars.length;
8543
8771
  };
8544
- TesselatedFontTable.prototype._drawDebugRect = function (glyph_verts, minx, maxx, miny, maxy) {
8545
- // left
8546
- glyph_verts[glyph_verts.length] = minx;
8547
- glyph_verts[glyph_verts.length] = miny;
8548
- glyph_verts[glyph_verts.length] = minx + 1;
8549
- glyph_verts[glyph_verts.length] = maxy;
8550
- glyph_verts[glyph_verts.length] = minx;
8551
- glyph_verts[glyph_verts.length] = maxy;
8552
- glyph_verts[glyph_verts.length] = minx;
8553
- glyph_verts[glyph_verts.length] = miny;
8554
- glyph_verts[glyph_verts.length] = minx + 1;
8555
- glyph_verts[glyph_verts.length] = miny;
8556
- glyph_verts[glyph_verts.length] = minx + 1;
8557
- glyph_verts[glyph_verts.length] = maxy;
8558
- // right
8559
- glyph_verts[glyph_verts.length] = maxx;
8560
- glyph_verts[glyph_verts.length] = miny;
8561
- glyph_verts[glyph_verts.length] = maxx - 1;
8562
- glyph_verts[glyph_verts.length] = maxy;
8563
- glyph_verts[glyph_verts.length] = maxx;
8564
- glyph_verts[glyph_verts.length] = maxy;
8565
- glyph_verts[glyph_verts.length] = maxx;
8566
- glyph_verts[glyph_verts.length] = miny;
8567
- glyph_verts[glyph_verts.length] = maxx - 1;
8568
- glyph_verts[glyph_verts.length] = miny;
8569
- glyph_verts[glyph_verts.length] = maxx - 1;
8570
- glyph_verts[glyph_verts.length] = maxy;
8571
- // top
8572
- glyph_verts[glyph_verts.length] = minx + 1;
8573
- glyph_verts[glyph_verts.length] = miny;
8574
- glyph_verts[glyph_verts.length] = minx + 1;
8575
- glyph_verts[glyph_verts.length] = miny + 1;
8576
- glyph_verts[glyph_verts.length] = maxx - 1;
8577
- glyph_verts[glyph_verts.length] = miny;
8578
- glyph_verts[glyph_verts.length] = minx + 1;
8579
- glyph_verts[glyph_verts.length] = miny + 1;
8580
- glyph_verts[glyph_verts.length] = maxx - 1;
8581
- glyph_verts[glyph_verts.length] = miny + 1;
8582
- glyph_verts[glyph_verts.length] = maxx - 1;
8583
- glyph_verts[glyph_verts.length] = miny;
8584
- // bottom
8585
- glyph_verts[glyph_verts.length] = minx + 1;
8586
- glyph_verts[glyph_verts.length] = maxy;
8587
- glyph_verts[glyph_verts.length] = minx + 1;
8588
- glyph_verts[glyph_verts.length] = maxy - 1;
8589
- glyph_verts[glyph_verts.length] = maxx - 1;
8590
- glyph_verts[glyph_verts.length] = maxy;
8591
- glyph_verts[glyph_verts.length] = minx + 1;
8592
- glyph_verts[glyph_verts.length] = maxy - 1;
8593
- glyph_verts[glyph_verts.length] = maxx - 1;
8594
- glyph_verts[glyph_verts.length] = maxy - 1;
8595
- glyph_verts[glyph_verts.length] = maxx - 1;
8596
- glyph_verts[glyph_verts.length] = maxy;
8772
+ TesselatedFontTable.prototype.generateFNTData = function (stage) {
8773
+ // already exist
8774
+ if (this._fntSizeLimit > 0) {
8775
+ return;
8776
+ }
8777
+ var generator = new FNTGeneratorCanvas(stage, false);
8778
+ var bitmaps = generator.generate(this.font, this._font_em_size, this._current_size, 4);
8779
+ if (bitmaps && bitmaps.length > 0) {
8780
+ /**
8781
+ * Random value, anyway we render real font dimension ;)
8782
+ */
8783
+ this._fntSizeLimit = this._current_size * 4;
8784
+ }
8597
8785
  };
8598
8786
  TesselatedFontTable.prototype.generateFNTTextures = function (padding, fontSize, texSize) {
8599
8787
  console.log('generateFNTTextures');
@@ -8880,15 +9068,13 @@ var TesselatedFontTable = /** @class */ (function (_super) {
8880
9068
  // need to implement textFormat tabstop
8881
9069
  return (space * 2 * 20) / 20;
8882
9070
  }
8883
- var t_font_char = this.getChar(char_code);
9071
+ var t_font_char = this.getChar(char_code, false);
8884
9072
  if (t_font_char) {
8885
- return (Math.floor(t_font_char.char_width * this._size_multiply * 20)) / 20;
9073
+ return ((t_font_char.char_width * this._size_multiply * 20) | 0) / 20;
8886
9074
  }
8887
- else {
8888
- if (char_code == '9679') {
8889
- t_font_char = this.createPointGlyph_9679();
8890
- return (Math.floor(t_font_char.char_width * this._size_multiply * 20)) / 20;
8891
- }
9075
+ else if (char_code == '9679') {
9076
+ t_font_char = this.createPointGlyph_9679();
9077
+ return ((t_font_char.char_width * this._size_multiply * 20) | 0) / 20;
8892
9078
  }
8893
9079
  return 0;
8894
9080
  };
@@ -9031,28 +9217,14 @@ var TesselatedFontTable = /** @class */ (function (_super) {
9031
9217
  return new _awayjs_core.Point(x - origin_x, this.getLineHeight());
9032
9218
  };
9033
9219
  TesselatedFontTable.prototype.fillTextRun = function (tf, format, startWord, wordCnt) {
9034
- var useFNT = this._fntSizeLimit >= 0 &&
9035
- (this._fntSizeLimit == 0 || this._fntSizeLimit >= format.size);
9036
- var textShape = tf.getTextShapeForIdentifierAndFormat(format.color.toString() + useFNT.toString() + '0', format);
9037
- var fntTextShapesByChannel = {};
9038
- var fntSelectedTextShapesByChannel = {};
9039
- //var currentFNTTextShapeMap:any;
9040
- var argb;
9041
- var mat;
9220
+ var useFNT = this._fntSizeLimit >= 0 && this._fntSizeLimit >= format.size;
9042
9221
  if (useFNT) {
9043
- argb = _awayjs_core.ColorUtils.float32ColorToARGB(format.color);
9044
- mat = new _awayjs_materials.MethodMaterial(this._fnt_channels[0]);
9045
- mat.colorTransform = new _awayjs_core.ColorTransform(argb[1] / 255, argb[2] / 255, argb[3] / 255);
9046
- mat.bothSides = true;
9047
- mat.alphaBlending = true;
9048
- mat.useColorTransform = true;
9049
- mat.style.sampler = new _awayjs_stage.ImageSampler(false, true, true);
9222
+ return this.fillTextRunFNT(tf, format, startWord, wordCnt);
9050
9223
  }
9051
- textShape.fntMaterial = useFNT ? mat : null;
9052
- fntTextShapesByChannel[format.color.toString() + useFNT.toString() + '0'] = textShape;
9224
+ var textShape = this._queryShape(tf, format);
9053
9225
  var textShapeSelected;
9054
9226
  var newFormat;
9055
- var wordsCount = startWord + wordCnt * 5;
9227
+ var wordsCount = startWord + wordCnt;
9056
9228
  var size_multiply = this._size_multiply;
9057
9229
  var select_start = tf.selectionBeginIndex;
9058
9230
  var select_end = tf.selectionEndIndex;
@@ -9060,16 +9232,9 @@ var TesselatedFontTable = /** @class */ (function (_super) {
9060
9232
  if (tf.selectable) {
9061
9233
  newFormat = format.clone();
9062
9234
  newFormat.color = 0xffffff;
9063
- textShapeSelected = tf.getTextShapeForIdentifierAndFormat(useFNT.toString() + '0', newFormat);
9064
- fntSelectedTextShapesByChannel[useFNT.toString() + '0'] = textShapeSelected;
9065
- mat = new _awayjs_materials.MethodMaterial(this._fnt_channels[0]);
9066
- mat.bothSides = true;
9067
- mat.alphaBlending = true;
9068
- mat.useColorTransform = true;
9069
- mat.style.sampler = new _awayjs_stage.ImageSampler(false, true, true);
9070
- textShapeSelected.fntMaterial = useFNT ? mat : null;
9235
+ textShapeSelected = this._queryShape(tf, newFormat);
9071
9236
  if (newFormat.underline && (startWord + 1) < tf.words.length) {
9072
- start_x = tf.words[startWord + 1];
9237
+ start_x = tf.words.get(startWord).x;
9073
9238
  }
9074
9239
  if (tf.selectionEndIndex < tf.selectionBeginIndex) {
9075
9240
  select_start = tf.selectionEndIndex;
@@ -9083,66 +9248,39 @@ var TesselatedFontTable = /** @class */ (function (_super) {
9083
9248
  var underlines = [];
9084
9249
  // loop over all the words and create the text data for it
9085
9250
  // each word provides its own start-x and start-y values, so we can just ignore whitespace-here
9086
- for (var w = startWord; w < wordsCount; w += 5) {
9087
- var x = tf.words[w + 1];
9088
- var y = tf.words[w + 2];
9089
- var startIdx = tf.words[w];
9090
- var charsCount = startIdx + tf.words[w + 4];
9251
+ for (var w = startWord; w < wordsCount; w += 1) {
9252
+ var word = tf.words.get(w);
9253
+ var x = word.x;
9254
+ var y = word.y;
9255
+ var startIdx = word.start;
9256
+ var charsCount = startIdx + word.len;
9091
9257
  for (var c = startIdx; c < charsCount; c++) {
9092
9258
  var curTShape = (tf.isInFocus && c >= select_start && c < select_end) ?
9093
9259
  textShapeSelected : textShape;
9094
- if (tf.chars_codes[c] !== 32 && tf.chars_codes[c] !== 9) {
9095
- var charGlyph = this.getChar(tf.chars_codes[c].toString());
9096
- if (!charGlyph) {
9097
- if (once$1(this, 'miss' + tf.chars_codes[c])) {
9098
- console.debug('[TesselatedFontTable] Error: char not found in fontTable', tf.chars_codes[c], String.fromCharCode(tf.chars_codes[c]));
9099
- }
9100
- continue;
9101
- }
9102
- if (useFNT) {
9103
- // the font should use fnt
9104
- var curFormat = curTShape.format;
9105
- var ctmpTShape = (tf.isInFocus && c >= select_start && c < select_end) ?
9106
- fntSelectedTextShapesByChannel[useFNT.toString() + charGlyph.fnt_channel] :
9107
- fntTextShapesByChannel[curFormat.color.toString() +
9108
- useFNT.toString() + charGlyph.fnt_channel];
9109
- if (!ctmpTShape) {
9110
- var newtextShape = tf.getTextShapeForIdentifierAndFormat(curFormat.color.toString()
9111
- + useFNT.toString() + charGlyph.fnt_channel.toString(), curFormat);
9112
- var argb_1 = _awayjs_core.ColorUtils.float32ColorToARGB(curFormat.color);
9113
- var mat_1 = new _awayjs_materials.MethodMaterial(this._fnt_channels[charGlyph.fnt_channel]);
9114
- mat_1.colorTransform = new _awayjs_core.ColorTransform(argb_1[1] / 255, argb_1[2] / 255, argb_1[3] / 255);
9115
- mat_1.bothSides = true;
9116
- mat_1.alphaBlending = true;
9117
- mat_1.useColorTransform = true;
9118
- mat_1.style.sampler = new _awayjs_stage.ImageSampler(false, true, true);
9119
- newtextShape.fntMaterial = mat_1;
9120
- fntTextShapesByChannel[curFormat.color.toString() +
9121
- useFNT.toString() + charGlyph.fnt_channel] = newtextShape;
9122
- ctmpTShape = newtextShape;
9123
- }
9124
- var x1 = x + ((charGlyph.char_width * size_multiply) * charGlyph.fnt_rect.x);
9125
- var x2 = x1 + ((charGlyph.char_width * size_multiply) * charGlyph.fnt_rect.width);
9126
- var y1 = y + ((this._font_em_size * size_multiply) * charGlyph.fnt_rect.y);
9127
- var y2 = y1 + ((this._font_em_size * size_multiply) * charGlyph.fnt_rect.height);
9128
- throw 'Invalid implementation, verts not raw array';
9129
- }
9130
- else {
9131
- if (curTShape === textShapeSelected) {
9132
- selectedCharEntries.push({
9133
- char: charGlyph, x: x, y: y, selected: true
9134
- });
9135
- selectedBuffSize += charGlyph.fill_data.buffer.byteLength / 4;
9136
- }
9137
- else {
9138
- charEntries.push({
9139
- char: charGlyph, x: x, y: y, selected: false
9140
- });
9141
- textBuffSize += charGlyph.fill_data.buffer.byteLength / 4;
9142
- }
9260
+ var code = tf.chars_codes[c];
9261
+ if (code === 32 || code === 9) {
9262
+ continue;
9263
+ }
9264
+ var charGlyph = this.getChar(code, true);
9265
+ if (!charGlyph) {
9266
+ if (once$1(this, 'miss' + tf.chars_codes[c])) {
9267
+ console.debug('[TesselatedFontTable] Error: char not found in fontTable', tf.chars_codes[c], String.fromCharCode(tf.chars_codes[c]));
9143
9268
  }
9144
- x += charGlyph.char_width * size_multiply;
9269
+ continue;
9270
+ }
9271
+ if (curTShape === textShapeSelected) {
9272
+ selectedCharEntries.push({
9273
+ char: charGlyph, x: x, y: y, selected: true
9274
+ });
9275
+ selectedBuffSize += charGlyph.fill_data.buffer.byteLength / 4;
9276
+ }
9277
+ else {
9278
+ charEntries.push({
9279
+ char: charGlyph, x: x, y: y, selected: false
9280
+ });
9281
+ textBuffSize += charGlyph.fill_data.buffer.byteLength / 4;
9145
9282
  }
9283
+ x += charGlyph.char_width * size_multiply;
9146
9284
  }
9147
9285
  var half_thickness = 0.25 * tf.internalScale.y;
9148
9286
  var topY = y + this.getUnderLineHeight() + half_thickness;
@@ -9182,6 +9320,173 @@ var TesselatedFontTable = /** @class */ (function (_super) {
9182
9320
  textShapeSelected.addChunk(buff);
9183
9321
  }
9184
9322
  };
9323
+ TesselatedFontTable.prototype._cacheKey = function (color, channel) {
9324
+ if (color === void 0) { color = 0xffffff; }
9325
+ if (channel === void 0) { channel = -1; }
9326
+ var fnt = channel >= 0;
9327
+ return "" + color + fnt + (fnt ? channel : 0);
9328
+ };
9329
+ /**
9330
+ * Query shape from TextField cache
9331
+ * @param tf
9332
+ * @param format
9333
+ * @param channel - FNT channel, -1 for regular font
9334
+ * @private
9335
+ */
9336
+ TesselatedFontTable.prototype._queryShape = function (tf, format, channel) {
9337
+ if (channel === void 0) { channel = -1; }
9338
+ var textShape = tf.getTextShapeForIdentifierAndFormat(this._cacheKey(format.color, channel), format);
9339
+ if (channel >= 0 && !textShape.fntMaterial) {
9340
+ var argb = _awayjs_core.ColorUtils.float32ColorToARGB(format.color);
9341
+ var mat = new _awayjs_materials.MethodMaterial(this._fnt_channels[channel]);
9342
+ mat.colorTransform = new _awayjs_core.ColorTransform(argb[1] / 255, argb[2] / 255, argb[3] / 255);
9343
+ mat.bothSides = true;
9344
+ mat.alphaBlending = true;
9345
+ mat.useColorTransform = true;
9346
+ mat.style.sampler = new _awayjs_stage.ImageSampler(false, true, true);
9347
+ textShape.fntMaterial = mat;
9348
+ }
9349
+ return textShape;
9350
+ };
9351
+ /**
9352
+ * Fill text run but use FNT Texture.
9353
+ */
9354
+ TesselatedFontTable.prototype.fillTextRunFNT = function (tf, format, startWord, wordCnt) {
9355
+ var textShape = this._queryShape(tf, format, 0);
9356
+ var charShapesCache = {};
9357
+ var charShapesSelectedCache = {};
9358
+ var wordsCount = startWord + wordCnt;
9359
+ var size_multiply = this._size_multiply;
9360
+ var textShapeSelected;
9361
+ var select_start = tf.selectionBeginIndex;
9362
+ var select_end = tf.selectionEndIndex;
9363
+ var start_x = 0;
9364
+ if (tf.selectable) {
9365
+ var newFormat = format.clone();
9366
+ newFormat.color = 0xffffff;
9367
+ textShapeSelected = this._queryShape(tf, newFormat, 0);
9368
+ charShapesSelectedCache[textShapeSelected.cacheId] = textShapeSelected;
9369
+ if (newFormat.underline && (startWord + 1) < tf.words.length) {
9370
+ start_x = tf.words.get(startWord).x;
9371
+ }
9372
+ if (tf.selectionEndIndex < tf.selectionBeginIndex) {
9373
+ select_start = tf.selectionEndIndex;
9374
+ select_end = tf.selectionBeginIndex;
9375
+ }
9376
+ }
9377
+ charShapesCache[textShape.cacheId] = textShape;
9378
+ var shapeArray = new Map();
9379
+ var underlines = [];
9380
+ // loop over all the words and create the text data for it
9381
+ // each word provides its own start-x and start-y values, so we can just ignore whitespace-here
9382
+ for (var w = startWord; w < wordsCount; w += 1) {
9383
+ var word = tf.words.get(w);
9384
+ var x = word.x;
9385
+ var y = word.y;
9386
+ var startIdx = word.start;
9387
+ var charsCount = startIdx + word.len;
9388
+ var preFilledShape = null;
9389
+ var target = null;
9390
+ var color = 0;
9391
+ var fntID = -1;
9392
+ for (var c = startIdx; c < charsCount; c++) {
9393
+ // space codes
9394
+ if (tf.chars_codes[c] === 32 || tf.chars_codes[c] === 9) {
9395
+ continue;
9396
+ }
9397
+ var charGlyph = this.getChar(tf.chars_codes[c], false);
9398
+ if (!charGlyph) {
9399
+ if (once$1(this, 'miss' + tf.chars_codes[c])) {
9400
+ console.debug('[TesselatedFontTable] Error: char not found in fontTable', tf.chars_codes[c], String.fromCharCode(tf.chars_codes[c]));
9401
+ }
9402
+ continue;
9403
+ }
9404
+ var selected = (tf.isInFocus && c >= select_start && c < select_end);
9405
+ var baseShape = textShape;
9406
+ var cacheStore = charShapesCache;
9407
+ if (selected) {
9408
+ baseShape = textShapeSelected;
9409
+ cacheStore = charShapesSelectedCache;
9410
+ }
9411
+ var curFormat = baseShape.format;
9412
+ var cacheId = preFilledShape ? preFilledShape.cacheId : '';
9413
+ if (!cacheId || color !== curFormat.color || charGlyph.fnt_channel !== fntID) {
9414
+ cacheId = this._cacheKey(curFormat.color, charGlyph.fnt_channel);
9415
+ color = curFormat.color;
9416
+ fntID = charGlyph.fnt_channel;
9417
+ }
9418
+ var fntFilledShape = preFilledShape && preFilledShape.cacheId !== cacheId
9419
+ ? cacheStore[cacheId]
9420
+ : preFilledShape;
9421
+ if (!fntFilledShape) {
9422
+ fntFilledShape = this._queryShape(tf, curFormat, charGlyph.fnt_channel);
9423
+ cacheStore[fntFilledShape.cacheId] = fntFilledShape;
9424
+ }
9425
+ if (preFilledShape !== fntFilledShape || !target) {
9426
+ // FNT is very little, has 6 vertices per shape (instead of 300 ++)
9427
+ // fill it directly
9428
+ target = shapeArray.get(fntFilledShape) || {
9429
+ uv: [],
9430
+ pos: []
9431
+ };
9432
+ shapeArray.set(fntFilledShape, target);
9433
+ preFilledShape = fntFilledShape;
9434
+ }
9435
+ this._emitCharFNT(target, charGlyph, x, y);
9436
+ x += charGlyph.char_width * size_multiply;
9437
+ }
9438
+ /*
9439
+ todo Generate underline for regular shape
9440
+
9441
+ const half_thickness: number = 0.25 * tf.internalScale.y;
9442
+ const topY: number = y + this.getUnderLineHeight() + half_thickness;
9443
+ const bottomY: number = y + this.getUnderLineHeight() - half_thickness;
9444
+
9445
+ if (tf.selectable && newFormat.underline && (startWord + 1) < tf.words.length) {
9446
+ const underBuff = new Float32Array(12);
9447
+
9448
+ underBuff[0] = start_x;
9449
+ underBuff[1] = bottomY;
9450
+ underBuff[2] = start_x;
9451
+ underBuff[3] = topY;
9452
+ underBuff[4] = x;
9453
+ underBuff[5] = topY;
9454
+ underBuff[6] = x;
9455
+ underBuff[7] = topY;
9456
+ underBuff[8] = x;
9457
+ underBuff[9] = bottomY;
9458
+ underBuff[10] = start_x;
9459
+ underBuff[11] = bottomY;
9460
+
9461
+ underlines.push(underBuff);
9462
+ }
9463
+ */
9464
+ } // for word
9465
+ // oh, es5... iterating over map won't working
9466
+ var shapes = Array.from(shapeArray.keys());
9467
+ for (var _i = 0, shapes_1 = shapes; _i < shapes_1.length; _i++) {
9468
+ var shape = shapes_1[_i];
9469
+ var values = shapeArray.get(shape);
9470
+ shape.addChunk(new Float32Array(values.pos), new Float32Array(values.uv));
9471
+ }
9472
+ };
9473
+ TesselatedFontTable.prototype._emitCharFNT = function (target, charGlyph, x, y) {
9474
+ var scale = this._size_multiply;
9475
+ var size = this._font_em_size * scale;
9476
+ var rect = charGlyph.fnt_rect;
9477
+ var uv = charGlyph.fnt_uv;
9478
+ var width = charGlyph.char_width * scale;
9479
+ if (!rect) {
9480
+ // empty chars not have data
9481
+ return;
9482
+ }
9483
+ var x1 = x + width * rect.x * 20;
9484
+ var x2 = x1 + width * rect.width * 20;
9485
+ var y1 = y + size * rect.y * 20;
9486
+ var y2 = y1 + size * rect.height * 20;
9487
+ target.pos.push(x1, y1, x1, y2, x2, y1, x2, y1, x1, y2, x2, y2);
9488
+ target.uv.push(uv.x, uv.y, uv.x, uv.bottom, uv.right, uv.y, uv.right, uv.y, uv.x, uv.bottom, uv.right, uv.bottom);
9489
+ };
9185
9490
  TesselatedFontTable.prototype.createPointGlyph_9679 = function () {
9186
9491
  var verts = [];
9187
9492
  _awayjs_graphics.GraphicsFactoryHelper.drawElipse(this._font_em_size / 2, this._font_em_size / 2, this._font_em_size / 8, this._font_em_size / 8, verts, 0, 360, 5, false);
@@ -9195,92 +9500,122 @@ var TesselatedFontTable = /** @class */ (function (_super) {
9195
9500
  this._font_chars_dic['9679'] = t_font_char;
9196
9501
  return t_font_char;
9197
9502
  };
9198
- TesselatedFontTable.prototype.getChar = function (name) {
9199
- var t_font_char = this._font_chars_dic[name];
9200
- if (!t_font_char) {
9503
+ TesselatedFontTable.prototype.getCharOpenType = function (name) {
9504
+ if (!this._opentype_font) {
9505
+ return null;
9506
+ }
9507
+ var thisGlyph = this._opentype_font.charToGlyph(String.fromCharCode(parseInt(name)));
9508
+ if (!thisGlyph) {
9509
+ return null;
9510
+ }
9511
+ //console.log("got the glyph from opentype");
9512
+ var thisPath = thisGlyph.getPath();
9513
+ var awayPath = new _awayjs_graphics.GraphicsPath();
9514
+ var i = 0;
9515
+ var len = thisPath.commands.length;
9516
+ //awayPath.lineTo(0, 0);
9517
+ //awayPath.moveTo(0,0);//-100);
9518
+ //awayPath.curveTo(100, 250, 200,0);
9519
+ //awayPath.lineTo(150, 100);
9520
+ //awayPath.moveTo(0,20);
9521
+ //awayPath.curveTo(100, 270, 200,20);
9522
+ //awayPath.moveTo(0,-20);
9523
+ //awayPath.moveTo(0,-10);
9524
+ //awayPath.curveTo(100, -110, 200,-10);
9525
+ var startx = 0;
9526
+ var starty = 0;
9527
+ var y_offset = this._ascent;
9528
+ //40 = 66
9529
+ var scale = (this._opentype_font.unitsPerEm / 72);
9530
+ for (i = 0; i < len; i++) {
9531
+ var cmd = thisPath.commands[i];
9532
+ //console.log("cmd", cmd.type, cmd.x, cmd.y, cmd.x1, cmd.y1, cmd.x2, cmd.y2);
9533
+ if (cmd.type === 'M') {
9534
+ awayPath.moveTo(scale * cmd.x, scale * cmd.y + y_offset);
9535
+ startx = scale * cmd.x;
9536
+ starty = scale * cmd.y + y_offset;
9537
+ }
9538
+ else if (cmd.type === 'L') {
9539
+ awayPath.lineTo(scale * cmd.x, scale * cmd.y + y_offset);
9540
+ }
9541
+ else if (cmd.type === 'Q') {
9542
+ awayPath.curveTo(scale * cmd.x1, scale * cmd.y1 + y_offset, scale * cmd.x, scale * cmd.y + y_offset);
9543
+ }
9544
+ else if (cmd.type === 'C') {
9545
+ var mergedX = cmd.x1 + (cmd.x2 - cmd.x1) / 2;
9546
+ var mergedY = cmd.y1 + (cmd.y2 - cmd.y1) / 2;
9547
+ awayPath.curveTo(scale * cmd.x1, scale * cmd.y1 + y_offset, scale * mergedX, scale * mergedY + y_offset);
9548
+ awayPath.curveTo(scale * cmd.x2, scale * cmd.y2 + y_offset, scale * cmd.x, scale * cmd.y + y_offset);
9549
+ }
9550
+ else if (cmd.type === 'Z') {
9551
+ awayPath.lineTo(startx, starty);
9552
+ }
9553
+ }
9554
+ var t_font_char = new TesselatedFontChar(null, null, awayPath);
9555
+ t_font_char.char_width = thisGlyph.advanceWidth; //(1 / thisGlyph.path.unitsPerEm * 72);
9556
+ t_font_char.fill_data = _awayjs_graphics.GraphicsFactoryFills.pathToAttributesBuffer(awayPath, true, null, scale * Settings.FONT_TESSELATION_QUALITY);
9557
+ t_font_char.lastTesselatedScale = scale;
9558
+ if (!t_font_char.fill_data) {
9559
+ if (once$1(this, 'tess' + name)) {
9560
+ console.debug('[TesselatedFontTable] Error:tesselating opentype glyph:', name.charCodeAt(0));
9561
+ }
9562
+ return null;
9563
+ }
9564
+ this._font_chars.push(t_font_char);
9565
+ this._font_chars_dic[name] = t_font_char;
9566
+ };
9567
+ TesselatedFontTable.prototype.getChar = function (name, tesselation) {
9568
+ if (tesselation === void 0) { tesselation = true; }
9569
+ name = '' + name;
9570
+ var fontChar = this._font_chars_dic[name];
9571
+ if (!tesselation && fontChar) {
9572
+ return fontChar;
9573
+ }
9574
+ if (!fontChar) {
9201
9575
  if (this._opentype_font) {
9202
- var thisGlyph = this._opentype_font.charToGlyph(String.fromCharCode(parseInt(name)));
9203
- if (thisGlyph) {
9204
- //console.log("got the glyph from opentype");
9205
- var thisPath = thisGlyph.getPath();
9206
- var awayPath = new _awayjs_graphics.GraphicsPath();
9207
- var i = 0;
9208
- var len = thisPath.commands.length;
9209
- //awayPath.lineTo(0, 0);
9210
- //awayPath.moveTo(0,0);//-100);
9211
- //awayPath.curveTo(100, 250, 200,0);
9212
- //awayPath.lineTo(150, 100);
9213
- //awayPath.moveTo(0,20);
9214
- //awayPath.curveTo(100, 270, 200,20);
9215
- //awayPath.moveTo(0,-20);
9216
- //awayPath.moveTo(0,-10);
9217
- //awayPath.curveTo(100, -110, 200,-10);
9218
- var startx = 0;
9219
- var starty = 0;
9220
- var y_offset = this._ascent;
9221
- //40 = 66
9222
- var scale = (this._opentype_font.unitsPerEm / 72);
9223
- for (i = 0; i < len; i++) {
9224
- var cmd = thisPath.commands[i];
9225
- //console.log("cmd", cmd.type, cmd.x, cmd.y, cmd.x1, cmd.y1, cmd.x2, cmd.y2);
9226
- if (cmd.type === 'M') {
9227
- awayPath.moveTo(scale * cmd.x, scale * cmd.y + y_offset);
9228
- startx = scale * cmd.x;
9229
- starty = scale * cmd.y + y_offset;
9230
- }
9231
- else if (cmd.type === 'L') {
9232
- awayPath.lineTo(scale * cmd.x, scale * cmd.y + y_offset);
9233
- }
9234
- else if (cmd.type === 'Q') {
9235
- awayPath.curveTo(scale * cmd.x1, scale * cmd.y1 + y_offset, scale * cmd.x, scale * cmd.y + y_offset);
9236
- }
9237
- else if (cmd.type === 'C') {
9238
- var mergedX = cmd.x1 + (cmd.x2 - cmd.x1) / 2;
9239
- var mergedY = cmd.y1 + (cmd.y2 - cmd.y1) / 2;
9240
- awayPath.curveTo(scale * cmd.x1, scale * cmd.y1 + y_offset, scale * mergedX, scale * mergedY + y_offset);
9241
- awayPath.curveTo(scale * cmd.x2, scale * cmd.y2 + y_offset, scale * cmd.x, scale * cmd.y + y_offset);
9242
- }
9243
- else if (cmd.type === 'Z') {
9244
- awayPath.lineTo(startx, starty);
9245
- }
9246
- }
9247
- t_font_char = new TesselatedFontChar(null, null, awayPath);
9248
- t_font_char.char_width = thisGlyph.advanceWidth; //(1 / thisGlyph.path.unitsPerEm * 72);
9249
- t_font_char.fill_data = _awayjs_graphics.GraphicsFactoryFills.pathToAttributesBuffer(awayPath, true);
9250
- if (!t_font_char.fill_data) {
9251
- if (once$1(this, 'tess' + name)) {
9252
- console.debug('[TesselatedFontTable] Error:tesselating opentype glyph:', name.charCodeAt(0));
9253
- }
9254
- return null;
9255
- }
9256
- this._font_chars.push(t_font_char);
9257
- this._font_chars_dic[name] = t_font_char;
9258
- }
9576
+ return this.getCharOpenType(name);
9259
9577
  }
9260
9578
  if (name == '9679') {
9261
- t_font_char = this.createPointGlyph_9679();
9262
- }
9263
- }
9264
- else if (t_font_char.fill_data == null &&
9265
- t_font_char.stroke_data == null && t_font_char.fill_data_path != null) {
9266
- // hack for messed up "X": remove the first command if it is moveTo that points to 0,0
9267
- // change the new first command to moveTo
9268
- if (t_font_char.fill_data_path.commands[0][0] == 1 &&
9269
- t_font_char.fill_data_path.data[0][0] == 0 && t_font_char.fill_data_path.data[0][1] == 0) {
9270
- t_font_char.fill_data_path.data[0].shift();
9271
- t_font_char.fill_data_path.data[0].shift();
9272
- t_font_char.fill_data_path.commands[0].shift();
9273
- t_font_char.fill_data_path.commands[0][0] = 2;
9274
- }
9275
- t_font_char.fill_data = _awayjs_graphics.GraphicsFactoryFills.pathToAttributesBuffer(t_font_char.fill_data_path, true);
9276
- if (!t_font_char.fill_data) {
9277
- if (once$1(this, 'tess' + name)) {
9278
- console.debug('[TesselatedFontTable] Error:tesselating glyph:', name.charCodeAt(0));
9279
- }
9280
- return null;
9579
+ return this.createPointGlyph_9679();
9281
9580
  }
9581
+ return null;
9282
9582
  }
9283
- return t_font_char;
9583
+ // tesselation pass
9584
+ var scale = this._size_multiply;
9585
+ var qualityStepScale = Math.max(0.01, Math.round(scale * 100) / 100);
9586
+ if (fontChar.fill_data_path === null) {
9587
+ return null;
9588
+ }
9589
+ // we already has buffer with tesselation scale ratio
9590
+ if (!(fontChar.fill_data == null && fontChar.stroke_data == null)
9591
+ && fontChar.lastTesselatedScale >= qualityStepScale) {
9592
+ return fontChar;
9593
+ }
9594
+ var path = fontChar.fill_data_path;
9595
+ // hack for messed up "X": remove the first command if it is moveTo that points to 0,0
9596
+ // change the new first command to moveTo
9597
+ if (path.commands[0][0] == 1 && path.data[0][0] == 0 && path.data[0][1] == 0) {
9598
+ path.data[0].shift();
9599
+ path.data[0].shift();
9600
+ path.commands[0].shift();
9601
+ path.commands[0][0] = 2;
9602
+ }
9603
+ if (fontChar.fill_data) {
9604
+ // it not have dispose, but clear will drop abstraction if it exist
9605
+ fontChar.fill_data.clear();
9606
+ }
9607
+ fontChar.fill_data = _awayjs_graphics.GraphicsFactoryFills.pathToAttributesBuffer(fontChar.fill_data_path, true, null, qualityStepScale * Settings.FONT_TESSELATION_QUALITY);
9608
+ if (fontChar.lastTesselatedScale > 0) {
9609
+ console.debug('[TesselatedFontTable] Retesselate char from scale:', fontChar.lastTesselatedScale, qualityStepScale, String.fromCharCode(+name));
9610
+ }
9611
+ fontChar.lastTesselatedScale = qualityStepScale;
9612
+ if (!fontChar.fill_data) {
9613
+ if (once$1(this, 'tess' + name)) {
9614
+ console.debug('[TesselatedFontTable] Error:tesselating glyph:', name.charCodeAt(0));
9615
+ }
9616
+ return null;
9617
+ }
9618
+ return fontChar;
9284
9619
  };
9285
9620
  TesselatedFontTable.prototype.setChar = function (name, char_width, fills_data, stroke_data, uses_curves, glyph_idx, fill_data_path) {
9286
9621
  if (fills_data === void 0) { fills_data = null; }
@@ -9308,6 +9643,11 @@ var TesselatedFontTable = /** @class */ (function (_super) {
9308
9643
  this._font_chars.push(t_font_char);
9309
9644
  this._font_chars_dic[name] = t_font_char;
9310
9645
  };
9646
+ TesselatedFontTable.prototype.roundTo = function (val) {
9647
+ var p = Settings.TEXT_SHAPE_ROUND_PRECISION;
9648
+ var invP = 1 / (p || 1);
9649
+ return Math.floor(val * invP) * p;
9650
+ };
9311
9651
  TesselatedFontTable.prototype._fillBuffer = function (buffer, chars, selection) {
9312
9652
  if (selection === void 0) { selection = false; }
9313
9653
  var scale = this._size_multiply;
@@ -9321,8 +9661,8 @@ var TesselatedFontTable = /** @class */ (function (_super) {
9321
9661
  var view = new Float32Array(char.fill_data.buffer);
9322
9662
  var count = view.length;
9323
9663
  for (var v = 0; v < count; v += 2) {
9324
- buffer[offset + v + 0] = view[v + 0] * scale + x;
9325
- buffer[offset + v + 1] = view[v + 1] * scale + y;
9664
+ buffer[offset + v + 0] = this.roundTo(view[v + 0] * scale + x);
9665
+ buffer[offset + v + 1] = this.roundTo(view[v + 1] * scale + y);
9326
9666
  }
9327
9667
  offset += view.length;
9328
9668
  }
@@ -10424,10 +10764,14 @@ var TextSprite = /** @class */ (function (_super) {
10424
10764
  }(Sprite));
10425
10765
 
10426
10766
  var TextShape = /** @class */ (function () {
10427
- function TextShape() {
10767
+ function TextShape(format, cacheId) {
10768
+ this.format = format;
10769
+ this.cacheId = cacheId;
10428
10770
  this.verts = [];
10771
+ this.uvs = [];
10429
10772
  this._length = 0;
10430
10773
  this.verts = [];
10774
+ this.uvs = [];
10431
10775
  }
10432
10776
  Object.defineProperty(TextShape.prototype, "length", {
10433
10777
  get: function () {
@@ -10438,9 +10782,11 @@ var TextShape = /** @class */ (function () {
10438
10782
  return;
10439
10783
  }
10440
10784
  var verts = this.verts;
10785
+ var uvs = this.uvs;
10441
10786
  if (val === 0) {
10442
10787
  this._length = 0;
10443
10788
  verts.length = 0;
10789
+ uvs.length = 0;
10444
10790
  return;
10445
10791
  }
10446
10792
  var index = 0;
@@ -10452,6 +10798,9 @@ var TextShape = /** @class */ (function () {
10452
10798
  if (size < 0) {
10453
10799
  // resize buffer
10454
10800
  verts[index - 1] = verts[index - 1].subarray(0, size + verts[index - 1].length);
10801
+ if (uvs[index - 1]) {
10802
+ uvs[index - 1] = uvs[index - 1].subarray(0, size + uvs[index - 1].length);
10803
+ }
10455
10804
  }
10456
10805
  verts.length = index;
10457
10806
  this._length = val;
@@ -10459,9 +10808,25 @@ var TextShape = /** @class */ (function () {
10459
10808
  enumerable: true,
10460
10809
  configurable: true
10461
10810
  });
10462
- TextShape.prototype.addChunk = function (buffer) {
10811
+ Object.defineProperty(TextShape.prototype, "hasUV", {
10812
+ get: function () {
10813
+ return this.uvs.length > 0;
10814
+ },
10815
+ enumerable: true,
10816
+ configurable: true
10817
+ });
10818
+ TextShape.prototype.addChunk = function (buffer, uvs) {
10819
+ if (this.verts.length !== this.uvs.length && uvs) {
10820
+ throw 'You can\'t mix TextShape with UV and without in same place';
10821
+ }
10822
+ if (uvs && buffer.length !== uvs.length) {
10823
+ throw 'Position buffer and UV buffer should has equal size';
10824
+ }
10463
10825
  this._length += buffer.length;
10464
10826
  this.verts.push(buffer);
10827
+ if (uvs) {
10828
+ this.uvs.push(uvs);
10829
+ }
10465
10830
  };
10466
10831
  Object.defineProperty(TextShape.prototype, "tall", {
10467
10832
  get: function () {
@@ -10895,6 +11260,53 @@ var HTMLTextProcessor = /** @class */ (function () {
10895
11260
  return HTMLTextProcessor;
10896
11261
  }());
10897
11262
 
11263
+ var WordStore = /** @class */ (function () {
11264
+ function WordStore(size) {
11265
+ if (size === void 0) { size = 40; }
11266
+ this.index = -1;
11267
+ this.store = Array.from({ length: size }, function (e) { return ({
11268
+ x: Infinity, y: Infinity, start: 0, width: 0, len: 0
11269
+ }); });
11270
+ }
11271
+ WordStore.prototype.put = function (start, x, y, width, len) {
11272
+ this.index++;
11273
+ var word = this.store[this.index] || (this.store[this.index] = {});
11274
+ word.start = start;
11275
+ word.x = x;
11276
+ word.y = y;
11277
+ word.width = width;
11278
+ word.len = len;
11279
+ return word;
11280
+ };
11281
+ Object.defineProperty(WordStore.prototype, "last", {
11282
+ get: function () {
11283
+ return this.store[this.index];
11284
+ },
11285
+ enumerable: true,
11286
+ configurable: true
11287
+ });
11288
+ Object.defineProperty(WordStore.prototype, "length", {
11289
+ get: function () {
11290
+ return this.index + 1;
11291
+ },
11292
+ set: function (v) {
11293
+ this.index = v - 1;
11294
+ },
11295
+ enumerable: true,
11296
+ configurable: true
11297
+ });
11298
+ WordStore.prototype.get = function (index) {
11299
+ return this.store[index];
11300
+ };
11301
+ WordStore.prototype.free = function () {
11302
+ this.index = -1;
11303
+ };
11304
+ WordStore.prototype.dispose = function () {
11305
+ this.store = null;
11306
+ this.index = 0;
11307
+ };
11308
+ return WordStore;
11309
+ }());
10898
11310
  var MNEMOS = [
10899
11311
  {
10900
11312
  test: /&apos;/g,
@@ -11002,7 +11414,20 @@ var TextField = /** @class */ (function (_super) {
11002
11414
  _this._selectionBeginIndex = 0;
11003
11415
  _this._selectionEndIndex = 0;
11004
11416
  _this._biggestLine = 0;
11417
+ /**
11418
+ * Renderable text, used for computing a glyphs
11419
+ * @private
11420
+ */
11005
11421
  _this._iText = '';
11422
+ /**
11423
+ * Place where is diff is begun to end
11424
+ * @private
11425
+ */
11426
+ _this._iTextDiffStart = 0;
11427
+ /**
11428
+ * Original text passed to field
11429
+ * @private
11430
+ */
11006
11431
  _this._text = '';
11007
11432
  _this._iTextWoLineBreaks = ''; // _iText without line breaks
11008
11433
  _this.inMaskMode = false;
@@ -11015,16 +11440,13 @@ var TextField = /** @class */ (function (_super) {
11015
11440
  _this._shapesDirty = false;
11016
11441
  _this._textShapesDirty = false;
11017
11442
  _this.chars_codes = [];
11018
- _this.chars_codes_prev = [];
11019
11443
  _this.chars_width = [];
11020
11444
  _this.tf_per_char = [];
11021
- _this.tf_per_char_prev = [];
11022
- // we use that for text appending to save verts count before last word verts are added to textShape.
11023
- // Then on text append we clear last word verts because the word may be wrapped to next line
11024
- _this.last_word_vertices_count = 0;
11025
- _this.words = []; // stores offset and length and width for each word
11445
+ // stores offset and length and width for each word
11446
+ _this.words = new WordStore(10);
11026
11447
  _this._textRuns_formats = []; // stores textFormat for each textrun
11027
- _this._textRuns_words = []; // stores words-offset, word-count and width for each textrun
11448
+ // stores words-offset, word-count and width for each textrun
11449
+ _this._textRuns_words = [];
11028
11450
  _this._paragraph_textRuns_indices = []; // stores textFormat for each textrun
11029
11451
  _this._maxWidthLine = 0;
11030
11452
  _this._labelData = null;
@@ -11445,12 +11867,10 @@ var TextField = /** @class */ (function (_super) {
11445
11867
  this._graphics.endFill();
11446
11868
  };
11447
11869
  TextField.prototype.getTextShapeForIdentifierAndFormat = function (id, format) {
11448
- if (this.textShapes.hasOwnProperty(id)) {
11870
+ if (this.textShapes[id]) {
11449
11871
  return this.textShapes[id];
11450
11872
  }
11451
- this.textShapes[id] = new TextShape();
11452
- this.textShapes[id].format = format;
11453
- return this.textShapes[id];
11873
+ return (this.textShapes[id] = new TextShape(format, id));
11454
11874
  };
11455
11875
  Object.defineProperty(TextField.prototype, "autoSize", {
11456
11876
  get: function () {
@@ -11819,14 +12239,19 @@ var TextField = /** @class */ (function (_super) {
11819
12239
  return this._scrollV;
11820
12240
  },
11821
12241
  set: function (value) {
11822
- if (Math.floor(value) == this._scrollV)
12242
+ var rounded = Math.round(value);
12243
+ if (rounded === this._scrollV)
11823
12244
  return;
11824
- this._scrollV = Math.floor(value);
12245
+ this._scrollV = rounded;
11825
12246
  if (this._scrollV > this._maxScrollV)
11826
12247
  this._scrollV = this._maxScrollV;
12248
+ if (this._scrollV <= 0) {
12249
+ this._scrollV = 0;
12250
+ }
11827
12251
  if (!this.textChild) {
11828
12252
  return;
11829
12253
  }
12254
+ // unsafe
11830
12255
  this.textChild.y = -this.lines_start_y[this._scrollV];
11831
12256
  },
11832
12257
  enumerable: true,
@@ -11902,12 +12327,6 @@ var TextField = /** @class */ (function (_super) {
11902
12327
  return;
11903
12328
  this._labelData = null;
11904
12329
  this._text = value;
11905
- /*
11906
- for (let i = 0; i < this._text.length; i++) {
11907
- const charCode = this._text.charCodeAt(i);
11908
- if (this._text)
11909
- console.log("charcodes", this._text[i], this._text.charCodeAt(i));
11910
- }*/
11911
12330
  if (value != '' && ((value.charCodeAt(value.length - 1) == 13) || (value.charCodeAt(value.length - 1) == 10))) {
11912
12331
  value = value.slice(0, value.length - 1);
11913
12332
  }
@@ -12264,6 +12683,7 @@ var TextField = /** @class */ (function (_super) {
12264
12683
  if (this._labelData) {
12265
12684
  this._labelData = null;
12266
12685
  }
12686
+ this._resetParagraph();
12267
12687
  this._clearTextShapes();
12268
12688
  this._textFormat = null;
12269
12689
  };
@@ -12287,20 +12707,10 @@ var TextField = /** @class */ (function (_super) {
12287
12707
  // a whitespace is considered as a word
12288
12708
  if (this._textDirty) {
12289
12709
  this._positionsDirty = true;
12290
- this.chars_codes_prev = Array.from(this.chars_codes);
12291
- this.tf_per_char_prev = Array.from(this.tf_per_char);
12292
- // we do not use last word since last word may changed.
12293
- // For example "Hello w" and "Hello world" both have 3 words but the last word actually changed
12294
- this._words_amount_prev = this.words.length;
12295
- this.chars_codes.length = 0;
12296
- this.chars_width.length = 0;
12710
+ this._lastWordsCount = this.words.length;
12297
12711
  this.char_positions_x.length = 0;
12298
12712
  this.char_positions_y.length = 0;
12299
- this.tf_per_char.length = 0;
12300
12713
  this.words.length = 0;
12301
- this._textRuns_words.length = 0;
12302
- this._textRuns_formats.length = 0;
12303
- this._paragraph_textRuns_indices.length = 0;
12304
12714
  this.lines_wordStartIndices.length = 0;
12305
12715
  this.lines_wordEndIndices.length = 0;
12306
12716
  this.lines_start_y.length = 0;
@@ -12317,10 +12727,7 @@ var TextField = /** @class */ (function (_super) {
12317
12727
  // todo: cleanup usage of _textFormats vs _textFormats
12318
12728
  if (!this._textFormat && this._textFormats.length > 0)
12319
12729
  this._textFormat = this._textFormats[0];
12320
- if (this._iText != '' && this._textFormat != null) {
12321
- //console.log("textlength", this.text.toString().length, this.text.toString());
12322
- this.buildParagraphs();
12323
- }
12730
+ this.buildParagraphs();
12324
12731
  //console.log("TextField buildParagraph", this.id, this._iText);
12325
12732
  //console.log("TextField buildParagraph", this.id, this._autoSize);
12326
12733
  //console.log("TextField buildParagraph", this.id, this._wordWrap);
@@ -12366,18 +12773,6 @@ var TextField = /** @class */ (function (_super) {
12366
12773
  // in this step, the text-shapes are cleared,
12367
12774
  // the data for new text-shapes is collected from the font-tables
12368
12775
  // and the new text-shapes are created and assigned to the graphics
12369
- if (this._textShapesDirty) {
12370
- // do nothing
12371
- }
12372
- else if (this.chars_codes_prev.length == 0) {
12373
- // do nothing
12374
- }
12375
- else if (this.chars_codes_prev.length > this.chars_codes.length) {
12376
- this._textShapesDirty = true;
12377
- }
12378
- else if (this.chars_codes_prev[0] !== this.chars_codes[0]) {
12379
- this._textShapesDirty = true;
12380
- }
12381
12776
  if (this._glyphsDirty) {
12382
12777
  //console.log("TextField buildGlyphs", this.id, this.words);
12383
12778
  if (this._labelData) {
@@ -12419,14 +12814,66 @@ var TextField = /** @class */ (function (_super) {
12419
12814
  }
12420
12815
  this.text = paste;
12421
12816
  };
12817
+ TextField.prototype._resetParagraph = function () {
12818
+ this._textShapesDirty = this._textShapesDirty || this.chars_codes.length > 0;
12819
+ this.tf_per_char.length = 0;
12820
+ this.chars_width.length = 0;
12821
+ this.chars_codes.length = 0;
12822
+ this._paragraph_textRuns_indices.length = 0;
12823
+ this._textRuns_formats.length = 0;
12824
+ this._textRuns_words.length = 0;
12825
+ };
12422
12826
  TextField.prototype.buildParagraphs = function () {
12423
- var thisText = this._iText.toString();
12424
- var f_len = this._textFormatsIdx.length;
12827
+ if (!this._textDirty) {
12828
+ return;
12829
+ }
12830
+ // clear paragraph data when clear
12831
+ if (this._iText === '' || !this._textFormat) {
12832
+ this._resetParagraph();
12833
+ return;
12834
+ }
12835
+ var paragraphIndex = 0;
12836
+ var formatIndex = 0;
12837
+ var wordIndex = 0;
12838
+ var charCodeIndex = 0;
12839
+ // track char mutations between new and older.
12840
+ var codeChanges = 0;
12425
12841
  var linewidth = 0;
12426
12842
  var c_start = 0;
12427
- this._paragraph_textRuns_indices[this._paragraph_textRuns_indices.length] = this._textRuns_formats.length;
12843
+ var thisText = this._iText;
12844
+ var formatsCount = this._textFormatsIdx.length;
12845
+ var paragraphIndices = this._paragraph_textRuns_indices;
12846
+ var textRunFormats = this._textRuns_formats;
12847
+ var textRunWords = this._textRuns_words;
12848
+ var charCodes = this.chars_codes;
12849
+ var charTextFormats = this.tf_per_char;
12850
+ var charWidths = this.chars_width;
12851
+ var pushParagraph = function (formatIndex) {
12852
+ paragraphIndices[paragraphIndex] = formatIndex;
12853
+ paragraphIndex++;
12854
+ };
12855
+ var pushFormat = function (format, updateParagraph) {
12856
+ if (updateParagraph === void 0) { updateParagraph = false; }
12857
+ updateParagraph && pushParagraph(formatIndex);
12858
+ textRunFormats[formatIndex++] = format;
12859
+ return format;
12860
+ };
12861
+ var pushRunEntry = function (word) {
12862
+ textRunWords[wordIndex++] = word;
12863
+ return word;
12864
+ };
12865
+ var pushCharData = function (code, tf, width) {
12866
+ codeChanges += +(code !== charCodes[charCodeIndex]);
12867
+ codeChanges += +(tf !== charTextFormats[charCodeIndex]);
12868
+ codeChanges += +(width !== charWidths[charCodeIndex]);
12869
+ charCodes[charCodeIndex] = code;
12870
+ charTextFormats[charCodeIndex] = tf;
12871
+ charWidths[charCodeIndex] = width;
12872
+ charCodeIndex++;
12873
+ };
12874
+ pushParagraph(formatIndex);
12428
12875
  // loop over all textFormats
12429
- for (var f = 0; f < f_len; f++) {
12876
+ for (var f = 0; f < formatsCount; f++) {
12430
12877
  var word_cnt = 0;
12431
12878
  var whitespace_cnt = 0;
12432
12879
  var startNewWord = true;
@@ -12434,11 +12881,16 @@ var TextField = /** @class */ (function (_super) {
12434
12881
  var maxLineWidth = this._width - (tf.indent + tf.leftMargin + tf.rightMargin);
12435
12882
  tf.font_table.initFontSize(tf.size);
12436
12883
  // if that is last format then it goes till the end of text:
12437
- var c_end = (f === f_len - 1) ? thisText.length : this._textFormatsIdx[f];
12884
+ var c_end = (f === formatsCount - 1) ? thisText.length : this._textFormatsIdx[f];
12438
12885
  if (c_end > c_start) {
12439
12886
  // create a new textrun
12440
- this._textRuns_formats[this._textRuns_formats.length] = tf;
12441
- this._textRuns_words[this._textRuns_words.length] = this.words.length;
12887
+ pushFormat(tf);
12888
+ var run = pushRunEntry({
12889
+ start: this.words.length,
12890
+ count: 0,
12891
+ width: 0,
12892
+ space: 0
12893
+ });
12442
12894
  // loop over all chars for this format
12443
12895
  //console.log("textrun tf = ", tf);
12444
12896
  for (var c = c_start; c < c_end; c++) {
@@ -12462,17 +12914,17 @@ var TextField = /** @class */ (function (_super) {
12462
12914
  }
12463
12915
  var isLineBreak = char_code === 10;
12464
12916
  if (isLineBreak) {
12465
- this._textRuns_words[this._textRuns_words.length] = word_cnt;
12466
- this._textRuns_words[this._textRuns_words.length] = linewidth;
12467
- this._textRuns_words[this._textRuns_words.length] = whitespace_cnt;
12468
- this._paragraph_textRuns_indices[this._paragraph_textRuns_indices.length] =
12469
- this._textRuns_formats.length;
12917
+ run.count = word_cnt;
12918
+ run.width = linewidth;
12919
+ run.space = whitespace_cnt;
12470
12920
  // create a new textrun
12471
- this._textRuns_formats[this._textRuns_formats.length] = tf;
12472
- this._textRuns_words[this._textRuns_words.length] = this.words.length;
12473
- // this.chars_codes[this.chars_codes.length] = 55;
12474
- // this.chars_width[this.chars_width.length] = 0;
12475
- // this.tf_per_char[this.tf_per_char.length] = tf;
12921
+ pushFormat(tf, true);
12922
+ run = pushRunEntry({
12923
+ start: this.words.length,
12924
+ count: 0,
12925
+ width: 0,
12926
+ space: 0
12927
+ });
12476
12928
  startNewWord = true;
12477
12929
  whitespace_cnt = 0;
12478
12930
  word_cnt = 0;
@@ -12482,8 +12934,6 @@ var TextField = /** @class */ (function (_super) {
12482
12934
  linewidth = 0;
12483
12935
  continue;
12484
12936
  }
12485
- this.chars_codes[this.chars_codes.length] = char_code;
12486
- this.tf_per_char[this.tf_per_char.length] = tf;
12487
12937
  var char_width = tf.font_table.getCharWidth(char_code.toString());
12488
12938
  var isSpace = char_code == 9 /* TAB */ || char_code == 32;
12489
12939
  // if this is a letter, and next char is no whitespace, we add the letterSpacing to the letter-width
@@ -12494,7 +12944,7 @@ var TextField = /** @class */ (function (_super) {
12494
12944
  }
12495
12945
  }
12496
12946
  linewidth += char_width;
12497
- this.chars_width[this.chars_width.length] = char_width;
12947
+ pushCharData(char_code, tf, char_width);
12498
12948
  // we create a new word if the char is either:
12499
12949
  // - first char of paragraph
12500
12950
  // - is a whitespace
@@ -12502,69 +12952,51 @@ var TextField = /** @class */ (function (_super) {
12502
12952
  if (isSpace) {
12503
12953
  //console.log("add WhiteSpace");
12504
12954
  whitespace_cnt++;
12505
- this.words[this.words.length] = this.chars_codes.length - 1; // index into chars
12506
- this.words[this.words.length] = 0; // x-position
12507
- this.words[this.words.length] = 0; // y-position
12508
- this.words[this.words.length] = char_width; // word width
12509
- this.words[this.words.length] = 1; // char count
12955
+ this.words.put(charCodeIndex - 1, 0, 0, char_width, 1);
12510
12956
  word_cnt++;
12511
12957
  // we also make sure to begin a new word for next char (could be whitespace again)
12512
12958
  startNewWord = true;
12513
12959
  }
12514
12960
  else {
12515
12961
  // no whitespace
12516
- if (this._autoSize == TextFieldAutoSize.NONE && this._wordWrap) {
12517
- if (this.words[this.words.length - 2] + char_width >= maxLineWidth) {
12962
+ if (word_cnt > 0 && this._autoSize == TextFieldAutoSize.NONE && this._wordWrap) {
12963
+ if (this.words.last.width + char_width >= maxLineWidth) {
12518
12964
  startNewWord = true;
12519
12965
  }
12520
12966
  }
12521
12967
  if (startNewWord) {
12522
12968
  //console.log("startNewWord");
12523
12969
  // create new word (either this is the first char, or the last char was whitespace)
12524
- this.words[this.words.length] = this.chars_codes.length - 1; // index into chars
12525
- this.words[this.words.length] = 0; // x-position
12526
- this.words[this.words.length] = 0; // y-position
12527
- this.words[this.words.length] = char_width; // word width
12528
- this.words[this.words.length] = 1; // char count
12970
+ this.words.put(charCodeIndex - 1, 0, 0, char_width, 1);
12529
12971
  word_cnt++;
12530
12972
  }
12531
12973
  else {
12532
12974
  // update-char length and width of active word.
12533
- this.words[this.words.length - 2] += char_width;
12534
- this.words[this.words.length - 1]++;
12975
+ this.words.last.width += char_width;
12976
+ this.words.last.len += 1;
12535
12977
  }
12536
12978
  startNewWord = false;
12537
12979
  }
12538
12980
  }
12539
- this._textRuns_words[this._textRuns_words.length] = word_cnt;
12540
- this._textRuns_words[this._textRuns_words.length] = linewidth;
12541
- this._textRuns_words[this._textRuns_words.length] = whitespace_cnt;
12981
+ run.count = word_cnt;
12982
+ run.width = linewidth;
12983
+ run.space = whitespace_cnt;
12542
12984
  if (this._maxWidthLine < linewidth) {
12543
12985
  this._maxWidthLine = linewidth;
12544
12986
  }
12545
12987
  }
12546
12988
  c_start = c_end;
12547
12989
  }
12548
- // run through all the chars to check if new text is just old text with some data appended
12549
- if (this.chars_codes_prev.length == 0) {
12550
- return;
12551
- }
12552
- else if (this.chars_codes_prev[0] !== this.chars_codes[0]) {
12553
- this._textShapesDirty = true;
12554
- return;
12555
- }
12556
- for (var c = this.chars_codes.length - 1; c >= 0; c--) {
12557
- var char_code = this.chars_codes[c];
12558
- var tf = this.tf_per_char_prev[c];
12559
- if (
12560
- // this.chars_codes_prev.length <= this.chars_codes.length &&
12561
- this.chars_codes_prev[c] &&
12562
- (this.chars_codes_prev[c] != char_code
12563
- || this.tf_per_char_prev[c]._style_name != tf._style_name)) {
12564
- this._textShapesDirty = true;
12565
- break;
12566
- }
12567
- }
12990
+ this._textShapesDirty = (this._textShapesDirty ||
12991
+ codeChanges > 0 ||
12992
+ charCodes.length !== charCodeIndex);
12993
+ // reduce paragraph count if will be greater that older
12994
+ paragraphIndices.length = paragraphIndex;
12995
+ textRunWords.length = wordIndex;
12996
+ textRunFormats.length = formatIndex;
12997
+ charCodes.length = charCodeIndex;
12998
+ charTextFormats.length = charCodeIndex;
12999
+ charWidths.length = charCodeIndex;
12568
13000
  };
12569
13001
  TextField.prototype.adjustPositionForAutoSize = function (newWidth) {
12570
13002
  var oldSize = this._width;
@@ -12635,12 +13067,12 @@ var TextField = /** @class */ (function (_super) {
12635
13067
  lines_heights[lines_heights.length - 1] = format.font_table.getLineHeight() + format.leading;
12636
13068
  }
12637
13069
  //console.log("process word positions for textrun", tr, "textruns", this._textRuns_words);
12638
- w_len = this._textRuns_words[(tr * 4)] + (this._textRuns_words[(tr * 4) + 1] * 5);
12639
- tr_length += this._textRuns_words[(tr * 4) + 2];
13070
+ w_len = this._textRuns_words[tr].start + this._textRuns_words[tr].count;
13071
+ tr_length += this._textRuns_words[tr].width;
12640
13072
  //console.log(this._textFieldWidth, tr_length, maxLineWidth);
12641
13073
  }
12642
13074
  this.lines_wordStartIndices[this.lines_wordStartIndices.length]
12643
- = this._textRuns_words[(this._paragraph_textRuns_indices[p] * 4)];
13075
+ = this._textRuns_words[this._paragraph_textRuns_indices[p]].start;
12644
13076
  this.lines_wordEndIndices[this.lines_wordEndIndices.length] = w_len;
12645
13077
  this.lines_width[this.lines_width.length] = 0;
12646
13078
  this.lines_numSpacesPerline[this.lines_numSpacesPerline.length] = 0;
@@ -12651,18 +13083,19 @@ var TextField = /** @class */ (function (_super) {
12651
13083
  format = this._textRuns_formats[tr];
12652
13084
  format.font_table.initFontSize(format.size);
12653
13085
  indent = format.indent;
12654
- w_len = this._textRuns_words[(tr * 4)] + (this._textRuns_words[(tr * 4) + 1] * 5);
13086
+ w_len = this._textRuns_words[tr].start + this._textRuns_words[tr].count;
12655
13087
  if (tr_length <= maxLineWidth || !this.wordWrap) {
12656
13088
  //if(tr_length<maxLineWidth || !this.wordWrap){
12657
13089
  // this must be a single textline
12658
13090
  //console.log("just add to line",(tr * 4) , w_len, this.words, this._textRuns_words);
12659
- for (w = this._textRuns_words[(tr * 4)]; w < w_len; w += 5) {
12660
- word_width = this.words[w + 3];
13091
+ for (w = this._textRuns_words[tr].start; w < w_len; w += 1) {
13092
+ var word = this.words.get(w);
13093
+ word_width = word.width;
12661
13094
  linelength += word_width;
12662
- this.lines_wordEndIndices[linecnt] = w + 5;
13095
+ this.lines_wordEndIndices[linecnt] = w + 1;
12663
13096
  this.lines_width[linecnt] += word_width;
12664
13097
  lines_formats[linecnt] = format;
12665
- if (this.chars_codes[this.words[w]] == 32 || this.chars_codes[this.words[w]] == 9) {
13098
+ if (this.chars_codes[word.start] == 32 || this.chars_codes[word.start] == 9) {
12666
13099
  this.lines_numSpacesPerline[linecnt] += 1;
12667
13100
  }
12668
13101
  }
@@ -12671,10 +13104,11 @@ var TextField = /** @class */ (function (_super) {
12671
13104
  //console.log("split lines");
12672
13105
  word_width = 0;
12673
13106
  indent = 0;
12674
- for (w = this._textRuns_words[(tr * 4)]; w < w_len; w += 5) {
12675
- word_width = this.words[w + 3];
13107
+ for (w = this._textRuns_words[tr].start; w < w_len; w += 1) {
13108
+ var word = this.words.get(w);
13109
+ word_width = word.width;
12676
13110
  var isSpace = false;
12677
- if (this.chars_codes[this.words[w]] == 32 || this.chars_codes[this.words[w]] == 9) {
13111
+ if (this.chars_codes[word.start] == 32 || this.chars_codes[word.start] == 9) {
12678
13112
  this.lines_numSpacesPerline[linecnt] += 1;
12679
13113
  isSpace = true;
12680
13114
  }
@@ -12682,14 +13116,14 @@ var TextField = /** @class */ (function (_super) {
12682
13116
  if (isSpace
12683
13117
  || (this.lines_width[linecnt] + word_width) <= (maxLineWidth - indent - (1 * format.font_table.getCharWidth('32')))
12684
13118
  || this.lines_width[linecnt] == 0) {
12685
- this.lines_wordEndIndices[linecnt] = w + 5;
13119
+ this.lines_wordEndIndices[linecnt] = w + 1;
12686
13120
  this.lines_width[linecnt] += word_width;
12687
13121
  lines_formats[linecnt] = format;
12688
13122
  }
12689
13123
  else {
12690
13124
  linecnt++;
12691
13125
  this.lines_wordStartIndices[linecnt] = w;
12692
- this.lines_wordEndIndices[linecnt] = w + 5;
13126
+ this.lines_wordEndIndices[linecnt] = w + 1;
12693
13127
  this.lines_width[linecnt] = word_width;
12694
13128
  this.lines_numSpacesPerline[linecnt] = 0;
12695
13129
  this.lines_height[this.lines_height.length] = lines_heights[lineHeightCnt];
@@ -12761,18 +13195,19 @@ var TextField = /** @class */ (function (_super) {
12761
13195
  this.lines_start_y[l] = offsety;
12762
13196
  this.lines_charIdx_start[l] = charCnt;
12763
13197
  var line_width = 0; //format.leftMargin + format.indent + format.rightMargin;
12764
- for (w = start_idx; w < end_idx; w += 5) {
12765
- this.words[w + 1] = offsetx;
13198
+ for (w = start_idx; w < end_idx; w += 1) {
13199
+ var word = this.words.get(w);
13200
+ word.x = offsetx;
12766
13201
  char_pos = 0;
12767
- start_idx = this.words[w];
12768
- c_len = start_idx + this.words[w + 4];
13202
+ start_idx = word.start;
13203
+ c_len = start_idx + word.len;
12769
13204
  var tf = this.tf_per_char[start_idx];
12770
13205
  tf.font_table.initFontSize(tf.size);
12771
13206
  //console.log("lineHeight", lineHeight);
12772
13207
  //console.log("lineHeight", tf.font_table.getLineHeight()+tf.leading);
12773
13208
  var diff = (lineHeight) - (tf.font_table.getLineHeight() + tf.leading);
12774
13209
  diff = ((diff > 0) ? diff - 2 : 0);
12775
- this.words[w + 2] = offsety + diff;
13210
+ word.y = offsety + diff;
12776
13211
  for (c = start_idx; c < c_len; c++) {
12777
13212
  this.char_positions_x[this.char_positions_x.length] = offsetx + char_pos;
12778
13213
  this.char_positions_y[this.char_positions_y.length] = offsety + diff;
@@ -12965,13 +13400,17 @@ var TextField = /** @class */ (function (_super) {
12965
13400
  if (this._textShapesDirty)
12966
13401
  this._clearTextShapes();
12967
13402
  for (var tr = 0; tr < tr_len; tr++) {
12968
- if (tr_words[(tr * 4) + 1] == 0) {
13403
+ var run = tr_words[tr];
13404
+ if (run.count == 0) {
12969
13405
  continue;
12970
13406
  // } else if (tr_words[(tr * 4)] + tr_words[(tr * 4) + 1] * 5 <= this._words_amount_prev) {
12971
13407
  // continue;
12972
13408
  }
12973
13409
  tr_formats[tr].font_table.initFontSize(tr_formats[tr].size);
12974
- tr_formats[tr].font_table.fillTextRun(this, tr_formats[tr], tr_words[(tr * 4)], tr_words[(tr * 4) + 1]);
13410
+ if (Settings.USE_UNSAFE_FNT) {
13411
+ tr_formats[tr].font_table.generateFNTData(null);
13412
+ }
13413
+ tr_formats[tr].font_table.fillTextRun(this, tr_formats[tr], run.start, run.count);
12975
13414
  }
12976
13415
  var textShape;
12977
13416
  for (var key in this.textShapes) {
@@ -12980,32 +13419,49 @@ var TextField = /** @class */ (function (_super) {
12980
13419
  continue;
12981
13420
  }
12982
13421
  var attr = new _awayjs_stage.Float2Attributes(textShape.length / 2);
12983
- var buffer = new Float32Array(attr.attributesBuffer.buffer);
13422
+ var pos = new Float32Array(attr.attributesBuffer.buffer);
13423
+ var uvAttr = textShape.hasUV ? new _awayjs_stage.Float2Attributes(textShape.length / 2) : null;
13424
+ var uvs = uvAttr ? new Float32Array(uvAttr.attributesBuffer.buffer) : null;
13425
+ //console.log('Build shape size:', textShape.length);
12984
13426
  var offset = 0;
12985
- for (var _i = 0, _a = textShape.verts; _i < _a.length; _i++) {
12986
- var chunk = _a[_i];
12987
- buffer.set(chunk, offset);
13427
+ for (var i = 0; i < textShape.verts.length; i++) {
13428
+ var chunk = textShape.verts[i];
13429
+ pos.set(chunk, offset);
13430
+ if (uvs) {
13431
+ uvs.set(textShape.uvs[i], offset);
13432
+ }
12988
13433
  offset += chunk.length;
12989
13434
  }
13435
+ // hack, merge buffer in single
13436
+ // this helps to avoid a lot of set in incremental filling
13437
+ // but anyway is slow
13438
+ textShape.length = 0;
13439
+ textShape.addChunk(pos, uvs);
12990
13440
  if (textShape.shape) {
12991
13441
  var element = textShape.shape.elements;
12992
- // there are bug with attribyte buffer, when add attr to exist
12993
- element.setPositions(buffer);
13442
+ // there are bug with attribute buffer, when add attr to exist
13443
+ element.setPositions(pos);
13444
+ if (uvs) {
13445
+ element.setUVs(uvs);
13446
+ }
12994
13447
  element.invalidate();
12995
13448
  attr.dispose();
13449
+ if (uvAttr) {
13450
+ uvAttr.dispose();
13451
+ }
12996
13452
  continue;
12997
13453
  }
12998
13454
  var color = this.getTextColorForTextFormat(textShape.format);
12999
- var alpha = _awayjs_core.ColorUtils.float32ColorToARGB(color)[0];
13000
- if (alpha == 0) {
13001
- alpha = 255;
13002
- }
13455
+ var alpha = _awayjs_core.ColorUtils.float32ColorToARGB(color)[0] || 255;
13003
13456
  textShape.elements = new _awayjs_renderer.TriangleElements();
13004
13457
  textShape.elements.setPositions(attr);
13458
+ if (uvAttr) {
13459
+ textShape.elements.setUVs(uvAttr);
13460
+ }
13005
13461
  textShape.elements.invalidate();
13006
13462
  textShape.shape = _awayjs_graphics.Shape.getShape(textShape.elements);
13007
13463
  // has BUG for QWOP, temporarily enable it (default)
13008
- textShape.shape.deepHitCheck = true;
13464
+ textShape.shape.deepHitCheck = false;
13009
13465
  textShape.shape.usages++;
13010
13466
  var sampler = new _awayjs_stage.ImageSampler(false, true, true);
13011
13467
  textShape.shape.style = new _awayjs_renderer.Style();
@@ -13918,10 +14374,7 @@ var TextField = /** @class */ (function (_super) {
13918
14374
  };
13919
14375
  TextField.prototype._clearTextShapes = function () {
13920
14376
  this._textShapesDirty = false;
13921
- this.last_word_vertices_count = 0;
13922
- this.tf_per_char_prev.length = 0;
13923
- this.chars_codes_prev.length = 0;
13924
- this._words_amount_prev = 0;
14377
+ this._lastWordsCount = 0;
13925
14378
  if (this.targetGraphics)
13926
14379
  this.targetGraphics.clear();
13927
14380
  var textShape;
@@ -14236,6 +14689,7 @@ var SceneImage2D = /** @class */ (function (_super) {
14236
14689
  //setup the projection
14237
14690
  SceneImage2D._renderer.disableClear = true;
14238
14691
  SceneImage2D._renderer.view.backgroundAlpha = 0;
14692
+ SceneImage2D._renderer.view.backgroundColor = 0x0;
14239
14693
  SceneImage2D._renderer.view.projection = projection;
14240
14694
  SceneImage2D._renderer.view.projection.transform = new _awayjs_core.Transform();
14241
14695
  SceneImage2D._renderer.view.projection.transform.scaleTo(1, -1, 1);
@@ -14258,6 +14712,7 @@ var SceneImage2D = /** @class */ (function (_super) {
14258
14712
  //setup the projection
14259
14713
  SceneImage2D._billboardRenderer.disableClear = true;
14260
14714
  SceneImage2D._billboardRenderer.view.backgroundAlpha = 0;
14715
+ SceneImage2D._billboardRenderer.view.backgroundColor = 0x0;
14261
14716
  SceneImage2D._billboardRenderer.view.projection = projection;
14262
14717
  SceneImage2D._billboardRenderer.view.projection.transform = new _awayjs_core.Transform();
14263
14718
  SceneImage2D._billboardRenderer.view.projection.transform.moveTo(0, 0, -1000);
@@ -14414,7 +14869,18 @@ var SceneImage2D = /** @class */ (function (_super) {
14414
14869
  this.fillRect(this._rect, this._initalFillColor);
14415
14870
  this._initalFillColor = null;
14416
14871
  }
14417
- this._stage.copyPixels(source, this, sourceRect, destPoint, alphaBitmapData, alphaPoint, mergeAlpha);
14872
+ var compositeSource = source;
14873
+ // merge alpha with source
14874
+ if (alphaBitmapData) {
14875
+ compositeSource = this._stage.filterManager.popTemp(source.width, source.height);
14876
+ //this._stage.filterManager.copyPixels(source, compositeSource, source.rect, source.rect.topLeft);
14877
+ this._stage.filterManager.copyPixels(alphaBitmapData, compositeSource, new _awayjs_core.Rectangle(alphaPoint.x, alphaPoint.y, sourceRect.width, sourceRect.height), new _awayjs_core.Point(0, 0));
14878
+ this._stage.filterManager.copyPixels(source, compositeSource, source.rect, new _awayjs_core.Point(0, 0), true, 'alpha_back');
14879
+ }
14880
+ this._stage.filterManager.copyPixels(compositeSource, this, sourceRect, destPoint, mergeAlpha);
14881
+ if (alphaBitmapData) {
14882
+ this._stage.filterManager.pushTemp(compositeSource);
14883
+ }
14418
14884
  this._imageDataDirty = true;
14419
14885
  };
14420
14886
  SceneImage2D.prototype.threshold = function (source, sourceRect, destPoint, operation, threshold, color, mask, copySource) {
@@ -14534,16 +15000,23 @@ var SceneImage2D = /** @class */ (function (_super) {
14534
15000
  this.fillRect(this._rect, this._initalFillColor);
14535
15001
  this._initalFillColor = null;
14536
15002
  }
15003
+ var stage = this._stage;
15004
+ var mappedBlend = SceneImage2D._mapSupportedBlendMode(blendMode);
15005
+ var supportNativeBlend = !blendMode || mappedBlend !== _awayjs_stage.BlendMode.LAYER || blendMode == _awayjs_stage.BlendMode.LAYER;
15006
+ var useTmp = (!supportNativeBlend || this === source);
15007
+ var target = useTmp ?
15008
+ stage.filterManager.popTemp(this.width, this.height, false)
15009
+ : this;
14537
15010
  var renderer = SceneImage2D._billboardRenderer;
14538
15011
  var root = SceneImage2D._billboardRoot;
14539
15012
  var billboard = SceneImage2D._billboard;
14540
15013
  billboard.sampler.smooth = smoothing;
14541
- renderer.disableClear = true;
14542
- renderer.view.target = this;
14543
- renderer.view.projection.scale = 1000 / this.rect.height;
15014
+ renderer.disableClear = !useTmp;
15015
+ renderer.view.target = target;
15016
+ renderer.view.projection.scale = 1000 / target.height;
14544
15017
  billboard.material.style.image = source;
14545
15018
  // not all blend modes can be used for rendering
14546
- billboard.material.blendMode = SceneImage2D._mapSupportedBlendMode(blendMode);
15019
+ billboard.material.blendMode = !useTmp ? SceneImage2D._mapSupportedBlendMode(blendMode) : _awayjs_stage.BlendMode.LAYER;
14547
15020
  billboard.material.useColorTransform = !!colorTransform;
14548
15021
  if (matrix) {
14549
15022
  var m = root.transform.matrix3D;
@@ -14553,17 +15026,22 @@ var SceneImage2D = /** @class */ (function (_super) {
14553
15026
  m._rawData[4] = matrix.c;
14554
15027
  m._rawData[5] = -matrix.d;
14555
15028
  m._rawData[12] = matrix.tx;
14556
- m._rawData[13] = this.rect.height - matrix.ty;
15029
+ m._rawData[13] = target.height - matrix.ty;
14557
15030
  root.transform.invalidateComponents();
14558
15031
  }
14559
15032
  else {
14560
15033
  root.transform.rotateTo(0, 0, 0);
14561
15034
  root.transform.scaleTo(1, -1, 1);
14562
- root.transform.moveTo(0, this.rect.height, 0);
15035
+ root.transform.moveTo(0, target.height, 0);
14563
15036
  }
14564
15037
  root.transform.colorTransform = colorTransform;
14565
15038
  //render
14566
15039
  renderer.render();
15040
+ //
15041
+ if (useTmp) {
15042
+ stage.filterManager.copyPixels(target, this, this.rect, TMP_POINT, true, blendMode);
15043
+ stage.filterManager.pushTemp(target);
15044
+ }
14567
15045
  };
14568
15046
  SceneImage2D.prototype._drawAsDisplay = function (source, matrix, colorTransform, blendMode, _clipRect, _smoothing) {
14569
15047
  if (blendMode === void 0) { blendMode = ''; }
@@ -14642,6 +15120,8 @@ var SceneImage2D = /** @class */ (function (_super) {
14642
15120
  renderer.view.height = this.height;
14643
15121
  var sourceNode = rootNode.addChildAt(source, 0);
14644
15122
  sourceNode.transformDisabled = true;
15123
+ // color transform should be enabled!
15124
+ sourceNode.colorTransformDisabled = false;
14645
15125
  root.transform.colorTransform = colorTransform;
14646
15126
  // anyway we not support this =))
14647
15127
  root.blendMode = SceneImage2D._mapSupportedBlendMode(blendMode);
@@ -15295,7 +15775,7 @@ var MouseManager = /** @class */ (function () {
15295
15775
  };
15296
15776
  MouseManager.prototype.queueDispatch = function (event, sourceEvent) {
15297
15777
  // Store event to be dispatched later.
15298
- event.delta = (sourceEvent instanceof WheelEvent) ? sourceEvent.deltaY : 0;
15778
+ event.delta = (sourceEvent instanceof WheelEvent) ? -3 * sourceEvent.deltaY / 100 : 0;
15299
15779
  event.ctrlKey = sourceEvent.ctrlKey;
15300
15780
  event.altKey = sourceEvent.altKey;
15301
15781
  event.shiftKey = sourceEvent.shiftKey;
@@ -16955,25 +17435,27 @@ var AntiAliasType = /** @class */ (function () {
16955
17435
  return AntiAliasType;
16956
17436
  }());
16957
17437
 
16958
- var FNTGenerator = /** @class */ (function () {
17438
+ var FNTGenerator = /** @class */ (function (_super) {
17439
+ __extends(FNTGenerator, _super);
16959
17440
  function FNTGenerator(stage) {
16960
- this._stage = stage;
17441
+ var _this = _super.call(this, stage) || this;
16961
17442
  //create the projection
16962
17443
  var projection = new _awayjs_core.PerspectiveProjection();
16963
17444
  projection.coordinateSystem = _awayjs_core.CoordinateSystem.RIGHT_HANDED;
16964
17445
  projection.originX = -1;
16965
17446
  projection.originY = 1;
16966
17447
  //create the view
16967
- this._root = new DisplayObjectContainer();
16968
- this._renderer = _awayjs_renderer.RenderGroup
17448
+ _this._root = new DisplayObjectContainer();
17449
+ _this._renderer = _awayjs_renderer.RenderGroup
16969
17450
  .getInstance(new _awayjs_view.View(projection, stage, null, null, null, true), _awayjs_renderer.DefaultRenderer)
16970
- .getRenderer(_awayjs_view.NodePool.getRootNode(this._root, _awayjs_view.BasicPartition).partition);
17451
+ .getRenderer(_awayjs_view.NodePool.getRootNode(_this._root, _awayjs_view.BasicPartition).partition);
16971
17452
  //setup the projection
16972
- this._renderer.view.projection = projection;
16973
- this._renderer.view.projection.transform = new _awayjs_core.Transform();
16974
- this._renderer.view.projection.transform.moveTo(0, 0, -1000);
16975
- this._renderer.view.projection.transform.lookAt(new _awayjs_core.Vector3D());
16976
- this._renderer.renderableSorter = null; //new RenderableSort2D();
17453
+ _this._renderer.view.projection = projection;
17454
+ _this._renderer.view.projection.transform = new _awayjs_core.Transform();
17455
+ _this._renderer.view.projection.transform.moveTo(0, 0, -1000);
17456
+ _this._renderer.view.projection.transform.lookAt(new _awayjs_core.Vector3D());
17457
+ _this._renderer.renderableSorter = null; //new RenderableSort2D();
17458
+ return _this;
16977
17459
  }
16978
17460
  FNTGenerator.prototype.generate = function (font, maxSize, fontSize, padding) {
16979
17461
  var outputBitmap;
@@ -17015,7 +17497,7 @@ var FNTGenerator = /** @class */ (function () {
17015
17497
  return outputBitmaps;
17016
17498
  };
17017
17499
  return FNTGenerator;
17018
- }());
17500
+ }(FNTGeneratorBase));
17019
17501
 
17020
17502
  /**
17021
17503
  * The GridFitType class defines values for grid fitting in the TextField class.
@@ -17882,7 +18364,7 @@ var Scene = /** @class */ (function () {
17882
18364
  _awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
17883
18365
  _awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
17884
18366
 
17885
- console.debug('AwayJS - Scene - 0.13.224');
18367
+ console.debug('AwayJS - Scene - 0.13.233');
17886
18368
 
17887
18369
  exports.Timeline = Timeline;
17888
18370
  exports.ControllerBase = ControllerBase;