textmode.js 0.1.3 → 0.1.4-beta.1

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.
@@ -1636,7 +1636,7 @@ class mA {
1636
1636
  var r;
1637
1637
  const t = document.createElement("canvas");
1638
1638
  if (t.className = "textmodeCanvas", this._isStandalone)
1639
- t.width = A || 800, t.height = e || 600, t.style.width = A + "px", t.style.height = e + "px", document.body.appendChild(t);
1639
+ t.width = A || 800, t.height = e || 600, document.body.appendChild(t);
1640
1640
  else {
1641
1641
  const i = this.captureSource.getBoundingClientRect();
1642
1642
  let s = Math.round(i.width), o = Math.round(i.height);
@@ -1644,7 +1644,7 @@ class mA {
1644
1644
  const E = this.captureSource;
1645
1645
  (s === 0 || o === 0) && E.videoWidth > 0 && E.videoHeight > 0 && (s = E.videoWidth, o = E.videoHeight);
1646
1646
  }
1647
- t.width = s, t.height = o, t.style.width = s + "px", t.style.height = o + "px", t.style.position = "absolute", t.style.pointerEvents = "none";
1647
+ t.width = s, t.height = o, t.style.position = "absolute", t.style.pointerEvents = "none";
1648
1648
  const g = window.getComputedStyle(this.captureSource);
1649
1649
  let B = parseInt(g.zIndex || "0", 10);
1650
1650
  isNaN(B) && (B = 0), t.style.zIndex = (B + 1).toString(), this.positionOverlayCanvas(t), (r = this.captureSource.parentNode) == null || r.insertBefore(t, this.captureSource.nextSibling);
@@ -1662,7 +1662,7 @@ class mA {
1662
1662
  }
1663
1663
  resize(A, e) {
1664
1664
  if (this._isStandalone)
1665
- this._canvas.width = A ?? this._canvas.width, this._canvas.height = e ?? this._canvas.height, this._canvas.style.width = (A ?? this._canvas.width) + "px", this._canvas.style.height = (e ?? this._canvas.height) + "px";
1665
+ this._canvas.width = A ?? this._canvas.width, this._canvas.height = e ?? this._canvas.height;
1666
1666
  else {
1667
1667
  const t = this.captureSource.getBoundingClientRect();
1668
1668
  let r = Math.round(t.width), i = Math.round(t.height);
@@ -1670,7 +1670,7 @@ class mA {
1670
1670
  const s = this.captureSource;
1671
1671
  (r === 0 || i === 0) && s.videoWidth > 0 && s.videoHeight > 0 && (r = s.videoWidth, i = s.videoHeight);
1672
1672
  }
1673
- this._canvas.width = r, this._canvas.height = i, this._canvas.style.width = r + "px", this._canvas.style.height = i + "px", this.positionOverlayCanvas(this._canvas);
1673
+ this._canvas.width = r, this._canvas.height = i, this.positionOverlayCanvas(this._canvas);
1674
1674
  }
1675
1675
  }
1676
1676
  /**
@@ -4080,7 +4080,7 @@ class X {
4080
4080
  * ```
4081
4081
  */
4082
4082
  static get version() {
4083
- return "0.1.2";
4083
+ return "0.1.4-beta.1";
4084
4084
  }
4085
4085
  constructor() {
4086
4086
  throw new Error("Textmode is a static class and cannot be instantiated.");
@@ -1,6 +1,6 @@
1
1
  var se = Object.defineProperty;
2
- var ae = (h, e, t) => e in h ? se(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
3
- var o = (h, e, t) => ae(h, typeof e != "symbol" ? e + "" : e, t);
2
+ var ae = (l, e, t) => e in l ? se(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
+ var o = (l, e, t) => ae(l, typeof e != "symbol" ? e + "" : e, t);
4
4
  class F extends Error {
5
5
  constructor(t, r, i = {}) {
6
6
  const s = F.createFormattedMessage(t, i);
@@ -46,7 +46,7 @@ class F extends Error {
46
46
  return String(t);
47
47
  }
48
48
  }
49
- var ne = /* @__PURE__ */ ((h) => (h[h.SILENT = 0] = "SILENT", h[h.WARNING = 1] = "WARNING", h[h.ERROR = 2] = "ERROR", h[h.THROW = 3] = "THROW", h))(ne || {});
49
+ var ne = /* @__PURE__ */ ((l) => (l[l.SILENT = 0] = "SILENT", l[l.WARNING = 1] = "WARNING", l[l.ERROR = 2] = "ERROR", l[l.THROW = 3] = "THROW", l))(ne || {});
50
50
  const E = class E {
51
51
  constructor() {
52
52
  o(this, "_options", {
@@ -236,9 +236,9 @@ class M {
236
236
  /** Bytes per vertex: depends on position format (vec2 vs vec3) */
237
237
  o(this, "bytesPerVertex");
238
238
  this.gl = e, this.bytesPerVertex = 16;
239
- const a = e.getParameter(e.VIEWPORT), n = a[2], l = a[3], c = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, u = t / n * 2 - 1, d = (t + i) / n * 2 - 1;
239
+ const a = e.getParameter(e.VIEWPORT), n = a[2], h = a[3], c = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, u = t / n * 2 - 1, d = (t + i) / n * 2 - 1;
240
240
  let f, g;
241
- c ? (f = r / l * 2 - 1, g = (r + s) / l * 2 - 1) : (f = 1 - r / l * 2, g = 1 - (r + s) / l * 2);
241
+ c ? (f = r / h * 2 - 1, g = (r + s) / h * 2 - 1) : (f = 1 - r / h * 2, g = 1 - (r + s) / h * 2);
242
242
  let _, p, C, b;
243
243
  _ = u, C = d, p = f, b = g;
244
244
  const v = this.generateVertices(_, p, C, b);
@@ -292,7 +292,7 @@ class M {
292
292
  this.gl.enableVertexAttribArray(t), this.gl.vertexAttribPointer(t, 2, this.gl.FLOAT, !1, this.bytesPerVertex, 0), this.gl.enableVertexAttribArray(r), this.gl.vertexAttribPointer(r, 2, this.gl.FLOAT, !1, this.bytesPerVertex, 8), this.gl.drawArrays(this.gl.TRIANGLES, 0, this.vertexCount), this.gl.disableVertexAttribArray(t), this.gl.disableVertexAttribArray(r);
293
293
  }
294
294
  }
295
- class he extends Q {
295
+ class le extends Q {
296
296
  constructor(t, r, i, s, a) {
297
297
  super(t, r, i);
298
298
  o(this, "width");
@@ -316,7 +316,7 @@ class he extends Q {
316
316
  r.render(), i.render(), s.render(), a.render();
317
317
  }
318
318
  }
319
- class le {
319
+ class he {
320
320
  constructor(e, t, r, i, s, a) {
321
321
  /** The WebGL rendering context */
322
322
  o(this, "gl");
@@ -327,13 +327,13 @@ class le {
327
327
  /** Bytes per vertex: vec2+vec2 = 16 bytes */
328
328
  o(this, "bytesPerVertex");
329
329
  this.gl = e, this.bytesPerVertex = 16;
330
- const n = e.getParameter(e.VIEWPORT), l = n[2], c = n[3], u = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, d = i - t, f = s - r, g = Math.sqrt(d * d + f * f);
330
+ const n = e.getParameter(e.VIEWPORT), h = n[2], c = n[3], u = e.getParameter(e.FRAMEBUFFER_BINDING) !== null, d = i - t, f = s - r, g = Math.sqrt(d * d + f * f);
331
331
  if (g === 0) {
332
332
  const ie = this.generateVertices(0, 0, 0, 0);
333
333
  this.vertexBuffer = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, this.vertexBuffer), e.bufferData(e.ARRAY_BUFFER, ie, e.STATIC_DRAW);
334
334
  return;
335
335
  }
336
- const _ = d / g, C = -(f / g), b = _, v = a / 2, w = t + C * v, A = r + b * v, R = t - C * v, y = r - b * v, P = i + C * v, D = s + b * v, Z = i - C * v, W = s - b * v, J = w / l * 2 - 1, K = R / l * 2 - 1, ee = P / l * 2 - 1, te = Z / l * 2 - 1;
336
+ const _ = d / g, C = -(f / g), b = _, v = a / 2, w = t + C * v, A = r + b * v, R = t - C * v, y = r - b * v, P = i + C * v, D = s + b * v, Z = i - C * v, W = s - b * v, J = w / h * 2 - 1, K = R / h * 2 - 1, ee = P / h * 2 - 1, te = Z / h * 2 - 1;
337
337
  let B, G, V, k;
338
338
  u ? (B = A / c * 2 - 1, G = y / c * 2 - 1, V = D / c * 2 - 1, k = W / c * 2 - 1) : (B = 1 - A / c * 2, G = 1 - y / c * 2, V = 1 - D / c * 2, k = 1 - W / c * 2);
339
339
  const re = this.generateLineVertices(
@@ -391,7 +391,7 @@ class le {
391
391
  * Uses the four corners calculated based on line direction and thickness
392
392
  * @private
393
393
  */
394
- generateLineVertices(e, t, r, i, s, a, n, l) {
394
+ generateLineVertices(e, t, r, i, s, a, n, h) {
395
395
  return new Float32Array([
396
396
  e,
397
397
  t,
@@ -414,7 +414,7 @@ class le {
414
414
  1,
415
415
  // corner2 (start - perpendicular)
416
416
  n,
417
- l,
417
+ h,
418
418
  1,
419
419
  1,
420
420
  // corner4 (end - perpendicular)
@@ -454,7 +454,7 @@ class ce extends Q {
454
454
  */
455
455
  renderStroke(t) {
456
456
  if (t <= 0) return;
457
- new le(this.gl, this.x, this.y, this.x2, this.y2, t).render();
457
+ new he(this.gl, this.x, this.y, this.x2, this.y2, t).render();
458
458
  }
459
459
  }
460
460
  class T {
@@ -729,7 +729,7 @@ class fe {
729
729
  * Draw a rectangle with the current fill and/or stroke settings
730
730
  */
731
731
  rect(e, t, r, i) {
732
- const s = new he(this.gl, e, t, r, i);
732
+ const s = new le(this.gl, e, t, r, i);
733
733
  if (this.currentShader !== null) {
734
734
  if (this.currentRotation !== 0) {
735
735
  const { centerX: d, centerY: f, radians: g, aspectRatio: _ } = this.calculateRotationParams(e, t, r, i);
@@ -739,8 +739,8 @@ class fe {
739
739
  s.renderFill(), this.currentShader = null;
740
740
  return;
741
741
  }
742
- const a = this.solidColorShader, { centerX: n, centerY: l, radians: c, aspectRatio: u } = this.calculateRotationParams(e, t, r, i);
743
- this.fillMode && (this.shader(a), this.setUniform("u_color", this.currentFillColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [n, l]), this.setUniform("u_aspectRatio", u), s.renderFill()), this.strokeMode && (this.shader(a), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [n, l]), this.setUniform("u_aspectRatio", u), s.renderStroke(this.currentStrokeWeight)), this.currentShader = null;
742
+ const a = this.solidColorShader, { centerX: n, centerY: h, radians: c, aspectRatio: u } = this.calculateRotationParams(e, t, r, i);
743
+ this.fillMode && (this.shader(a), this.setUniform("u_color", this.currentFillColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [n, h]), this.setUniform("u_aspectRatio", u), s.renderFill()), this.strokeMode && (this.shader(a), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", c), this.setUniform("u_center", [n, h]), this.setUniform("u_aspectRatio", u), s.renderStroke(this.currentStrokeWeight)), this.currentShader = null;
744
744
  }
745
745
  /**
746
746
  * Draw a line from (x1, y1) to (x2, y2) with the current stroke settings.
@@ -762,18 +762,18 @@ class fe {
762
762
  s.renderStroke(this.currentStrokeWeight), this.currentShader = null;
763
763
  return;
764
764
  }
765
- const a = this.solidColorShader, n = (e + r) / 2, l = (t + i) / 2, c = Math.abs(r - e), u = Math.abs(i - t), { centerX: d, centerY: f, radians: g, aspectRatio: _ } = this.calculateRotationParams(n - c / 2, l - u / 2, c, u);
765
+ const a = this.solidColorShader, n = (e + r) / 2, h = (t + i) / 2, c = Math.abs(r - e), u = Math.abs(i - t), { centerX: d, centerY: f, radians: g, aspectRatio: _ } = this.calculateRotationParams(n - c / 2, h - u / 2, c, u);
766
766
  this.shader(a), this.setUniform("u_color", this.currentStrokeColor), this.setUniform("u_rotation", g), this.setUniform("u_center", [d, f]), this.setUniform("u_aspectRatio", _), s.renderStroke(this.currentStrokeWeight), this.currentShader = null;
767
767
  }
768
768
  /**
769
769
  * Calculate rotation parameters for built-in shaders (NDC coordinates)
770
770
  */
771
771
  calculateRotationParams(e, t, r, i) {
772
- const s = this.gl.getParameter(this.gl.VIEWPORT), a = s[2], n = s[3], l = a / n, c = this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING) !== null, u = e + r / 2, d = t + i / 2, f = u / a * 2 - 1;
772
+ const s = this.gl.getParameter(this.gl.VIEWPORT), a = s[2], n = s[3], h = a / n, c = this.gl.getParameter(this.gl.FRAMEBUFFER_BINDING) !== null, u = e + r / 2, d = t + i / 2, f = u / a * 2 - 1;
773
773
  let g;
774
774
  c ? g = d / n * 2 - 1 : g = 1 - d / n * 2;
775
775
  const _ = this.currentRotation * Math.PI / 180;
776
- return { centerX: f, centerY: g, radians: _, aspectRatio: l };
776
+ return { centerX: f, centerY: g, radians: _, aspectRatio: h };
777
777
  }
778
778
  /**
779
779
  * Create a new framebuffer
@@ -810,18 +810,18 @@ class fe {
810
810
  */
811
811
  image(e, t, r, i, s) {
812
812
  this.shader(this.imageShader), this.setUniform("u_texture", e.texture);
813
- const { centerX: a, centerY: n, radians: l, aspectRatio: c } = this.calculateRotationParams(
813
+ const { centerX: a, centerY: n, radians: h, aspectRatio: c } = this.calculateRotationParams(
814
814
  t,
815
815
  r,
816
816
  i ?? e.width,
817
817
  s ?? e.height
818
818
  );
819
- this.setUniform("u_rotation", l), this.setUniform("u_center", [a, n]), this.setUniform("u_aspectRatio", c), this.rect(t, r, i ?? e.width, s ?? e.height);
819
+ this.setUniform("u_rotation", h), this.setUniform("u_center", [a, n]), this.setUniform("u_aspectRatio", c), this.rect(t, r, i ?? e.width, s ?? e.height);
820
820
  }
821
821
  }
822
822
  var m = {};
823
- m.parse = function(h) {
824
- var e = function(s, a, n, l) {
823
+ m.parse = function(l) {
824
+ var e = function(s, a, n, h) {
825
825
  var c = m.T, u = {
826
826
  cmap: c.cmap,
827
827
  head: c.head,
@@ -834,115 +834,115 @@ m.parse = function(h) {
834
834
  for (var f in u) {
835
835
  var g = m.findTable(s, f, n);
836
836
  if (g) {
837
- var _ = g[0], p = l[_];
838
- p == null && (p = u[f].parseTab(s, _, g[1], d)), d[f] = l[_] = p;
837
+ var _ = g[0], p = h[_];
838
+ p == null && (p = u[f].parseTab(s, _, g[1], d)), d[f] = h[_] = p;
839
839
  }
840
840
  }
841
841
  return d;
842
- }, t = new Uint8Array(h), r = {}, i = e(t, 0, 0, r);
842
+ }, t = new Uint8Array(l), r = {}, i = e(t, 0, 0, r);
843
843
  return [i];
844
844
  };
845
- m.findTable = function(h, e, t) {
846
- for (var r = m.B, i = r.readUshort(h, t + 4), s = t + 12, a = 0; a < i; a++) {
847
- var n = r.readASCII(h, s, 4);
848
- r.readUint(h, s + 4);
849
- var l = r.readUint(h, s + 8), c = r.readUint(h, s + 12);
850
- if (n == e) return [l, c];
845
+ m.findTable = function(l, e, t) {
846
+ for (var r = m.B, i = r.readUshort(l, t + 4), s = t + 12, a = 0; a < i; a++) {
847
+ var n = r.readASCII(l, s, 4);
848
+ r.readUint(l, s + 4);
849
+ var h = r.readUint(l, s + 8), c = r.readUint(l, s + 12);
850
+ if (n == e) return [h, c];
851
851
  s += 16;
852
852
  }
853
853
  return null;
854
854
  };
855
855
  m.T = {};
856
856
  m.B = {
857
- readShort: function(h, e) {
857
+ readShort: function(l, e) {
858
858
  var t = m.B.t.uint16;
859
- return t[0] = h[e] << 8 | h[e + 1], m.B.t.int16[0];
859
+ return t[0] = l[e] << 8 | l[e + 1], m.B.t.int16[0];
860
860
  },
861
- readUshort: function(h, e) {
862
- return h[e] << 8 | h[e + 1];
861
+ readUshort: function(l, e) {
862
+ return l[e] << 8 | l[e + 1];
863
863
  },
864
- readUshorts: function(h, e, t) {
864
+ readUshorts: function(l, e, t) {
865
865
  for (var r = [], i = 0; i < t; i++)
866
- r.push(m.B.readUshort(h, e + i * 2));
866
+ r.push(m.B.readUshort(l, e + i * 2));
867
867
  return r;
868
868
  },
869
- readUint: function(h, e) {
869
+ readUint: function(l, e) {
870
870
  var t = m.B.t.uint8;
871
- return t[3] = h[e], t[2] = h[e + 1], t[1] = h[e + 2], t[0] = h[e + 3], m.B.t.uint32[0];
871
+ return t[3] = l[e], t[2] = l[e + 1], t[1] = l[e + 2], t[0] = l[e + 3], m.B.t.uint32[0];
872
872
  },
873
- readASCII: function(h, e, t) {
874
- for (var r = "", i = 0; i < t; i++) r += String.fromCharCode(h[e + i]);
873
+ readASCII: function(l, e, t) {
874
+ for (var r = "", i = 0; i < t; i++) r += String.fromCharCode(l[e + i]);
875
875
  return r;
876
876
  },
877
877
  // Simplified typed array buffer - only what's needed
878
878
  t: function() {
879
- var h = new ArrayBuffer(8);
879
+ var l = new ArrayBuffer(8);
880
880
  return {
881
- uint8: new Uint8Array(h),
882
- int16: new Int16Array(h),
883
- uint16: new Uint16Array(h),
884
- uint32: new Uint32Array(h)
881
+ uint8: new Uint8Array(l),
882
+ int16: new Int16Array(l),
883
+ uint16: new Uint16Array(l),
884
+ uint32: new Uint32Array(l)
885
885
  };
886
886
  }()
887
887
  };
888
888
  m.T.cmap = {
889
- parseTab: function(h, e, t) {
889
+ parseTab: function(l, e, t) {
890
890
  var r = { tables: [], ids: {}, off: e };
891
- h = new Uint8Array(h.buffer, e, t), e = 0;
891
+ l = new Uint8Array(l.buffer, e, t), e = 0;
892
892
  var i = m.B, s = i.readUshort, a = m.T.cmap;
893
- s(h, e), e += 2;
894
- var n = s(h, e);
893
+ s(l, e), e += 2;
894
+ var n = s(l, e);
895
895
  e += 2;
896
- for (var l = [], c = 0; c < n; c++) {
897
- var u = s(h, e);
896
+ for (var h = [], c = 0; c < n; c++) {
897
+ var u = s(l, e);
898
898
  e += 2;
899
- var d = s(h, e);
899
+ var d = s(l, e);
900
900
  e += 2;
901
- var f = i.readUint(h, e);
901
+ var f = i.readUint(l, e);
902
902
  e += 4;
903
- var g = "p" + u + "e" + d, _ = l.indexOf(f);
903
+ var g = "p" + u + "e" + d, _ = h.indexOf(f);
904
904
  if (_ == -1) {
905
905
  _ = r.tables.length;
906
906
  var p = {};
907
- l.push(f);
908
- var C = p.format = s(h, f);
909
- C == 4 ? p = a.parse4(h, f, p) : C == 12 && (p = a.parse12(h, f, p)), r.tables.push(p);
907
+ h.push(f);
908
+ var C = p.format = s(l, f);
909
+ C == 4 ? p = a.parse4(l, f, p) : C == 12 && (p = a.parse12(l, f, p)), r.tables.push(p);
910
910
  }
911
911
  r.ids[g] != null && console.log("multiple tables for one platform+encoding: " + g), r.ids[g] = _;
912
912
  }
913
913
  return r;
914
914
  },
915
- parse4: function(h, e, t) {
915
+ parse4: function(l, e, t) {
916
916
  var r = m.B, i = r.readUshort, s = r.readUshorts, a = e;
917
917
  e += 2;
918
- var n = i(h, e);
919
- e += 2, i(h, e), e += 2;
920
- var l = i(h, e);
918
+ var n = i(l, e);
919
+ e += 2, i(l, e), e += 2;
920
+ var h = i(l, e);
921
921
  e += 2;
922
- var c = l >>> 1;
923
- t.searchRange = i(h, e), e += 2, t.entrySelector = i(h, e), e += 2, t.rangeShift = i(h, e), e += 2, t.endCount = s(h, e, c), e += c * 2, e += 2, t.startCount = s(h, e, c), e += c * 2, t.idDelta = [];
922
+ var c = h >>> 1;
923
+ t.searchRange = i(l, e), e += 2, t.entrySelector = i(l, e), e += 2, t.rangeShift = i(l, e), e += 2, t.endCount = s(l, e, c), e += c * 2, e += 2, t.startCount = s(l, e, c), e += c * 2, t.idDelta = [];
924
924
  for (var u = 0; u < c; u++)
925
- t.idDelta.push(r.readShort(h, e)), e += 2;
926
- return t.idRangeOffset = s(h, e, c), e += c * 2, t.glyphIdArray = s(h, e, a + n - e >> 1), t;
925
+ t.idDelta.push(r.readShort(l, e)), e += 2;
926
+ return t.idRangeOffset = s(l, e, c), e += c * 2, t.glyphIdArray = s(l, e, a + n - e >> 1), t;
927
927
  },
928
- parse12: function(h, e, t) {
928
+ parse12: function(l, e, t) {
929
929
  var r = m.B, i = r.readUint;
930
- e += 4, i(h, e), e += 4, i(h, e), e += 4;
931
- var s = i(h, e) * 3;
930
+ e += 4, i(l, e), e += 4, i(l, e), e += 4;
931
+ var s = i(l, e) * 3;
932
932
  e += 4;
933
933
  for (var a = t.groups = new Uint32Array(s), n = 0; n < s; n += 3)
934
- a[n] = i(h, e + (n << 2)), a[n + 1] = i(h, e + (n << 2) + 4), a[n + 2] = i(h, e + (n << 2) + 8);
934
+ a[n] = i(l, e + (n << 2)), a[n + 1] = i(l, e + (n << 2) + 4), a[n + 2] = i(l, e + (n << 2) + 8);
935
935
  return t;
936
936
  }
937
937
  };
938
938
  m.T.head = {
939
- parseTab: function(h, e, t) {
939
+ parseTab: function(l, e, t) {
940
940
  var r = m.B, i = {};
941
- return e += 18, i.unitsPerEm = r.readUshort(h, e), e += 2, e += 16, i.xMin = r.readShort(h, e), e += 2, i.yMin = r.readShort(h, e), e += 2, i.xMax = r.readShort(h, e), e += 2, i.yMax = r.readShort(h, e), e += 2, e += 6, i.indexToLocFormat = r.readShort(h, e), i;
941
+ return e += 18, i.unitsPerEm = r.readUshort(l, e), e += 2, e += 16, i.xMin = r.readShort(l, e), e += 2, i.yMin = r.readShort(l, e), e += 2, i.xMax = r.readShort(l, e), e += 2, i.yMax = r.readShort(l, e), e += 2, e += 6, i.indexToLocFormat = r.readShort(l, e), i;
942
942
  }
943
943
  };
944
944
  m.T.hhea = {
945
- parseTab: function(h, e, t) {
945
+ parseTab: function(l, e, t) {
946
946
  var r = m.B, i = {};
947
947
  e += 4;
948
948
  for (var s = [
@@ -963,52 +963,52 @@ m.T.hhea = {
963
963
  "metricDataFormat",
964
964
  "numberOfHMetrics"
965
965
  ], a = 0; a < s.length; a++) {
966
- var n = s[a], l = n == "advanceWidthMax" || n == "numberOfHMetrics" ? r.readUshort : r.readShort;
967
- i[n] = l(h, e + a * 2);
966
+ var n = s[a], h = n == "advanceWidthMax" || n == "numberOfHMetrics" ? r.readUshort : r.readShort;
967
+ i[n] = h(l, e + a * 2);
968
968
  }
969
969
  return i;
970
970
  }
971
971
  };
972
972
  m.T.hmtx = {
973
- parseTab: function(h, e, t, r) {
974
- for (var i = m.B, s = [], a = [], n = r.maxp.numGlyphs, l = r.hhea.numberOfHMetrics, c = 0, u = 0, d = 0; d < l; )
975
- c = i.readUshort(h, e + (d << 2)), u = i.readShort(h, e + (d << 2) + 2), s.push(c), a.push(u), d++;
973
+ parseTab: function(l, e, t, r) {
974
+ for (var i = m.B, s = [], a = [], n = r.maxp.numGlyphs, h = r.hhea.numberOfHMetrics, c = 0, u = 0, d = 0; d < h; )
975
+ c = i.readUshort(l, e + (d << 2)), u = i.readShort(l, e + (d << 2) + 2), s.push(c), a.push(u), d++;
976
976
  for (; d < n; )
977
977
  s.push(c), a.push(u), d++;
978
978
  return { aWidth: s, lsBearing: a };
979
979
  }
980
980
  };
981
981
  m.T.maxp = {
982
- parseTab: function(h, e, t) {
982
+ parseTab: function(l, e, t) {
983
983
  var r = m.B, i = r.readUshort, s = {};
984
- return r.readUint(h, e), e += 4, s.numGlyphs = i(h, e), e += 2, s;
984
+ return r.readUint(l, e), e += 4, s.numGlyphs = i(l, e), e += 2, s;
985
985
  }
986
986
  };
987
987
  m.T.loca = {
988
- parseTab: function(h, e, t, r) {
988
+ parseTab: function(l, e, t, r) {
989
989
  var i = m.B, s = [], a = r.head.indexToLocFormat, n = r.maxp.numGlyphs + 1;
990
- if (a == 0) for (var l = 0; l < n; l++) s.push(i.readUshort(h, e + (l << 1)) << 1);
991
- if (a == 1) for (var l = 0; l < n; l++) s.push(i.readUint(h, e + (l << 2)));
990
+ if (a == 0) for (var h = 0; h < n; h++) s.push(i.readUshort(l, e + (h << 1)) << 1);
991
+ if (a == 1) for (var h = 0; h < n; h++) s.push(i.readUint(l, e + (h << 2)));
992
992
  return s;
993
993
  }
994
994
  };
995
995
  m.T.glyf = {
996
- parseTab: function(h, e, t, r) {
996
+ parseTab: function(l, e, t, r) {
997
997
  for (var i = [], s = r.maxp.numGlyphs, a = 0; a < s; a++) i.push(null);
998
998
  return i;
999
999
  },
1000
- _parseGlyf: function(h, e) {
1001
- var t = m.B, r = h._data, i = h.loca;
1000
+ _parseGlyf: function(l, e) {
1001
+ var t = m.B, r = l._data, i = l.loca;
1002
1002
  if (i[e] == i[e + 1]) return null;
1003
- var s = m.findTable(r, "glyf", h._offset)[0] + i[e], a = {};
1003
+ var s = m.findTable(r, "glyf", l._offset)[0] + i[e], a = {};
1004
1004
  if (a.noc = t.readShort(r, s), s += 2, a.xMin = t.readShort(r, s), s += 2, a.yMin = t.readShort(r, s), s += 2, a.xMax = t.readShort(r, s), s += 2, a.yMax = t.readShort(r, s), s += 2, a.xMin >= a.xMax || a.yMin >= a.yMax) return null;
1005
1005
  if (a.noc > 0) {
1006
1006
  a.endPts = [];
1007
1007
  for (var n = 0; n < a.noc; n++)
1008
1008
  a.endPts.push(t.readUshort(r, s)), s += 2;
1009
- var l = t.readUshort(r, s);
1010
- if (s += 2, r.length - s < l) return null;
1011
- s += l;
1009
+ var h = t.readUshort(r, s);
1010
+ if (s += 2, r.length - s < h) return null;
1011
+ s += h;
1012
1012
  var c = a.endPts[a.noc - 1] + 1;
1013
1013
  a.flags = [];
1014
1014
  for (var n = 0; n < c; n++) {
@@ -1071,8 +1071,8 @@ class me {
1071
1071
  if (!(i === 65535 && s === 65535)) {
1072
1072
  for (let a = i; a <= s; a++)
1073
1073
  if (this._calculateGlyphIndexFormat4(e, a, r) > 0) {
1074
- const l = String.fromCodePoint(a);
1075
- t.push(l);
1074
+ const h = String.fromCodePoint(a);
1075
+ t.push(h);
1076
1076
  }
1077
1077
  }
1078
1078
  }
@@ -1155,9 +1155,9 @@ class ge {
1155
1155
  * @returns Object containing framebuffer, columns, and rows
1156
1156
  */
1157
1157
  createTextureAtlas(e, t, r, i) {
1158
- const s = e.length, a = Math.ceil(Math.sqrt(s)), n = Math.ceil(s / a), l = t.width * a, c = t.height * n;
1159
- this._setupCanvas(l, c, r, i), this._renderCharactersToCanvas(e, t, a, r), this._applyBlackWhiteThreshold();
1160
- const u = this._renderer.createFramebuffer(l, c, { filter: "nearest" });
1158
+ const s = e.length, a = Math.ceil(Math.sqrt(s)), n = Math.ceil(s / a), h = t.width * a, c = t.height * n;
1159
+ this._setupCanvas(h, c, r, i), this._renderCharactersToCanvas(e, t, a, r), this._applyBlackWhiteThreshold();
1160
+ const u = this._renderer.createFramebuffer(h, c, { filter: "nearest" });
1161
1161
  return u.update(this._textureCanvas), {
1162
1162
  framebuffer: u,
1163
1163
  columns: a,
@@ -1185,7 +1185,7 @@ class ge {
1185
1185
  */
1186
1186
  _renderCharactersToCanvas(e, t, r, i) {
1187
1187
  for (let s = 0; s < e.length; s++) {
1188
- const a = s % r, n = Math.floor(s / r), l = a * t.width + t.width * 0.5, c = n * t.height + t.height * 0.5, u = Math.round(l - t.width * 0.5), d = Math.round(c - i * 0.5);
1188
+ const a = s % r, n = Math.floor(s / r), h = a * t.width + t.width * 0.5, c = n * t.height + t.height * 0.5, u = Math.round(h - t.width * 0.5), d = Math.round(c - i * 0.5);
1189
1189
  this._textureContext.fillText(e[s].character, u, d);
1190
1190
  }
1191
1191
  }
@@ -1225,8 +1225,8 @@ class pe {
1225
1225
  this._tempContext.font = `${t}px ${r}`;
1226
1226
  let i = 0, s = 0;
1227
1227
  for (const a of e) {
1228
- const n = this._tempContext.measureText(a), l = n.width, c = n.actualBoundingBoxAscent + n.actualBoundingBoxDescent;
1229
- l > 0 && (i = Math.max(i, l), s = Math.max(s, c));
1228
+ const n = this._tempContext.measureText(a), h = n.width, c = n.actualBoundingBoxAscent + n.actualBoundingBoxDescent;
1229
+ h > 0 && (i = Math.max(i, h), s = Math.max(s, c));
1230
1230
  }
1231
1231
  return {
1232
1232
  width: Math.ceil(i),
@@ -1246,8 +1246,8 @@ class _e {
1246
1246
  const s = r.codePointAt(0) || 0, a = this._generateCharacterColor(i);
1247
1247
  let n = 0;
1248
1248
  if (t.hmtx && t.hmtx.aWidth) {
1249
- const l = this._getGlyphIndex(t, s);
1250
- l > 0 && t.hmtx.aWidth[l] !== void 0 && (n = t.hmtx.aWidth[l]);
1249
+ const h = this._getGlyphIndex(t, s);
1250
+ h > 0 && t.hmtx.aWidth[h] !== void 0 && (n = t.hmtx.aWidth[h]);
1251
1251
  }
1252
1252
  return {
1253
1253
  character: r,
@@ -1634,7 +1634,7 @@ class Ce {
1634
1634
  var i;
1635
1635
  const r = document.createElement("canvas");
1636
1636
  if (r.className = "textmodeCanvas", this._isStandalone)
1637
- r.width = e || 800, r.height = t || 600, r.style.width = e + "px", r.style.height = t + "px", document.body.appendChild(r);
1637
+ r.width = e || 800, r.height = t || 600, document.body.appendChild(r);
1638
1638
  else {
1639
1639
  const s = this.captureSource.getBoundingClientRect();
1640
1640
  let a = Math.round(s.width), n = Math.round(s.height);
@@ -1642,9 +1642,9 @@ class Ce {
1642
1642
  const u = this.captureSource;
1643
1643
  (a === 0 || n === 0) && u.videoWidth > 0 && u.videoHeight > 0 && (a = u.videoWidth, n = u.videoHeight);
1644
1644
  }
1645
- r.width = a, r.height = n, r.style.width = a + "px", r.style.height = n + "px", r.style.position = "absolute", r.style.pointerEvents = "none";
1646
- const l = window.getComputedStyle(this.captureSource);
1647
- let c = parseInt(l.zIndex || "0", 10);
1645
+ r.width = a, r.height = n, r.style.position = "absolute", r.style.pointerEvents = "none";
1646
+ const h = window.getComputedStyle(this.captureSource);
1647
+ let c = parseInt(h.zIndex || "0", 10);
1648
1648
  isNaN(c) && (c = 0), r.style.zIndex = (c + 1).toString(), this.positionOverlayCanvas(r), (i = this.captureSource.parentNode) == null || i.insertBefore(r, this.captureSource.nextSibling);
1649
1649
  }
1650
1650
  return r;
@@ -1660,7 +1660,7 @@ class Ce {
1660
1660
  }
1661
1661
  resize(e, t) {
1662
1662
  if (this._isStandalone)
1663
- this._canvas.width = e ?? this._canvas.width, this._canvas.height = t ?? this._canvas.height, this._canvas.style.width = (e ?? this._canvas.width) + "px", this._canvas.style.height = (t ?? this._canvas.height) + "px";
1663
+ this._canvas.width = e ?? this._canvas.width, this._canvas.height = t ?? this._canvas.height;
1664
1664
  else {
1665
1665
  const r = this.captureSource.getBoundingClientRect();
1666
1666
  let i = Math.round(r.width), s = Math.round(r.height);
@@ -1668,7 +1668,7 @@ class Ce {
1668
1668
  const a = this.captureSource;
1669
1669
  (i === 0 || s === 0) && a.videoWidth > 0 && a.videoHeight > 0 && (i = a.videoWidth, s = a.videoHeight);
1670
1670
  }
1671
- this._canvas.width = i, this._canvas.height = s, this._canvas.style.width = i + "px", this._canvas.style.height = s + "px", this.positionOverlayCanvas(this._canvas);
1671
+ this._canvas.width = i, this._canvas.height = s, this.positionOverlayCanvas(this._canvas);
1672
1672
  }
1673
1673
  }
1674
1674
  /**
@@ -2296,10 +2296,10 @@ class Ae extends H {
2296
2296
  * @returns Transform data object
2297
2297
  */
2298
2298
  extractTransformData(e, t, r) {
2299
- const i = e[r], s = e[r + 1], a = e[r + 2], n = i === 255, l = s === 255, c = a === 255, u = t[r], d = t[r + 1], f = u + d / 255, g = Math.round(f * 360 / 255 * 100) / 100;
2299
+ const i = e[r], s = e[r + 1], a = e[r + 2], n = i === 255, h = s === 255, c = a === 255, u = t[r], d = t[r + 1], f = u + d / 255, g = Math.round(f * 360 / 255 * 100) / 100;
2300
2300
  return {
2301
2301
  isInverted: n,
2302
- flipHorizontal: l,
2302
+ flipHorizontal: h,
2303
2303
  flipVertical: c,
2304
2304
  rotation: g
2305
2305
  };
@@ -2331,7 +2331,7 @@ class Ae extends H {
2331
2331
  let i = 0;
2332
2332
  for (let s = 0; s < t.rows; s++)
2333
2333
  for (let a = 0; a < t.cols; a++) {
2334
- const n = i * 4, l = this.getCharacterIndex(
2334
+ const n = i * 4, h = this.getCharacterIndex(
2335
2335
  e.characterPixels,
2336
2336
  n
2337
2337
  );
@@ -2347,7 +2347,7 @@ class Ae extends H {
2347
2347
  }
2348
2348
  const f = this.calculateCellPosition(a, s, t);
2349
2349
  r.push({
2350
- charIndex: l,
2350
+ charIndex: h,
2351
2351
  primaryColor: c,
2352
2352
  secondaryColor: u,
2353
2353
  transform: d,
@@ -2428,8 +2428,8 @@ class Me {
2428
2428
  */
2429
2429
  glyphToSVGPath(e, t, r, i) {
2430
2430
  if (!e || !e.xs) return "";
2431
- const { xs: s, ys: a, endPts: n, flags: l } = e;
2432
- if (!s || !a || !n || !l) return "";
2431
+ const { xs: s, ys: a, endPts: n, flags: h } = e;
2432
+ if (!s || !a || !n || !h) return "";
2433
2433
  let c = "", u = 0;
2434
2434
  for (let d = 0; d < n.length; d++) {
2435
2435
  const f = n[d];
@@ -2439,13 +2439,13 @@ class Me {
2439
2439
  c += `M${g.toFixed(2)},${_.toFixed(2)}`;
2440
2440
  let p = u + 1;
2441
2441
  for (; p <= f; )
2442
- if ((l[p] & 1) !== 0) {
2442
+ if ((h[p] & 1) !== 0) {
2443
2443
  const b = t + s[p] * i, v = r - a[p] * i;
2444
2444
  c += `L${b.toFixed(2)},${v.toFixed(2)}`, p++;
2445
2445
  } else {
2446
2446
  const b = t + s[p] * i, v = r - a[p] * i;
2447
2447
  let w = p + 1 > f ? u : p + 1;
2448
- if ((l[w] & 1) !== 0) {
2448
+ if ((h[w] & 1) !== 0) {
2449
2449
  const R = t + s[w] * i, y = r - a[w] * i;
2450
2450
  c += `Q${b.toFixed(2)},${v.toFixed(2)} ${R.toFixed(2)},${y.toFixed(2)}`, p = w + 1;
2451
2451
  } else {
@@ -2474,13 +2474,13 @@ class Me {
2474
2474
  const a = e.codePointAt(0) || 0, n = this.getGlyphIndex(t, a);
2475
2475
  if (n === 0)
2476
2476
  return this.createEmptyPath();
2477
- let l = null;
2477
+ let h = null;
2478
2478
  try {
2479
- t.glyf && t.glyf[n] !== null ? l = t.glyf[n] : m && m.T && m.T.glyf && m.T.glyf._parseGlyf && (l = m.T.glyf._parseGlyf(t, n), t.glyf && l && (t.glyf[n] = l));
2479
+ t.glyf && t.glyf[n] !== null ? h = t.glyf[n] : m && m.T && m.T.glyf && m.T.glyf._parseGlyf && (h = m.T.glyf._parseGlyf(t, n), t.glyf && h && (t.glyf[n] = h));
2480
2480
  } catch (c) {
2481
2481
  console.warn(`Failed to parse glyph ${n}:`, c);
2482
2482
  }
2483
- return l ? this.createGlyphPath(t, l, r, i, s) : this.createEmptyPath();
2483
+ return h ? this.createGlyphPath(t, h, r, i, s) : this.createEmptyPath();
2484
2484
  } catch (a) {
2485
2485
  return console.warn(`Failed to generate path for character "${e}":`, a), this.createEmptyPath();
2486
2486
  }
@@ -2497,9 +2497,9 @@ class Me {
2497
2497
  * @param advanceWidth Character advance width
2498
2498
  * @returns SVG path data string or null if generation fails
2499
2499
  */
2500
- generatePositionedCharacterPath(e, t, r, i, s, a, n, l) {
2500
+ generatePositionedCharacterPath(e, t, r, i, s, a, n, h) {
2501
2501
  try {
2502
- const c = n / t.head.unitsPerEm, u = l * c, d = r + (s - u) / 2, f = i + (a + n * 0.7) / 2;
2502
+ const c = n / t.head.unitsPerEm, u = h * c, d = r + (s - u) / 2, f = i + (a + n * 0.7) / 2;
2503
2503
  return this.generateCharacterPath(e, t, d, f, n).toSVG() || null;
2504
2504
  } catch (c) {
2505
2505
  return console.warn(`Failed to generate positioned character path for "${e}":`, c), null;
@@ -2563,8 +2563,8 @@ class De {
2563
2563
  generateTransformAttribute(e, t) {
2564
2564
  const { transform: r, position: i } = e, s = i.cellX + t.cellWidth / 2, a = i.cellY + t.cellHeight / 2, n = [];
2565
2565
  if (r.flipHorizontal || r.flipVertical) {
2566
- const l = r.flipHorizontal ? -1 : 1, c = r.flipVertical ? -1 : 1;
2567
- n.push(`translate(${s} ${a})`), n.push(`scale(${l} ${c})`), n.push(`translate(${-s} ${-a})`);
2566
+ const h = r.flipHorizontal ? -1 : 1, c = r.flipVertical ? -1 : 1;
2567
+ n.push(`translate(${s} ${a})`), n.push(`scale(${h} ${c})`), n.push(`translate(${-s} ${-a})`);
2568
2568
  }
2569
2569
  return r.rotation && n.push(`rotate(${r.rotation} ${s} ${a})`), n.length ? ` transform="${n.join(" ")}"` : "";
2570
2570
  }
@@ -2749,7 +2749,7 @@ class Pe extends H {
2749
2749
  var n;
2750
2750
  const s = [];
2751
2751
  let a = 0;
2752
- for (let l = 0; l < t.rows; l++) {
2752
+ for (let h = 0; h < t.rows; h++) {
2753
2753
  const c = [];
2754
2754
  for (let u = 0; u < t.cols; u++) {
2755
2755
  const d = a * 4, f = this.getCharacterIndex(
@@ -2869,8 +2869,8 @@ class Ve extends H {
2869
2869
  const i = e.canvas;
2870
2870
  if (t === 1 && r === "transparent")
2871
2871
  return i;
2872
- const s = document.createElement("canvas"), a = s.getContext("2d"), n = Math.round(i.width * t), l = Math.round(i.height * t);
2873
- return s.width = n, s.height = l, r !== "transparent" && (a.fillStyle = r, a.fillRect(0, 0, n, l)), a.imageSmoothingEnabled = !1, a.drawImage(
2872
+ const s = document.createElement("canvas"), a = s.getContext("2d"), n = Math.round(i.width * t), h = Math.round(i.height * t);
2873
+ return s.width = n, s.height = h, r !== "transparent" && (a.fillStyle = r, a.fillRect(0, 0, n, h)), a.imageSmoothingEnabled = !1, a.drawImage(
2874
2874
  i,
2875
2875
  0,
2876
2876
  0,
@@ -2879,7 +2879,7 @@ class Ve extends H {
2879
2879
  0,
2880
2880
  0,
2881
2881
  n,
2882
- l
2882
+ h
2883
2883
  ), s;
2884
2884
  }
2885
2885
  }
@@ -4078,7 +4078,7 @@ class O {
4078
4078
  * ```
4079
4079
  */
4080
4080
  static get version() {
4081
- return "0.1.2";
4081
+ return "0.1.4-beta.1";
4082
4082
  }
4083
4083
  constructor() {
4084
4084
  throw new Error("Textmode is a static class and cannot be instantiated.");