@mlightcad/mtext-renderer 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9896,7 +9896,7 @@ class Mh extends Ma {
9896
9896
  return new fa("?", e, this);
9897
9897
  }
9898
9898
  }
9899
- let le = class {
9899
+ class le {
9900
9900
  /**
9901
9901
  * Converts an unsigned byte to a signed byte as used in SHX format.
9902
9902
  * Values > 127 are converted to their signed equivalent (-128 to -1).
@@ -10051,7 +10051,7 @@ let le = class {
10051
10051
  `Position ${e} is out of range for the data length ${this.data.byteLength}!`
10052
10052
  );
10053
10053
  }
10054
- };
10054
+ }
10055
10055
  var fe = /* @__PURE__ */ ((t) => (t.SHAPES = "shapes", t.BIGFONT = "bigfont", t.UNIFONT = "unifont", t))(fe || {});
10056
10056
  class Ih {
10057
10057
  parse(e) {
@@ -22107,7 +22107,8 @@ class un extends Ia {
22107
22107
  * @param shape - The shape data for this character
22108
22108
  */
22109
22109
  constructor(e, r, n, a) {
22110
- super(), this.fontSize = r, this.shape = n, this.font = a, this.code = e, this.width = this.calcWidth();
22110
+ var i;
22111
+ super(), this.fontSize = r, this.shape = n, this.font = a, this.code = e, a.data.header.fontType === fe.BIGFONT ? this.width = this.calcWidth() : this.width = ((i = n.lastPoint) == null ? void 0 : i.x) ?? this.calcWidth();
22111
22112
  }
22112
22113
  calcWidth() {
22113
22114
  const e = this.shape.bbox;
@@ -22629,7 +22630,8 @@ var nt = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.WORD = 1] = "WORD"
22629
22630
  const Ul = {
22630
22631
  c: "Ø",
22631
22632
  d: "°",
22632
- p: "±"
22633
+ p: "±",
22634
+ "%": "%"
22633
22635
  }, Al = {
22634
22636
  l: 1,
22635
22637
  r: 2,
@@ -23230,7 +23232,12 @@ class Ol {
23230
23232
  this.scanner.consume(3), a += u;
23231
23233
  continue;
23232
23234
  } else {
23233
- this.scanner.consume(3);
23235
+ const h = [c, this.scanner.peek(3), this.scanner.peek(4)];
23236
+ if (h.every((d) => d >= "0" && d <= "9")) {
23237
+ const d = Number.parseInt(h.join(""), 10);
23238
+ this.scanner.consume(5), a += String.fromCharCode(d);
23239
+ } else
23240
+ this.scanner.consume(3);
23234
23241
  continue;
23235
23242
  }
23236
23243
  }
@@ -24931,7 +24938,7 @@ class Pl {
24931
24938
  this.isInitialized || (await this.loadFonts([Oe.instance.defaultFont]), this.isInitialized = !0);
24932
24939
  }
24933
24940
  }
24934
- class zl {
24941
+ class Hl {
24935
24942
  /**
24936
24943
  * Constructor
24937
24944
  *
@@ -25027,6 +25034,6 @@ export {
25027
25034
  Rl as MTextAttachmentPoint,
25028
25035
  wt as MTextFlowDirection,
25029
25036
  Pl as MainThreadRenderer,
25030
- zl as UnifiedRenderer,
25037
+ Hl as UnifiedRenderer,
25031
25038
  _l as WebWorkerRenderer
25032
25039
  };