@mlightcad/mtext-parser 1.0.4 → 1.0.5

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/parser.es.js CHANGED
@@ -1,9 +1,9 @@
1
- var k = /* @__PURE__ */ ((r) => (r[r.NONE = 0] = "NONE", r[r.WORD = 1] = "WORD", r[r.STACK = 2] = "STACK", r[r.SPACE = 3] = "SPACE", r[r.NBSP = 4] = "NBSP", r[r.TABULATOR = 5] = "TABULATOR", r[r.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", r[r.NEW_COLUMN = 7] = "NEW_COLUMN", r[r.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", r[r.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", r))(k || {}), b = /* @__PURE__ */ ((r) => (r[r.BOTTOM = 0] = "BOTTOM", r[r.MIDDLE = 1] = "MIDDLE", r[r.TOP = 2] = "TOP", r))(b || {}), E = /* @__PURE__ */ ((r) => (r[r.DEFAULT = 0] = "DEFAULT", r[r.LEFT = 1] = "LEFT", r[r.RIGHT = 2] = "RIGHT", r[r.CENTER = 3] = "CENTER", r[r.JUSTIFIED = 4] = "JUSTIFIED", r[r.DISTRIBUTED = 5] = "DISTRIBUTED", r))(E || {}), m = /* @__PURE__ */ ((r) => (r[r.NONE = 0] = "NONE", r[r.UNDERLINE = 1] = "UNDERLINE", r[r.OVERLINE = 2] = "OVERLINE", r[r.STRIKE_THROUGH = 4] = "STRIKE_THROUGH", r))(m || {});
2
- const F = {
1
+ var k = /* @__PURE__ */ ((s) => (s[s.NONE = 0] = "NONE", s[s.WORD = 1] = "WORD", s[s.STACK = 2] = "STACK", s[s.SPACE = 3] = "SPACE", s[s.NBSP = 4] = "NBSP", s[s.TABULATOR = 5] = "TABULATOR", s[s.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", s[s.NEW_COLUMN = 7] = "NEW_COLUMN", s[s.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", s[s.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", s))(k || {}), b = /* @__PURE__ */ ((s) => (s[s.BOTTOM = 0] = "BOTTOM", s[s.MIDDLE = 1] = "MIDDLE", s[s.TOP = 2] = "TOP", s))(b || {}), _ = /* @__PURE__ */ ((s) => (s[s.DEFAULT = 0] = "DEFAULT", s[s.LEFT = 1] = "LEFT", s[s.RIGHT = 2] = "RIGHT", s[s.CENTER = 3] = "CENTER", s[s.JUSTIFIED = 4] = "JUSTIFIED", s[s.DISTRIBUTED = 5] = "DISTRIBUTED", s))(_ || {}), E = /* @__PURE__ */ ((s) => (s[s.NONE = 0] = "NONE", s[s.UNDERLINE = 1] = "UNDERLINE", s[s.OVERLINE = 2] = "OVERLINE", s[s.STRIKE_THROUGH = 4] = "STRIKE_THROUGH", s))(E || {});
2
+ const m = {
3
3
  c: "Ø",
4
4
  d: "°",
5
5
  p: "±"
6
- }, S = {
6
+ }, F = {
7
7
  l: 1,
8
8
  r: 2,
9
9
  c: 3,
@@ -11,36 +11,36 @@ const F = {
11
11
  d: 5
12
12
  /* DISTRIBUTED */
13
13
  };
14
- function N(r) {
15
- const [e, t, s] = r;
16
- return s << 16 | t << 8 | e;
14
+ function I(s) {
15
+ const [e, t, r] = s;
16
+ return r << 16 | t << 8 | e;
17
17
  }
18
- function _(r) {
19
- const e = r & 255, t = r >> 8 & 255, s = r >> 16 & 255;
20
- return [e, t, s];
18
+ function R(s) {
19
+ const e = s & 255, t = s >> 8 & 255, r = s >> 16 & 255;
20
+ return [e, t, r];
21
21
  }
22
- function I(r) {
23
- return r.replace(/\^(.)/g, (e, t) => {
24
- const s = t.charCodeAt(0);
25
- return s === 32 ? "^" : s === 73 ? " " : s === 74 ? `
26
- ` : s === 77 ? "" : "▯";
22
+ function S(s) {
23
+ return s.replace(/\^(.)/g, (e, t) => {
24
+ const r = t.charCodeAt(0);
25
+ return r === 32 ? "^" : r === 73 ? " " : r === 74 ? `
26
+ ` : r === 77 ? "" : "▯";
27
27
  });
28
28
  }
29
- function O(r) {
30
- return r.replace(/\r\n|\r|\n/g, "\\P");
29
+ function N(s) {
30
+ return s.replace(/\r\n|\r|\n/g, "\\P");
31
31
  }
32
- function R(r) {
33
- return r.replace(/\\P/g, "").replace(/\\~/g, "").includes("\\");
32
+ function O(s) {
33
+ return s.replace(/\\P/g, "").replace(/\\~/g, "").includes("\\");
34
34
  }
35
- class D {
35
+ class v {
36
36
  /**
37
37
  * Creates a new MTextParser instance
38
38
  * @param content - The MText content to parse
39
39
  * @param ctx - Optional initial MText context
40
40
  * @param yieldPropertyCommands - Whether to yield property change commands
41
41
  */
42
- constructor(e, t, s = !1) {
43
- this.ctxStack = [], this.continueStroke = !1, this.scanner = new p(I(e)), this.ctx = t ?? new f(), this.lastCtx = this.ctx.copy(), this.yieldPropertyCommands = s, this.decoder = new TextDecoder("gbk");
42
+ constructor(e, t, r = !1) {
43
+ this.ctxStack = [], this.continueStroke = !1, this.scanner = new p(S(e)), this.ctx = t ?? new g(), this.lastCtx = this.ctx.copy(), this.yieldPropertyCommands = r, this.decoder = new TextDecoder("gbk");
44
44
  }
45
45
  /**
46
46
  * Decode multi-byte character from hex code
@@ -76,28 +76,28 @@ class D {
76
76
  */
77
77
  parseStacking() {
78
78
  const e = new p(this.extractExpression(!0));
79
- let t = "", s = "", n = "";
79
+ let t = "", r = "", n = "";
80
80
  const i = () => {
81
- let a = e.peek(), h = !1;
82
- return a.charCodeAt(0) < 32 && (a = " "), a === "\\" && (h = !0, e.consume(1), a = e.peek()), e.consume(1), [a, h];
81
+ let a = e.peek(), o = !1;
82
+ return a.charCodeAt(0) < 32 && (a = " "), a === "\\" && (o = !0, e.consume(1), a = e.peek()), e.consume(1), [a, o];
83
83
  }, c = () => {
84
84
  let a = "";
85
85
  for (; e.hasData; ) {
86
- const [h, o] = i();
87
- if (!o && "^/#".includes(h))
88
- return [a, h];
89
- a += h;
86
+ const [o, h] = i();
87
+ if (!h && "^/#".includes(o))
88
+ return [a, o];
89
+ a += o;
90
90
  }
91
91
  return [a, ""];
92
- }, l = () => {
92
+ }, u = () => {
93
93
  let a = "";
94
94
  for (; e.hasData; ) {
95
- const [h, o] = i();
96
- o && h === ";" ? a += ";" : a += h;
95
+ const [o, h] = i();
96
+ h && o === ";" ? a += ";" : a += o;
97
97
  }
98
98
  return a;
99
99
  };
100
- return [t, n] = c(), n && (s = l()), [2, [t, s, n]];
100
+ return [t, n] = c(), n && (r = u()), [2, [t, r, n]];
101
101
  }
102
102
  /**
103
103
  * Parse MText properties
@@ -157,11 +157,11 @@ class D {
157
157
  throw new Error(`Unknown command: ${e}`);
158
158
  }
159
159
  if (t.continueStroke = this.continueStroke, this.ctx = t, this.yieldPropertyCommands) {
160
- const s = this.getPropertyChanges(this.lastCtx, t);
161
- if (Object.keys(s).length > 0)
160
+ const r = this.getPropertyChanges(this.lastCtx, t);
161
+ if (Object.keys(r).length > 0)
162
162
  return this.lastCtx = this.ctx.copy(), {
163
163
  command: e,
164
- changes: s
164
+ changes: r
165
165
  };
166
166
  }
167
167
  }
@@ -172,12 +172,12 @@ class D {
172
172
  * @returns Object containing changed properties
173
173
  */
174
174
  getPropertyChanges(e, t) {
175
- const s = {};
176
- if (e.underline !== t.underline && (s.underline = t.underline), e.overline !== t.overline && (s.overline = t.overline), e.strikeThrough !== t.strikeThrough && (s.strikeThrough = t.strikeThrough), e.aci !== t.aci && (s.aci = t.aci, s.rgb = t.rgb), e.rgb !== t.rgb && (s.rgb = t.rgb), e.align !== t.align && (s.align = t.align), JSON.stringify(e.fontFace) !== JSON.stringify(t.fontFace) && (s.fontFace = t.fontFace), e.capHeight !== t.capHeight && (s.capHeight = t.capHeight), e.widthFactor !== t.widthFactor && (s.widthFactor = t.widthFactor), e.charTrackingFactor !== t.charTrackingFactor && (s.charTrackingFactor = t.charTrackingFactor), e.oblique !== t.oblique && (s.oblique = t.oblique), JSON.stringify(e.paragraph) !== JSON.stringify(t.paragraph)) {
175
+ const r = {};
176
+ if (e.underline !== t.underline && (r.underline = t.underline), e.overline !== t.overline && (r.overline = t.overline), e.strikeThrough !== t.strikeThrough && (r.strikeThrough = t.strikeThrough), e.aci !== t.aci && (r.aci = t.aci, r.rgb = t.rgb), e.rgb !== t.rgb && (r.rgb = t.rgb), e.align !== t.align && (r.align = t.align), JSON.stringify(e.fontFace) !== JSON.stringify(t.fontFace) && (r.fontFace = t.fontFace), (e.capHeight !== t.capHeight || e.isHeightRelative !== t.isHeightRelative) && (r.capHeight = t.capHeight, r.isHeightRelative = t.isHeightRelative), (e.widthFactor !== t.widthFactor || e.isWidthRelative !== t.isWidthRelative) && (r.widthFactor = t.widthFactor, r.isWidthRelative = t.isWidthRelative), e.charTrackingFactor !== t.charTrackingFactor && (r.charTrackingFactor = t.charTrackingFactor), e.oblique !== t.oblique && (r.oblique = t.oblique), JSON.stringify(e.paragraph) !== JSON.stringify(t.paragraph)) {
177
177
  const n = {};
178
- e.paragraph.indent !== t.paragraph.indent && (n.indent = t.paragraph.indent), e.paragraph.align !== t.paragraph.align && (n.align = t.paragraph.align), e.paragraph.left !== t.paragraph.left && (n.left = t.paragraph.left), e.paragraph.right !== t.paragraph.right && (n.right = t.paragraph.right), JSON.stringify(e.paragraph.tab_stops) !== JSON.stringify(t.paragraph.tab_stops) && (n.tab_stops = t.paragraph.tab_stops), Object.keys(n).length > 0 && (s.paragraph = n);
178
+ e.paragraph.indent !== t.paragraph.indent && (n.indent = t.paragraph.indent), e.paragraph.align !== t.paragraph.align && (n.align = t.paragraph.align), e.paragraph.left !== t.paragraph.left && (n.left = t.paragraph.left), e.paragraph.right !== t.paragraph.right && (n.right = t.paragraph.right), JSON.stringify(e.paragraph.tab_stops) !== JSON.stringify(t.paragraph.tab_stops) && (n.tab_stops = t.paragraph.tab_stops), Object.keys(n).length > 0 && (r.paragraph = n);
179
179
  }
180
- return s;
180
+ return r;
181
181
  }
182
182
  /**
183
183
  * Parse alignment property
@@ -195,7 +195,13 @@ class D {
195
195
  const t = this.extractFloatExpression(!0);
196
196
  if (t)
197
197
  try {
198
- t.endsWith("x") ? e.capHeight = Math.abs(parseFloat(t.slice(0, -1))) : e.capHeight = Math.abs(parseFloat(t));
198
+ t.endsWith("x") ? e.capHeight = {
199
+ value: parseFloat(t.slice(0, -1)),
200
+ isRelative: !0
201
+ } : e.capHeight = {
202
+ value: parseFloat(t),
203
+ isRelative: !1
204
+ };
199
205
  } catch {
200
206
  this.scanner.consume(-t.length);
201
207
  return;
@@ -210,7 +216,13 @@ class D {
210
216
  const t = this.extractFloatExpression(!0);
211
217
  if (t)
212
218
  try {
213
- t.endsWith("x") ? e.widthFactor = Math.abs(parseFloat(t.slice(0, -1))) : e.widthFactor = Math.abs(parseFloat(t));
219
+ t.endsWith("x") ? e.widthFactor = {
220
+ value: parseFloat(t.slice(0, -1)),
221
+ isRelative: !0
222
+ } : e.widthFactor = {
223
+ value: parseFloat(t),
224
+ isRelative: !1
225
+ };
214
226
  } catch {
215
227
  this.scanner.consume(-t.length);
216
228
  return;
@@ -241,8 +253,8 @@ class D {
241
253
  const t = this.extractFloatExpression(!0);
242
254
  if (t)
243
255
  if (t.endsWith("x")) {
244
- const s = parseFloat(t.slice(0, -1));
245
- e *= Math.abs(s);
256
+ const r = parseFloat(t.slice(0, -1));
257
+ e *= Math.abs(r);
246
258
  } else
247
259
  e = Math.abs(parseFloat(t));
248
260
  return e;
@@ -262,8 +274,8 @@ class D {
262
274
  parseAciColor(e) {
263
275
  const t = this.extractIntExpression();
264
276
  if (t) {
265
- const s = parseInt(t);
266
- s < 257 && (e.aci = s, e.rgb = null);
277
+ const r = parseInt(t);
278
+ r < 257 && (e.aci = r, e.rgb = null);
267
279
  }
268
280
  this.consumeOptionalTerminator();
269
281
  }
@@ -274,7 +286,7 @@ class D {
274
286
  parseRgbColor(e) {
275
287
  const t = this.extractIntExpression();
276
288
  if (t) {
277
- const s = parseInt(t) & 16777215, [n, i, c] = _(s);
289
+ const r = parseInt(t) & 16777215, [n, i, c] = R(r);
278
290
  e.rgb = [c, i, n];
279
291
  }
280
292
  this.consumeOptionalTerminator();
@@ -285,9 +297,9 @@ class D {
285
297
  * @returns Extracted expression
286
298
  */
287
299
  extractFloatExpression(e = !1) {
288
- const t = e ? /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?x?/ : /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/, s = this.scanner.tail.match(t);
289
- if (s) {
290
- const n = s[0];
300
+ const t = e ? /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?x?/ : /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/, r = this.scanner.tail.match(t);
301
+ if (r) {
302
+ const n = r[0];
291
303
  return this.scanner.consume(n.length), n;
292
304
  }
293
305
  return "";
@@ -325,12 +337,12 @@ class D {
325
337
  parseFontProperties(e) {
326
338
  const t = this.extractExpression().split("|");
327
339
  if (t.length > 0 && t[0]) {
328
- const s = t[0];
340
+ const r = t[0];
329
341
  let n = "Regular", i = 400;
330
342
  for (const c of t.slice(1))
331
343
  c.startsWith("b1") ? i = 700 : c.startsWith("i1") && (n = "Italic");
332
344
  e.fontFace = {
333
- family: s,
345
+ family: r,
334
346
  style: n,
335
347
  weight: i
336
348
  };
@@ -343,21 +355,21 @@ class D {
343
355
  */
344
356
  parseParagraphProperties(e) {
345
357
  const t = new p(this.extractExpression());
346
- let s = e.paragraph.indent, n = e.paragraph.left, i = e.paragraph.right, c = e.paragraph.align, l = [];
358
+ let r = e.paragraph.indent, n = e.paragraph.left, i = e.paragraph.right, c = e.paragraph.align, u = [];
347
359
  const a = () => {
348
- const h = t.tail.match(/^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/);
349
- if (h) {
350
- const o = parseFloat(h[0]);
351
- for (t.consume(h[0].length); t.peek() === ","; )
360
+ const o = t.tail.match(/^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?/);
361
+ if (o) {
362
+ const h = parseFloat(o[0]);
363
+ for (t.consume(o[0].length); t.peek() === ","; )
352
364
  t.consume(1);
353
- return o;
365
+ return h;
354
366
  }
355
367
  return 0;
356
368
  };
357
369
  for (; t.hasData; )
358
370
  switch (t.get()) {
359
371
  case "i":
360
- s = a();
372
+ r = a();
361
373
  break;
362
374
  case "l":
363
375
  n = a();
@@ -368,31 +380,31 @@ class D {
368
380
  case "x":
369
381
  break;
370
382
  case "q": {
371
- const o = t.get();
372
- for (c = S[o] || 0; t.peek() === ","; )
383
+ const h = t.get();
384
+ for (c = F[h] || 0; t.peek() === ","; )
373
385
  t.consume(1);
374
386
  break;
375
387
  }
376
388
  case "t":
377
- for (l = []; t.hasData; ) {
378
- const o = t.peek();
379
- if (o === "r" || o === "c") {
389
+ for (u = []; t.hasData; ) {
390
+ const h = t.peek();
391
+ if (h === "r" || h === "c") {
380
392
  t.consume(1);
381
- const u = a();
382
- l.push(o + u.toString());
393
+ const l = a();
394
+ u.push(h + l.toString());
383
395
  } else {
384
- const u = a();
385
- isNaN(u) ? t.consume(1) : l.push(u);
396
+ const l = a();
397
+ isNaN(l) ? t.consume(1) : u.push(l);
386
398
  }
387
399
  }
388
400
  break;
389
401
  }
390
402
  e.paragraph = {
391
- indent: s,
403
+ indent: r,
392
404
  left: n,
393
405
  right: i,
394
406
  align: c,
395
- tab_stops: l
407
+ tab_stops: u
396
408
  };
397
409
  }
398
410
  /**
@@ -406,13 +418,13 @@ class D {
406
418
  * @yields MTextToken objects
407
419
  */
408
420
  *parse() {
409
- let s = null;
421
+ let r = null;
410
422
  const n = () => {
411
423
  var c;
412
424
  let i = "";
413
425
  for (; this.scanner.hasData; ) {
414
- let l = !1, a = this.scanner.peek();
415
- const h = this.scanner.currentIndex;
426
+ let u = !1, a = this.scanner.peek();
427
+ const o = this.scanner.currentIndex;
416
428
  if (a.charCodeAt(0) < 32) {
417
429
  if (this.scanner.consume(1), a === " ")
418
430
  return [5, null];
@@ -423,13 +435,13 @@ class D {
423
435
  }
424
436
  if (a === "\\")
425
437
  if ("\\{}".includes(this.scanner.peek(1)))
426
- l = !0, this.scanner.consume(1), a = this.scanner.peek();
438
+ u = !0, this.scanner.consume(1), a = this.scanner.peek();
427
439
  else {
428
440
  if (i)
429
441
  return [1, i];
430
442
  this.scanner.consume(1);
431
- const o = this.scanner.get();
432
- switch (o) {
443
+ const h = this.scanner.get();
444
+ switch (h) {
433
445
  case "~":
434
446
  return [4, null];
435
447
  case "P":
@@ -444,10 +456,10 @@ class D {
444
456
  case "M":
445
457
  if (this.scanner.peek() === "+") {
446
458
  this.scanner.consume(1);
447
- const u = (c = this.scanner.tail.match(/^[0-9A-Fa-f]{4}/)) == null ? void 0 : c[0];
448
- if (u) {
459
+ const l = (c = this.scanner.tail.match(/^[0-9A-Fa-f]{4}/)) == null ? void 0 : c[0];
460
+ if (l) {
449
461
  this.scanner.consume(4);
450
- const d = this.decodeMultiByteChar(u);
462
+ const d = this.decodeMultiByteChar(l);
451
463
  return i ? [1, i] : [1, d];
452
464
  }
453
465
  this.scanner.consume(-1);
@@ -455,26 +467,26 @@ class D {
455
467
  i += "\\M";
456
468
  continue;
457
469
  default:
458
- if (o)
470
+ if (h)
459
471
  try {
460
- const u = this.parseProperties(o);
461
- if (this.yieldPropertyCommands && u)
462
- return this.lastCtx = this.ctx.copy(), [9, u];
472
+ const l = this.parseProperties(h);
473
+ if (this.yieldPropertyCommands && l)
474
+ return this.lastCtx = this.ctx.copy(), [9, l];
463
475
  continue;
464
476
  } catch {
465
- const u = this.scanner.tail.slice(
466
- h,
477
+ const l = this.scanner.tail.slice(
478
+ o,
467
479
  this.scanner.currentIndex
468
480
  );
469
- i += u;
481
+ i += l;
470
482
  }
471
483
  }
472
484
  continue;
473
485
  }
474
486
  if (a === "%" && this.scanner.peek(1) === "%") {
475
- const o = this.scanner.peek(2).toLowerCase(), u = F[o];
476
- if (u) {
477
- this.scanner.consume(3), i += u;
487
+ const h = this.scanner.peek(2).toLowerCase(), l = m[h];
488
+ if (l) {
489
+ this.scanner.consume(3), i += l;
478
490
  continue;
479
491
  } else {
480
492
  this.scanner.consume(3);
@@ -482,8 +494,8 @@ class D {
482
494
  }
483
495
  }
484
496
  if (a === " ")
485
- return i ? (this.scanner.consume(1), s = 3, [1, i]) : (this.scanner.consume(1), [3, null]);
486
- if (!l) {
497
+ return i ? (this.scanner.consume(1), r = 3, [1, i]) : (this.scanner.consume(1), [3, null]);
498
+ if (!u) {
487
499
  if (a === "{") {
488
500
  if (i)
489
501
  return [1, i];
@@ -503,7 +515,7 @@ class D {
503
515
  for (; ; ) {
504
516
  const [i, c] = n();
505
517
  if (i)
506
- yield new g(i, this.ctx, c), s && (yield new g(s, this.ctx, null), s = null);
518
+ yield new f(i, this.ctx, c), r && (yield new f(r, this.ctx, null), r = null);
507
519
  else
508
520
  break;
509
521
  }
@@ -568,21 +580,21 @@ class p {
568
580
  * @returns Index of the character, or -1 if not found
569
581
  */
570
582
  find(e, t = !1) {
571
- let s = this._index;
572
- for (; s < this.textLen; ) {
573
- if (t && this.text[s] === "\\") {
574
- if (s + 1 < this.textLen) {
575
- if (this.text[s + 1] === e)
576
- return s + 1;
577
- s += 2;
583
+ let r = this._index;
584
+ for (; r < this.textLen; ) {
585
+ if (t && this.text[r] === "\\") {
586
+ if (r + 1 < this.textLen) {
587
+ if (this.text[r + 1] === e)
588
+ return r + 1;
589
+ r += 2;
578
590
  continue;
579
591
  }
580
- s++;
592
+ r++;
581
593
  continue;
582
594
  }
583
- if (this.text[s] === e)
584
- return s;
585
- s++;
595
+ if (this.text[r] === e)
596
+ return r;
597
+ r++;
586
598
  }
587
599
  return -1;
588
600
  }
@@ -609,9 +621,9 @@ class p {
609
621
  return e;
610
622
  }
611
623
  }
612
- class f {
624
+ class g {
613
625
  constructor() {
614
- this._stroke = 0, this.continueStroke = !1, this._aci = 7, this.rgb = null, this.align = 0, this.fontFace = { family: "", style: "Regular", weight: 400 }, this.capHeight = 1, this.widthFactor = 1, this.charTrackingFactor = 1, this.oblique = 0, this.paragraph = {
626
+ this._stroke = 0, this.continueStroke = !1, this._aci = 7, this.rgb = null, this.align = 0, this.fontFace = { family: "", style: "Regular", weight: 400 }, this._capHeight = 1, this._isHeightRelative = !1, this._widthFactor = 1, this._isWidthRelative = !1, this.charTrackingFactor = 1, this.oblique = 0, this.paragraph = {
615
627
  indent: 0,
616
628
  left: 0,
617
629
  right: 0,
@@ -619,6 +631,46 @@ class f {
619
631
  tab_stops: []
620
632
  };
621
633
  }
634
+ /**
635
+ * Get the capital letter height
636
+ */
637
+ get capHeight() {
638
+ return this._capHeight;
639
+ }
640
+ /**
641
+ * Set the capital letter height
642
+ * @param value - Height value
643
+ * @param isRelative - Whether the value is relative
644
+ */
645
+ set capHeight(e) {
646
+ this._capHeight = Math.abs(e.value), this._isHeightRelative = e.isRelative;
647
+ }
648
+ /**
649
+ * Get whether height is relative
650
+ */
651
+ get isHeightRelative() {
652
+ return this._isHeightRelative;
653
+ }
654
+ /**
655
+ * Get the character width factor
656
+ */
657
+ get widthFactor() {
658
+ return this._widthFactor;
659
+ }
660
+ /**
661
+ * Set the character width factor
662
+ * @param value - Width factor value
663
+ * @param isRelative - Whether the value is relative
664
+ */
665
+ set widthFactor(e) {
666
+ this._widthFactor = Math.abs(e.value), this._isWidthRelative = e.isRelative;
667
+ }
668
+ /**
669
+ * Get whether width is relative
670
+ */
671
+ get isWidthRelative() {
672
+ return this._isWidthRelative;
673
+ }
622
674
  /**
623
675
  * Get the ACI color value
624
676
  */
@@ -694,34 +746,34 @@ class f {
694
746
  * @returns A new context with the same properties
695
747
  */
696
748
  copy() {
697
- const e = new f();
698
- return e._stroke = this._stroke, e.continueStroke = this.continueStroke, e._aci = this._aci, e.rgb = this.rgb, e.align = this.align, e.fontFace = { ...this.fontFace }, e.capHeight = this.capHeight, e.widthFactor = this.widthFactor, e.charTrackingFactor = this.charTrackingFactor, e.oblique = this.oblique, e.paragraph = { ...this.paragraph }, e;
749
+ const e = new g();
750
+ return e._stroke = this._stroke, e.continueStroke = this.continueStroke, e._aci = this._aci, e.rgb = this.rgb, e.align = this.align, e.fontFace = { ...this.fontFace }, e._capHeight = this._capHeight, e._isHeightRelative = this._isHeightRelative, e._widthFactor = this._widthFactor, e._isWidthRelative = this._isWidthRelative, e.charTrackingFactor = this.charTrackingFactor, e.oblique = this.oblique, e.paragraph = { ...this.paragraph }, e;
699
751
  }
700
752
  }
701
- class g {
753
+ class f {
702
754
  /**
703
755
  * Create a new MText token
704
756
  * @param type - The token type
705
757
  * @param ctx - The text context at this token
706
758
  * @param data - Optional token data
707
759
  */
708
- constructor(e, t, s) {
709
- this.type = e, this.ctx = t, this.data = s;
760
+ constructor(e, t, r) {
761
+ this.type = e, this.ctx = t, this.data = r;
710
762
  }
711
763
  }
712
764
  export {
713
- f as MTextContext,
765
+ g as MTextContext,
714
766
  b as MTextLineAlignment,
715
- E as MTextParagraphAlignment,
716
- D as MTextParser,
717
- m as MTextStroke,
718
- g as MTextToken,
767
+ _ as MTextParagraphAlignment,
768
+ v as MTextParser,
769
+ E as MTextStroke,
770
+ f as MTextToken,
719
771
  p as TextScanner,
720
772
  k as TokenType,
721
- I as caretDecode,
722
- O as escapeDxfLineEndings,
723
- R as hasInlineFormattingCodes,
724
- _ as int2rgb,
725
- N as rgb2int
773
+ S as caretDecode,
774
+ N as escapeDxfLineEndings,
775
+ O as hasInlineFormattingCodes,
776
+ R as int2rgb,
777
+ I as rgb2int
726
778
  };
727
779
  //# sourceMappingURL=parser.es.js.map