@mlightcad/mtext-renderer 0.12.5 → 0.12.6
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 +797 -765
- package/dist/index.umd.cjs +9 -9
- package/dist/mtext-renderer-worker.js +324 -292
- package/lib/renderer/unicodeEscapes.d.ts +5 -0
- package/package.json +2 -2
|
@@ -6,10 +6,10 @@ var Ye;
|
|
|
6
6
|
(function(n) {
|
|
7
7
|
n[n.BOTTOM = 0] = "BOTTOM", n[n.MIDDLE = 1] = "MIDDLE", n[n.TOP = 2] = "TOP";
|
|
8
8
|
})(Ye || (Ye = {}));
|
|
9
|
-
var
|
|
9
|
+
var ct;
|
|
10
10
|
(function(n) {
|
|
11
11
|
n[n.DEFAULT = 0] = "DEFAULT", n[n.LEFT = 1] = "LEFT", n[n.RIGHT = 2] = "RIGHT", n[n.CENTER = 3] = "CENTER", n[n.JUSTIFIED = 4] = "JUSTIFIED", n[n.DISTRIBUTED = 5] = "DISTRIBUTED";
|
|
12
|
-
})(
|
|
12
|
+
})(ct || (ct = {}));
|
|
13
13
|
var Ve;
|
|
14
14
|
(function(n) {
|
|
15
15
|
n[n.NONE = 0] = "NONE", n[n.UNDERLINE = 1] = "UNDERLINE", n[n.OVERLINE = 2] = "OVERLINE", n[n.STRIKE_THROUGH = 4] = "STRIKE_THROUGH";
|
|
@@ -20,11 +20,11 @@ const Yl = {
|
|
|
20
20
|
p: "±",
|
|
21
21
|
"%": "%"
|
|
22
22
|
}, $l = {
|
|
23
|
-
l:
|
|
24
|
-
r:
|
|
25
|
-
c:
|
|
26
|
-
j:
|
|
27
|
-
d:
|
|
23
|
+
l: ct.LEFT,
|
|
24
|
+
r: ct.RIGHT,
|
|
25
|
+
c: ct.CENTER,
|
|
26
|
+
j: ct.JUSTIFIED,
|
|
27
|
+
d: ct.DISTRIBUTED
|
|
28
28
|
};
|
|
29
29
|
function Zl(n) {
|
|
30
30
|
const [t, e, s] = n;
|
|
@@ -202,6 +202,41 @@ class nu {
|
|
|
202
202
|
} else
|
|
203
203
|
return ((i = this.scanner.tail.match(new RegExp(`^[0-9A-Fa-f]{${t}}`))) == null ? void 0 : i[0]) ?? null;
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Parse an AutoCAD `\U+nnnn` escape after the leading `U` has been consumed.
|
|
207
|
+
*
|
|
208
|
+
* @remarks
|
|
209
|
+
* Exactly four hexadecimal digits are read. A high surrogate followed by
|
|
210
|
+
* another `\U+nnnn` low surrogate is combined into one supplementary-plane
|
|
211
|
+
* character (AutoCAD's encoding for code points above U+FFFF).
|
|
212
|
+
*
|
|
213
|
+
* @returns The decoded character, or `null` if the escape is incomplete
|
|
214
|
+
*/
|
|
215
|
+
parseUnicodeEscape() {
|
|
216
|
+
if (this.scanner.peek() !== "+")
|
|
217
|
+
return null;
|
|
218
|
+
this.scanner.consume(1);
|
|
219
|
+
const t = this.scanner.tail.match(/^[0-9A-Fa-f]{4}/);
|
|
220
|
+
if (!t)
|
|
221
|
+
return this.scanner.consume(-1), null;
|
|
222
|
+
const e = parseInt(t[0], 16);
|
|
223
|
+
if (this.scanner.consume(t[0].length), e >= 55296 && e <= 56319) {
|
|
224
|
+
const s = this.scanner.tail.match(/^\\U\+([0-9A-Fa-f]{4})/);
|
|
225
|
+
if (s) {
|
|
226
|
+
const i = parseInt(s[1], 16);
|
|
227
|
+
if (i >= 56320 && i <= 57343) {
|
|
228
|
+
this.scanner.consume(s[0].length);
|
|
229
|
+
const r = (e - 55296 << 10) + (i - 56320) + 65536;
|
|
230
|
+
try {
|
|
231
|
+
return String.fromCodePoint(r);
|
|
232
|
+
} catch {
|
|
233
|
+
return "▯";
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return String.fromCharCode(e);
|
|
239
|
+
}
|
|
205
240
|
/**
|
|
206
241
|
* Push current context onto the stack
|
|
207
242
|
*/
|
|
@@ -536,7 +571,7 @@ class nu {
|
|
|
536
571
|
break;
|
|
537
572
|
case "q": {
|
|
538
573
|
const l = e.get();
|
|
539
|
-
for (a = $l[l] ||
|
|
574
|
+
for (a = $l[l] || ct.DEFAULT; e.peek() === ","; )
|
|
540
575
|
e.consume(1);
|
|
541
576
|
break;
|
|
542
577
|
}
|
|
@@ -587,11 +622,11 @@ class nu {
|
|
|
587
622
|
indent: 0,
|
|
588
623
|
left: 0,
|
|
589
624
|
right: 0,
|
|
590
|
-
align:
|
|
625
|
+
align: ct.DEFAULT,
|
|
591
626
|
tabs: []
|
|
592
627
|
};
|
|
593
628
|
const h = {};
|
|
594
|
-
return c.indent !== 0 && (h.indent = 0), c.left !== 0 && (h.left = 0), c.right !== 0 && (h.right = 0), c.align !==
|
|
629
|
+
return c.indent !== 0 && (h.indent = 0), c.left !== 0 && (h.left = 0), c.right !== 0 && (h.right = 0), c.align !== ct.DEFAULT && (h.align = ct.DEFAULT), JSON.stringify(c.tabs) !== JSON.stringify([]) && (h.tabs = []), h;
|
|
595
630
|
}
|
|
596
631
|
const a = () => {
|
|
597
632
|
let o = "";
|
|
@@ -642,26 +677,13 @@ class nu {
|
|
|
642
677
|
}
|
|
643
678
|
o += "\\M";
|
|
644
679
|
continue;
|
|
645
|
-
case "U":
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
if (f) {
|
|
650
|
-
const p = f[0];
|
|
651
|
-
this.scanner.consume(p.length);
|
|
652
|
-
const d = parseInt(p, 16);
|
|
653
|
-
let g = "";
|
|
654
|
-
try {
|
|
655
|
-
g = String.fromCodePoint(d);
|
|
656
|
-
} catch {
|
|
657
|
-
g = "▯";
|
|
658
|
-
}
|
|
659
|
-
return o ? [t, o] : [t, g];
|
|
660
|
-
}
|
|
661
|
-
this.scanner.consume(-1);
|
|
662
|
-
}
|
|
680
|
+
case "U": {
|
|
681
|
+
const f = this.parseUnicodeEscape();
|
|
682
|
+
if (f !== null)
|
|
683
|
+
return o ? [t, o] : [t, f];
|
|
663
684
|
o += "\\U";
|
|
664
685
|
continue;
|
|
686
|
+
}
|
|
665
687
|
default:
|
|
666
688
|
if (u)
|
|
667
689
|
try {
|
|
@@ -987,7 +1009,7 @@ class vs {
|
|
|
987
1009
|
indent: 0,
|
|
988
1010
|
left: 0,
|
|
989
1011
|
right: 0,
|
|
990
|
-
align:
|
|
1012
|
+
align: ct.DEFAULT,
|
|
991
1013
|
tabs: []
|
|
992
1014
|
};
|
|
993
1015
|
}
|
|
@@ -1512,8 +1534,8 @@ class tn {
|
|
|
1512
1534
|
return this.multiplyMatrices(t, this);
|
|
1513
1535
|
}
|
|
1514
1536
|
multiplyMatrices(t, e) {
|
|
1515
|
-
const s = t.elements, i = e.elements, r = this.elements, a = s[0], o = s[3], c = s[6], h = s[1], l = s[4], u = s[7], f = s[2], p = s[5], d = s[8], g = i[0], x = i[3], b = i[6], S = i[1], v = i[4], w = i[7], F = i[2],
|
|
1516
|
-
return r[0] = a * g + o * S + c * F, r[3] = a * x + o * v + c *
|
|
1537
|
+
const s = t.elements, i = e.elements, r = this.elements, a = s[0], o = s[3], c = s[6], h = s[1], l = s[4], u = s[7], f = s[2], p = s[5], d = s[8], g = i[0], x = i[3], b = i[6], S = i[1], v = i[4], w = i[7], F = i[2], M = i[5], O = i[8];
|
|
1538
|
+
return r[0] = a * g + o * S + c * F, r[3] = a * x + o * v + c * M, r[6] = a * b + o * w + c * O, r[1] = h * g + l * S + u * F, r[4] = h * x + l * v + u * M, r[7] = h * b + l * w + u * O, r[2] = f * g + p * S + d * F, r[5] = f * x + p * v + d * M, r[8] = f * b + p * w + d * O, this;
|
|
1517
1539
|
}
|
|
1518
1540
|
multiplyScalar(t) {
|
|
1519
1541
|
const e = this.elements;
|
|
@@ -2042,8 +2064,8 @@ class Ss {
|
|
|
2042
2064
|
if (Math.abs(l + f) < 0.1 && Math.abs(u + g) < 0.1 && Math.abs(d + x) < 0.1 && Math.abs(h + p + b - 3) < 0.1)
|
|
2043
2065
|
return this.set(1, 0, 0, 0), this;
|
|
2044
2066
|
e = Math.PI;
|
|
2045
|
-
const v = (h + 1) / 2, w = (p + 1) / 2, F = (b + 1) / 2,
|
|
2046
|
-
return v > w && v > F ? v < 0.01 ? (s = 0, i = 0.707106781, r = 0.707106781) : (s = Math.sqrt(v), i =
|
|
2067
|
+
const v = (h + 1) / 2, w = (p + 1) / 2, F = (b + 1) / 2, M = (l + f) / 4, O = (u + g) / 4, I = (d + x) / 4;
|
|
2068
|
+
return v > w && v > F ? v < 0.01 ? (s = 0, i = 0.707106781, r = 0.707106781) : (s = Math.sqrt(v), i = M / s, r = O / s) : w > F ? w < 0.01 ? (s = 0.707106781, i = 0, r = 0.707106781) : (i = Math.sqrt(w), s = M / i, r = I / i) : F < 0.01 ? (s = 0.707106781, i = 0.707106781, r = 0) : (r = Math.sqrt(F), s = O / r, i = I / r), this.set(s, i, r, e), this;
|
|
2047
2069
|
}
|
|
2048
2070
|
let S = Math.sqrt((x - d) * (x - d) + (u - g) * (u - g) + (f - l) * (f - l));
|
|
2049
2071
|
return Math.abs(S) < 1e-3 && (S = 1), this.x = (x - d) / S, this.y = (u - g) / S, this.z = (f - l) / S, this.w = Math.acos((h + p + b - 1) / 2), this;
|
|
@@ -2145,8 +2167,8 @@ class gn {
|
|
|
2145
2167
|
let x = 1 - o;
|
|
2146
2168
|
const b = c * f + h * p + l * d + u * g, S = b >= 0 ? 1 : -1, v = 1 - b * b;
|
|
2147
2169
|
if (v > Number.EPSILON) {
|
|
2148
|
-
const F = Math.sqrt(v),
|
|
2149
|
-
x = Math.sin(x *
|
|
2170
|
+
const F = Math.sqrt(v), M = Math.atan2(F, b * S);
|
|
2171
|
+
x = Math.sin(x * M) / F, o = Math.sin(o * M) / F;
|
|
2150
2172
|
}
|
|
2151
2173
|
const w = o * S;
|
|
2152
2174
|
if (c = c * x + f * w, h = h * x + p * w, l = l * x + d * w, u = u * x + g * w, x === 1 - o) {
|
|
@@ -3112,8 +3134,8 @@ class mt {
|
|
|
3112
3134
|
return this.multiplyMatrices(t, this);
|
|
3113
3135
|
}
|
|
3114
3136
|
multiplyMatrices(t, e) {
|
|
3115
|
-
const s = t.elements, i = e.elements, r = this.elements, a = s[0], o = s[4], c = s[8], h = s[12], l = s[1], u = s[5], f = s[9], p = s[13], d = s[2], g = s[6], x = s[10], b = s[14], S = s[3], v = s[7], w = s[11], F = s[15],
|
|
3116
|
-
return r[0] = a *
|
|
3137
|
+
const s = t.elements, i = e.elements, r = this.elements, a = s[0], o = s[4], c = s[8], h = s[12], l = s[1], u = s[5], f = s[9], p = s[13], d = s[2], g = s[6], x = s[10], b = s[14], S = s[3], v = s[7], w = s[11], F = s[15], M = i[0], O = i[4], I = i[8], H = i[12], D = i[1], W = i[5], J = i[9], R = i[13], U = i[2], P = i[6], Q = i[10], yt = i[14], Ut = i[3], Ct = i[7], ut = i[11], j = i[15];
|
|
3138
|
+
return r[0] = a * M + o * D + c * U + h * Ut, r[4] = a * O + o * W + c * P + h * Ct, r[8] = a * I + o * J + c * Q + h * ut, r[12] = a * H + o * R + c * yt + h * j, r[1] = l * M + u * D + f * U + p * Ut, r[5] = l * O + u * W + f * P + p * Ct, r[9] = l * I + u * J + f * Q + p * ut, r[13] = l * H + u * R + f * yt + p * j, r[2] = d * M + g * D + x * U + b * Ut, r[6] = d * O + g * W + x * P + b * Ct, r[10] = d * I + g * J + x * Q + b * ut, r[14] = d * H + g * R + x * yt + b * j, r[3] = S * M + v * D + w * U + F * Ut, r[7] = S * O + v * W + w * P + F * Ct, r[11] = S * I + v * J + w * Q + F * ut, r[15] = S * H + v * R + w * yt + F * j, this;
|
|
3117
3139
|
}
|
|
3118
3140
|
multiplyScalar(t) {
|
|
3119
3141
|
const e = this.elements;
|
|
@@ -3133,10 +3155,10 @@ class mt {
|
|
|
3133
3155
|
return t.isVector3 ? (i[12] = t.x, i[13] = t.y, i[14] = t.z) : (i[12] = t, i[13] = e, i[14] = s), this;
|
|
3134
3156
|
}
|
|
3135
3157
|
invert() {
|
|
3136
|
-
const t = this.elements, e = t[0], s = t[1], i = t[2], r = t[3], a = t[4], o = t[5], c = t[6], h = t[7], l = t[8], u = t[9], f = t[10], p = t[11], d = t[12], g = t[13], x = t[14], b = t[15], S = u * x * h - g * f * h + g * c * p - o * x * p - u * c * b + o * f * b, v = d * f * h - l * x * h - d * c * p + a * x * p + l * c * b - a * f * b, w = l * g * h - d * u * h + d * o * p - a * g * p - l * o * b + a * u * b, F = d * u * c - l * g * c - d * o * f + a * g * f + l * o * x - a * u * x,
|
|
3137
|
-
if (
|
|
3138
|
-
const
|
|
3139
|
-
return t[0] = S *
|
|
3158
|
+
const t = this.elements, e = t[0], s = t[1], i = t[2], r = t[3], a = t[4], o = t[5], c = t[6], h = t[7], l = t[8], u = t[9], f = t[10], p = t[11], d = t[12], g = t[13], x = t[14], b = t[15], S = u * x * h - g * f * h + g * c * p - o * x * p - u * c * b + o * f * b, v = d * f * h - l * x * h - d * c * p + a * x * p + l * c * b - a * f * b, w = l * g * h - d * u * h + d * o * p - a * g * p - l * o * b + a * u * b, F = d * u * c - l * g * c - d * o * f + a * g * f + l * o * x - a * u * x, M = e * S + s * v + i * w + r * F;
|
|
3159
|
+
if (M === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
3160
|
+
const O = 1 / M;
|
|
3161
|
+
return t[0] = S * O, t[1] = (g * f * r - u * x * r - g * i * p + s * x * p + u * i * b - s * f * b) * O, t[2] = (o * x * r - g * c * r + g * i * h - s * x * h - o * i * b + s * c * b) * O, t[3] = (u * c * r - o * f * r - u * i * h + s * f * h + o * i * p - s * c * p) * O, t[4] = v * O, t[5] = (l * x * r - d * f * r + d * i * p - e * x * p - l * i * b + e * f * b) * O, t[6] = (d * c * r - a * x * r - d * i * h + e * x * h + a * i * b - e * c * b) * O, t[7] = (a * f * r - l * c * r + l * i * h - e * f * h - a * i * p + e * c * p) * O, t[8] = w * O, t[9] = (d * u * r - l * g * r - d * s * p + e * g * p + l * s * b - e * u * b) * O, t[10] = (a * g * r - d * o * r + d * s * h - e * g * h - a * s * b + e * o * b) * O, t[11] = (l * o * r - a * u * r - l * s * h + e * u * h + a * s * p - e * o * p) * O, t[12] = F * O, t[13] = (l * g * i - d * u * i + d * s * f - e * g * f - l * s * x + e * u * x) * O, t[14] = (d * o * i - a * g * i - d * s * c + e * g * c + a * s * x - e * o * x) * O, t[15] = (a * u * i - l * o * i + l * s * c - e * u * c - a * s * f + e * o * f) * O, this;
|
|
3140
3162
|
}
|
|
3141
3163
|
scale(t) {
|
|
3142
3164
|
const e = this.elements, s = t.x, i = t.y, r = t.z;
|
|
@@ -3308,8 +3330,8 @@ class mt {
|
|
|
3308
3330
|
), this;
|
|
3309
3331
|
}
|
|
3310
3332
|
compose(t, e, s) {
|
|
3311
|
-
const i = this.elements, r = e._x, a = e._y, o = e._z, c = e._w, h = r + r, l = a + a, u = o + o, f = r * h, p = r * l, d = r * u, g = a * l, x = a * u, b = o * u, S = c * h, v = c * l, w = c * u, F = s.x,
|
|
3312
|
-
return i[0] = (1 - (g + b)) * F, i[1] = (p + w) * F, i[2] = (d - v) * F, i[3] = 0, i[4] = (p - w) *
|
|
3333
|
+
const i = this.elements, r = e._x, a = e._y, o = e._z, c = e._w, h = r + r, l = a + a, u = o + o, f = r * h, p = r * l, d = r * u, g = a * l, x = a * u, b = o * u, S = c * h, v = c * l, w = c * u, F = s.x, M = s.y, O = s.z;
|
|
3334
|
+
return i[0] = (1 - (g + b)) * F, i[1] = (p + w) * F, i[2] = (d - v) * F, i[3] = 0, i[4] = (p - w) * M, i[5] = (1 - (f + b)) * M, i[6] = (x + S) * M, i[7] = 0, i[8] = (d + v) * O, i[9] = (x - S) * O, i[10] = (1 - (f + g)) * O, i[11] = 0, i[12] = t.x, i[13] = t.y, i[14] = t.z, i[15] = 1, this;
|
|
3313
3335
|
}
|
|
3314
3336
|
decompose(t, e, s) {
|
|
3315
3337
|
const i = this.elements;
|
|
@@ -4649,18 +4671,18 @@ class Dt extends Ii {
|
|
|
4649
4671
|
t.getX(R + 2)
|
|
4650
4672
|
);
|
|
4651
4673
|
}
|
|
4652
|
-
const v = new E(), w = new E(), F = new E(),
|
|
4653
|
-
function
|
|
4654
|
-
F.fromBufferAttribute(i, I),
|
|
4674
|
+
const v = new E(), w = new E(), F = new E(), M = new E();
|
|
4675
|
+
function O(I) {
|
|
4676
|
+
F.fromBufferAttribute(i, I), M.copy(F);
|
|
4655
4677
|
const H = o[I];
|
|
4656
|
-
v.copy(H), v.sub(F.multiplyScalar(F.dot(H))).normalize(), w.crossVectors(
|
|
4678
|
+
v.copy(H), v.sub(F.multiplyScalar(F.dot(H))).normalize(), w.crossVectors(M, H);
|
|
4657
4679
|
const W = w.dot(c[I]) < 0 ? -1 : 1;
|
|
4658
4680
|
a.setXYZW(I, v.x, v.y, v.z, W);
|
|
4659
4681
|
}
|
|
4660
4682
|
for (let I = 0, H = S.length; I < H; ++I) {
|
|
4661
4683
|
const D = S[I], W = D.start, J = D.count;
|
|
4662
4684
|
for (let R = W, U = W + J; R < U; R += 3)
|
|
4663
|
-
|
|
4685
|
+
O(t.getX(R + 0)), O(t.getX(R + 1)), O(t.getX(R + 2));
|
|
4664
4686
|
}
|
|
4665
4687
|
}
|
|
4666
4688
|
computeVertexNormals() {
|
|
@@ -4851,8 +4873,8 @@ class us extends Xt {
|
|
|
4851
4873
|
for (let d = 0, g = f.length; d < g; d++) {
|
|
4852
4874
|
const x = f[d], b = a[x.materialIndex], S = Math.max(x.start, p.start), v = Math.min(o.count, Math.min(x.start + x.count, p.start + p.count));
|
|
4853
4875
|
for (let w = S, F = v; w < F; w += 3) {
|
|
4854
|
-
const
|
|
4855
|
-
i = Xs(this, b, t, s, h, l, u,
|
|
4876
|
+
const M = o.getX(w), O = o.getX(w + 1), I = o.getX(w + 2);
|
|
4877
|
+
i = Xs(this, b, t, s, h, l, u, M, O, I), i && (i.faceIndex = Math.floor(w / 3), i.face.materialIndex = x.materialIndex, e.push(i));
|
|
4856
4878
|
}
|
|
4857
4879
|
}
|
|
4858
4880
|
else {
|
|
@@ -4867,8 +4889,8 @@ class us extends Xt {
|
|
|
4867
4889
|
for (let d = 0, g = f.length; d < g; d++) {
|
|
4868
4890
|
const x = f[d], b = a[x.materialIndex], S = Math.max(x.start, p.start), v = Math.min(c.count, Math.min(x.start + x.count, p.start + p.count));
|
|
4869
4891
|
for (let w = S, F = v; w < F; w += 3) {
|
|
4870
|
-
const
|
|
4871
|
-
i = Xs(this, b, t, s, h, l, u,
|
|
4892
|
+
const M = w, O = w + 1, I = w + 2;
|
|
4893
|
+
i = Xs(this, b, t, s, h, l, u, M, O, I), i && (i.faceIndex = Math.floor(w / 3), i.face.materialIndex = x.materialIndex, e.push(i));
|
|
4872
4894
|
}
|
|
4873
4895
|
}
|
|
4874
4896
|
else {
|
|
@@ -5735,7 +5757,7 @@ function pn(n, t) {
|
|
|
5735
5757
|
t || (t = n);
|
|
5736
5758
|
let e = n, s;
|
|
5737
5759
|
do
|
|
5738
|
-
if (s = !1, !e.steiner && (Bi(e, e.next) ||
|
|
5760
|
+
if (s = !1, !e.steiner && (Bi(e, e.next) || lt(e.prev, e, e.next) === 0)) {
|
|
5739
5761
|
if (gs(e), e = t = e.prev, e === e.next) break;
|
|
5740
5762
|
s = !0;
|
|
5741
5763
|
} else
|
|
@@ -5760,30 +5782,30 @@ function ps(n, t, e, s, i, r, a) {
|
|
|
5760
5782
|
}
|
|
5761
5783
|
function Wu(n) {
|
|
5762
5784
|
const t = n.prev, e = n, s = n.next;
|
|
5763
|
-
if (
|
|
5785
|
+
if (lt(t, e, s) >= 0) return !1;
|
|
5764
5786
|
const i = t.x, r = e.x, a = s.x, o = t.y, c = e.y, h = s.y, l = i < r ? i < a ? i : a : r < a ? r : a, u = o < c ? o < h ? o : h : c < h ? c : h, f = i > r ? i > a ? i : a : r > a ? r : a, p = o > c ? o > h ? o : h : c > h ? c : h;
|
|
5765
5787
|
let d = s.next;
|
|
5766
5788
|
for (; d !== t; ) {
|
|
5767
|
-
if (d.x >= l && d.x <= f && d.y >= u && d.y <= p && Bn(i, o, r, c, a, h, d.x, d.y) &&
|
|
5789
|
+
if (d.x >= l && d.x <= f && d.y >= u && d.y <= p && Bn(i, o, r, c, a, h, d.x, d.y) && lt(d.prev, d, d.next) >= 0) return !1;
|
|
5768
5790
|
d = d.next;
|
|
5769
5791
|
}
|
|
5770
5792
|
return !0;
|
|
5771
5793
|
}
|
|
5772
5794
|
function qu(n, t, e, s) {
|
|
5773
5795
|
const i = n.prev, r = n, a = n.next;
|
|
5774
|
-
if (
|
|
5796
|
+
if (lt(i, r, a) >= 0) return !1;
|
|
5775
5797
|
const o = i.x, c = r.x, h = a.x, l = i.y, u = r.y, f = a.y, p = o < c ? o < h ? o : h : c < h ? c : h, d = l < u ? l < f ? l : f : u < f ? u : f, g = o > c ? o > h ? o : h : c > h ? c : h, x = l > u ? l > f ? l : f : u > f ? u : f, b = jr(p, d, t, e, s), S = jr(g, x, t, e, s);
|
|
5776
5798
|
let v = n.prevZ, w = n.nextZ;
|
|
5777
5799
|
for (; v && v.z >= b && w && w.z <= S; ) {
|
|
5778
|
-
if (v.x >= p && v.x <= g && v.y >= d && v.y <= x && v !== i && v !== a && Bn(o, l, c, u, h, f, v.x, v.y) &&
|
|
5800
|
+
if (v.x >= p && v.x <= g && v.y >= d && v.y <= x && v !== i && v !== a && Bn(o, l, c, u, h, f, v.x, v.y) && lt(v.prev, v, v.next) >= 0 || (v = v.prevZ, w.x >= p && w.x <= g && w.y >= d && w.y <= x && w !== i && w !== a && Bn(o, l, c, u, h, f, w.x, w.y) && lt(w.prev, w, w.next) >= 0)) return !1;
|
|
5779
5801
|
w = w.nextZ;
|
|
5780
5802
|
}
|
|
5781
5803
|
for (; v && v.z >= b; ) {
|
|
5782
|
-
if (v.x >= p && v.x <= g && v.y >= d && v.y <= x && v !== i && v !== a && Bn(o, l, c, u, h, f, v.x, v.y) &&
|
|
5804
|
+
if (v.x >= p && v.x <= g && v.y >= d && v.y <= x && v !== i && v !== a && Bn(o, l, c, u, h, f, v.x, v.y) && lt(v.prev, v, v.next) >= 0) return !1;
|
|
5783
5805
|
v = v.prevZ;
|
|
5784
5806
|
}
|
|
5785
5807
|
for (; w && w.z <= S; ) {
|
|
5786
|
-
if (w.x >= p && w.x <= g && w.y >= d && w.y <= x && w !== i && w !== a && Bn(o, l, c, u, h, f, w.x, w.y) &&
|
|
5808
|
+
if (w.x >= p && w.x <= g && w.y >= d && w.y <= x && w !== i && w !== a && Bn(o, l, c, u, h, f, w.x, w.y) && lt(w.prev, w, w.next) >= 0) return !1;
|
|
5787
5809
|
w = w.nextZ;
|
|
5788
5810
|
}
|
|
5789
5811
|
return !0;
|
|
@@ -5851,7 +5873,7 @@ function Ju(n, t) {
|
|
|
5851
5873
|
return i;
|
|
5852
5874
|
}
|
|
5853
5875
|
function Ku(n, t) {
|
|
5854
|
-
return
|
|
5876
|
+
return lt(n.prev, n, t.prev) < 0 && lt(t.next, n, n.next) < 0;
|
|
5855
5877
|
}
|
|
5856
5878
|
function Qu(n, t, e, s) {
|
|
5857
5879
|
let i = n;
|
|
@@ -5890,17 +5912,17 @@ function Bn(n, t, e, s, i, r, a, o) {
|
|
|
5890
5912
|
function nf(n, t) {
|
|
5891
5913
|
return n.next.i !== t.i && n.prev.i !== t.i && !sf(n, t) && // doesn't intersect other edges
|
|
5892
5914
|
(ds(n, t) && ds(t, n) && rf(n, t) && // locally visible
|
|
5893
|
-
(
|
|
5894
|
-
Bi(n, t) &&
|
|
5915
|
+
(lt(n.prev, n, t.prev) || lt(n, t.prev, t)) || // does not create opposite-facing sectors
|
|
5916
|
+
Bi(n, t) && lt(n.prev, n, n.next) > 0 && lt(t.prev, t, t.next) > 0);
|
|
5895
5917
|
}
|
|
5896
|
-
function
|
|
5918
|
+
function lt(n, t, e) {
|
|
5897
5919
|
return (t.y - n.y) * (e.x - t.x) - (t.x - n.x) * (e.y - t.y);
|
|
5898
5920
|
}
|
|
5899
5921
|
function Bi(n, t) {
|
|
5900
5922
|
return n.x === t.x && n.y === t.y;
|
|
5901
5923
|
}
|
|
5902
5924
|
function bh(n, t, e, s) {
|
|
5903
|
-
const i = Ks(
|
|
5925
|
+
const i = Ks(lt(n, t, e)), r = Ks(lt(n, t, s)), a = Ks(lt(e, s, n)), o = Ks(lt(e, s, t));
|
|
5904
5926
|
return !!(i !== r && a !== o || i === 0 && Js(n, e, t) || r === 0 && Js(n, s, t) || a === 0 && Js(e, n, s) || o === 0 && Js(e, t, s));
|
|
5905
5927
|
}
|
|
5906
5928
|
function Js(n, t, e) {
|
|
@@ -5918,7 +5940,7 @@ function sf(n, t) {
|
|
|
5918
5940
|
return !1;
|
|
5919
5941
|
}
|
|
5920
5942
|
function ds(n, t) {
|
|
5921
|
-
return
|
|
5943
|
+
return lt(n.prev, n, n.next) < 0 ? lt(n, t, n.next) >= 0 && lt(n, n.prev, t) >= 0 : lt(n, t, n.prev) < 0 || lt(n, n.next, t) < 0;
|
|
5922
5944
|
}
|
|
5923
5945
|
function rf(n, t) {
|
|
5924
5946
|
let e = n, s = !1;
|
|
@@ -6175,8 +6197,8 @@ class uf extends Sh {
|
|
|
6175
6197
|
else {
|
|
6176
6198
|
g += w.byteLength;
|
|
6177
6199
|
const F = new ProgressEvent("progress", { lengthComputable: d, loaded: g, total: p });
|
|
6178
|
-
for (let
|
|
6179
|
-
const I = l[
|
|
6200
|
+
for (let M = 0, O = l.length; M < O; M++) {
|
|
6201
|
+
const I = l[M];
|
|
6180
6202
|
I.onProgress && I.onProgress(F);
|
|
6181
6203
|
}
|
|
6182
6204
|
b.enqueue(w), S();
|
|
@@ -6260,29 +6282,29 @@ class wh {
|
|
|
6260
6282
|
function e(b) {
|
|
6261
6283
|
const S = [];
|
|
6262
6284
|
for (let v = 0, w = b.length; v < w; v++) {
|
|
6263
|
-
const F = b[v],
|
|
6264
|
-
|
|
6285
|
+
const F = b[v], M = new Rn();
|
|
6286
|
+
M.curves = F.curves, S.push(M);
|
|
6265
6287
|
}
|
|
6266
6288
|
return S;
|
|
6267
6289
|
}
|
|
6268
6290
|
function s(b, S) {
|
|
6269
6291
|
const v = S.length;
|
|
6270
6292
|
let w = !1;
|
|
6271
|
-
for (let F = v - 1,
|
|
6272
|
-
let
|
|
6293
|
+
for (let F = v - 1, M = 0; M < v; F = M++) {
|
|
6294
|
+
let O = S[F], I = S[M], H = I.x - O.x, D = I.y - O.y;
|
|
6273
6295
|
if (Math.abs(D) > Number.EPSILON) {
|
|
6274
|
-
if (D < 0 && (
|
|
6275
|
-
if (b.y ===
|
|
6276
|
-
if (b.x ===
|
|
6296
|
+
if (D < 0 && (O = S[M], H = -H, I = S[F], D = -D), b.y < O.y || b.y > I.y) continue;
|
|
6297
|
+
if (b.y === O.y) {
|
|
6298
|
+
if (b.x === O.x) return !0;
|
|
6277
6299
|
} else {
|
|
6278
|
-
const W = D * (b.x -
|
|
6300
|
+
const W = D * (b.x - O.x) - H * (b.y - O.y);
|
|
6279
6301
|
if (W === 0) return !0;
|
|
6280
6302
|
if (W < 0) continue;
|
|
6281
6303
|
w = !w;
|
|
6282
6304
|
}
|
|
6283
6305
|
} else {
|
|
6284
|
-
if (b.y !==
|
|
6285
|
-
if (I.x <= b.x && b.x <=
|
|
6306
|
+
if (b.y !== O.y) continue;
|
|
6307
|
+
if (I.x <= b.x && b.x <= O.x || O.x <= b.x && b.x <= I.x) return !0;
|
|
6286
6308
|
}
|
|
6287
6309
|
}
|
|
6288
6310
|
return w;
|
|
@@ -6307,12 +6329,12 @@ class wh {
|
|
|
6307
6329
|
u[v] = [];
|
|
6308
6330
|
for (let v = 0, w = f.length; v < w; v++) {
|
|
6309
6331
|
const F = p[v];
|
|
6310
|
-
for (let
|
|
6311
|
-
const
|
|
6332
|
+
for (let M = 0; M < F.length; M++) {
|
|
6333
|
+
const O = F[M];
|
|
6312
6334
|
let I = !0;
|
|
6313
6335
|
for (let H = 0; H < f.length; H++)
|
|
6314
|
-
s(
|
|
6315
|
-
I && u[v].push(
|
|
6336
|
+
s(O.p, f[H].p) && (v !== H && S++, I ? (I = !1, u[H].push(O)) : b = !0);
|
|
6337
|
+
I && u[v].push(O);
|
|
6316
6338
|
}
|
|
6317
6339
|
}
|
|
6318
6340
|
S > 0 && b === !1 && (p = u);
|
|
@@ -7356,7 +7378,7 @@ class bi extends Tf {
|
|
|
7356
7378
|
}
|
|
7357
7379
|
}
|
|
7358
7380
|
const Di = new bi();
|
|
7359
|
-
class
|
|
7381
|
+
class at {
|
|
7360
7382
|
/**
|
|
7361
7383
|
* Creates a new Point instance.
|
|
7362
7384
|
* @param x - The x-coordinate (defaults to 0)
|
|
@@ -7394,7 +7416,7 @@ class ot {
|
|
|
7394
7416
|
* @returns A new Point instance with the same x and y values
|
|
7395
7417
|
*/
|
|
7396
7418
|
clone() {
|
|
7397
|
-
return new
|
|
7419
|
+
return new at(this.x, this.y);
|
|
7398
7420
|
}
|
|
7399
7421
|
/**
|
|
7400
7422
|
* Adds another point's coordinates to this point.
|
|
@@ -7557,7 +7579,7 @@ class Pn {
|
|
|
7557
7579
|
*/
|
|
7558
7580
|
normalizeToOrigin(t = !1) {
|
|
7559
7581
|
const e = this.bbox;
|
|
7560
|
-
return this.offset(new
|
|
7582
|
+
return this.offset(new at(-e.minX, -e.minY), t);
|
|
7561
7583
|
}
|
|
7562
7584
|
/**
|
|
7563
7585
|
* Converts the shape to an SVG string
|
|
@@ -7589,13 +7611,13 @@ class Pn {
|
|
|
7589
7611
|
} = r, d = Lh(r), g = this.bbox;
|
|
7590
7612
|
let x = d;
|
|
7591
7613
|
l && Ff(g) && !Af(d, g) && (x = kf(d, g));
|
|
7592
|
-
const b = x.maxX - x.minX, S = x.maxY - x.minY, v = b * h, w = S * h, F = x.minX - v,
|
|
7614
|
+
const b = x.maxX - x.minX, S = x.maxY - x.minY, v = b * h, w = S * h, F = x.minX - v, M = x.maxX + v, O = x.minY - w, I = x.maxY + w;
|
|
7593
7615
|
o = c((D) => ({
|
|
7594
7616
|
x: D.x,
|
|
7595
7617
|
y: -D.y
|
|
7596
7618
|
}));
|
|
7597
7619
|
const H = u ? Of(r, f, p) : "";
|
|
7598
|
-
return a = `${F} ${-I} ${
|
|
7620
|
+
return a = `${F} ${-I} ${M - F} ${I - O}`, `<svg width="100%" height="100%" viewBox="${a}" preserveAspectRatio="xMidYMid meet">${H}${o}</svg>`;
|
|
7599
7621
|
} else if (i) {
|
|
7600
7622
|
const h = this.bbox, l = 0.2, u = h.maxX - h.minX, f = h.maxY - h.minY, p = u === 0 ? f : u, d = f === 0 ? u : f, g = h.minX - p * l, x = h.maxX + p * l, b = h.minY - d * l, S = h.maxY + d * l;
|
|
7601
7623
|
o = c((v) => ({
|
|
@@ -7732,15 +7754,15 @@ function Rf(n, t, e, s = Di, i = !1, r = 0) {
|
|
|
7732
7754
|
let o = n;
|
|
7733
7755
|
if (t.header.fontType === K.BIGFONT && r > 0) {
|
|
7734
7756
|
const l = t.content.height > 0 ? e.size / t.content.height : 1;
|
|
7735
|
-
o = o.offset(new
|
|
7757
|
+
o = o.offset(new at(0, -r * l), !0);
|
|
7736
7758
|
}
|
|
7737
7759
|
if (t.header.fontType === K.UNIFONT || If(t, n, e)) {
|
|
7738
7760
|
const l = t.header.fontType === K.UNIFONT && (i || t.content.dualOrientation || Ih(n, e));
|
|
7739
|
-
(t.header.fontType !== K.UNIFONT || !l) && (o = o.offset(new
|
|
7761
|
+
(t.header.fontType !== K.UNIFONT || !l) && (o = o.offset(new at(0, e.capHeight), !0));
|
|
7740
7762
|
}
|
|
7741
7763
|
const c = s.resolve(o, e.cellWidth), h = s.markAlignedAdvanceExplicit(o) ? !0 : o.hasExplicitAdvance;
|
|
7742
7764
|
return new Pn(
|
|
7743
|
-
new
|
|
7765
|
+
new at(c, ((a = o.lastPoint) == null ? void 0 : a.y) ?? 0),
|
|
7744
7766
|
o.polylines,
|
|
7745
7767
|
h
|
|
7746
7768
|
);
|
|
@@ -7799,18 +7821,18 @@ class ms {
|
|
|
7799
7821
|
}
|
|
7800
7822
|
const i = 4 * Math.atan(Math.abs(this.bulge));
|
|
7801
7823
|
this.radius = s / (2 * Math.sin(i / 2));
|
|
7802
|
-
const r = this.start.clone().add(e.clone().divide(2)), a = new
|
|
7824
|
+
const r = this.start.clone().add(e.clone().divide(2)), a = new at(-e.y, e.x);
|
|
7803
7825
|
a.normalize(), a.multiply(Math.abs(this.radius * Math.cos(i / 2))), this.center = r.clone(), this.isClockwise ? this.center.subtract(a) : this.center.add(a), this.startAngle = Math.atan2(this.start.y - this.center.y, this.start.x - this.center.x), this.endAngle = Math.atan2(this.end.y - this.center.y, this.end.x - this.center.x), this.isClockwise ? this.endAngle >= this.startAngle && (this.endAngle -= 2 * Math.PI) : this.endAngle <= this.startAngle && (this.endAngle += 2 * Math.PI);
|
|
7804
7826
|
} else if (t.center && t.radius !== void 0 && t.startOctant !== void 0 && t.octantCount !== void 0 && t.isClockwise !== void 0) {
|
|
7805
7827
|
this.center = t.center.clone(), this.radius = t.radius, this.isClockwise = t.isClockwise, this.startAngle = t.startOctant * Oo;
|
|
7806
7828
|
const e = (t.octantCount === 0 ? 8 : t.octantCount) * Oo;
|
|
7807
7829
|
this.endAngle = this.startAngle + (this.isClockwise ? -e : e), this.start = this.center.clone().add(
|
|
7808
|
-
new
|
|
7830
|
+
new at(
|
|
7809
7831
|
this.radius * Math.cos(this.startAngle),
|
|
7810
7832
|
this.radius * Math.sin(this.startAngle)
|
|
7811
7833
|
)
|
|
7812
7834
|
), this.end = this.center.clone().add(
|
|
7813
|
-
new
|
|
7835
|
+
new at(this.radius * Math.cos(this.endAngle), this.radius * Math.sin(this.endAngle))
|
|
7814
7836
|
);
|
|
7815
7837
|
} else
|
|
7816
7838
|
throw new Error("Invalid arc parameters");
|
|
@@ -7827,12 +7849,12 @@ class ms {
|
|
|
7827
7849
|
for (let r = 1; r < i; r++) {
|
|
7828
7850
|
const a = r / i, o = this.isClockwise ? this.startAngle - a * s : this.startAngle + a * s;
|
|
7829
7851
|
e.push(
|
|
7830
|
-
this.center.clone().add(new
|
|
7852
|
+
this.center.clone().add(new at(this.radius * Math.cos(o), this.radius * Math.sin(o)))
|
|
7831
7853
|
);
|
|
7832
7854
|
}
|
|
7833
7855
|
return e.push(
|
|
7834
7856
|
this.end ? this.end.clone() : this.center.clone().add(
|
|
7835
|
-
new
|
|
7857
|
+
new at(
|
|
7836
7858
|
this.radius * Math.cos(this.endAngle),
|
|
7837
7859
|
this.radius * Math.sin(this.endAngle)
|
|
7838
7860
|
)
|
|
@@ -7986,7 +8008,7 @@ class zf {
|
|
|
7986
8008
|
* @returns The parsed shape
|
|
7987
8009
|
*/
|
|
7988
8010
|
parseShape(t, e = {}) {
|
|
7989
|
-
let s = new
|
|
8011
|
+
let s = new at();
|
|
7990
8012
|
const i = [];
|
|
7991
8013
|
let r = [];
|
|
7992
8014
|
const a = [];
|
|
@@ -8090,7 +8112,7 @@ class zf {
|
|
|
8090
8112
|
* @returns Returns the vector for the given direction code
|
|
8091
8113
|
*/
|
|
8092
8114
|
getVectorForDirection(t) {
|
|
8093
|
-
const e = new
|
|
8115
|
+
const e = new at();
|
|
8094
8116
|
switch (t) {
|
|
8095
8117
|
case 0:
|
|
8096
8118
|
e.x = 1;
|
|
@@ -8194,13 +8216,13 @@ class zf {
|
|
|
8194
8216
|
}
|
|
8195
8217
|
handleXYDisplacement(t, e, s) {
|
|
8196
8218
|
let i = e;
|
|
8197
|
-
const r = new
|
|
8219
|
+
const r = new at();
|
|
8198
8220
|
return r.x = Bt.byteToSByte(t[++i]), r.y = Bt.byteToSByte(t[++i]), s.currentPoint.add(r.multiply(s.scale)), s.isPenDown ? s.currentPolyline.push(s.currentPoint.clone()) : this.notePenUpPositioning(s), i;
|
|
8199
8221
|
}
|
|
8200
8222
|
handleMultipleXYDisplacements(t, e, s) {
|
|
8201
8223
|
let i = e;
|
|
8202
8224
|
for (; !(i + 1 >= t.length); ) {
|
|
8203
|
-
const r = new
|
|
8225
|
+
const r = new at();
|
|
8204
8226
|
if (r.x = Bt.byteToSByte(t[++i]), r.y = Bt.byteToSByte(t[++i]), r.x === 0 && r.y === 0)
|
|
8205
8227
|
break;
|
|
8206
8228
|
s.currentPoint.add(r.multiply(s.scale)), s.isPenDown ? s.currentPolyline.push(s.currentPoint.clone()) : this.notePenUpPositioning(s);
|
|
@@ -8211,7 +8233,7 @@ class zf {
|
|
|
8211
8233
|
let i = e;
|
|
8212
8234
|
const r = t[++i] * s.scale, a = Bt.byteToSByte(t[++i]), o = (a & 112) >> 4;
|
|
8213
8235
|
let c = a & 7;
|
|
8214
|
-
const h = a < 0, l = Math.PI / 4 * o, u = s.currentPoint.clone().subtract(new
|
|
8236
|
+
const h = a < 0, l = Math.PI / 4 * o, u = s.currentPoint.clone().subtract(new at(Math.cos(l) * r, Math.sin(l) * r)), f = ms.fromOctant(u, r, o, c, h).tessellate();
|
|
8215
8237
|
return s.isPenDown && (s.currentPolyline.pop(), s.currentPolyline.push(...f.slice())), s.currentPoint = f[f.length - 1].clone(), i;
|
|
8216
8238
|
}
|
|
8217
8239
|
handleFractionalArc(t, e, s) {
|
|
@@ -8224,29 +8246,29 @@ class zf {
|
|
|
8224
8246
|
l < 0 && (g = -g, d = -d, x = -1);
|
|
8225
8247
|
let b = p * u, S = b + d;
|
|
8226
8248
|
b += p * r / 256 * x, S += p * a / 256 * x;
|
|
8227
|
-
const v = s.currentPoint.clone().subtract(new
|
|
8228
|
-
if (s.currentPoint = v.clone().add(new
|
|
8249
|
+
const v = s.currentPoint.clone().subtract(new at(h * Math.cos(b), h * Math.sin(b)));
|
|
8250
|
+
if (s.currentPoint = v.clone().add(new at(h * Math.cos(S), h * Math.sin(S))), s.isPenDown) {
|
|
8229
8251
|
let w = b;
|
|
8230
8252
|
const F = [];
|
|
8231
8253
|
if (F.push(
|
|
8232
|
-
v.clone().add(new
|
|
8254
|
+
v.clone().add(new at(h * Math.cos(w), h * Math.sin(w)))
|
|
8233
8255
|
), g > 0)
|
|
8234
8256
|
for (; w + g < S; )
|
|
8235
8257
|
w += g, F.push(
|
|
8236
|
-
v.clone().add(new
|
|
8258
|
+
v.clone().add(new at(h * Math.cos(w), h * Math.sin(w)))
|
|
8237
8259
|
);
|
|
8238
8260
|
else
|
|
8239
8261
|
for (; w + g > S; )
|
|
8240
8262
|
w += g, F.push(
|
|
8241
|
-
v.clone().add(new
|
|
8263
|
+
v.clone().add(new at(h * Math.cos(w), h * Math.sin(w)))
|
|
8242
8264
|
);
|
|
8243
|
-
F.push(v.clone().add(new
|
|
8265
|
+
F.push(v.clone().add(new at(h * Math.cos(S), h * Math.sin(S)))), s.currentPolyline.push(...F);
|
|
8244
8266
|
}
|
|
8245
8267
|
return i;
|
|
8246
8268
|
}
|
|
8247
8269
|
handleBulgeArc(t, e, s) {
|
|
8248
8270
|
let i = e;
|
|
8249
|
-
const r = new
|
|
8271
|
+
const r = new at();
|
|
8250
8272
|
r.x = Bt.byteToSByte(t[++i]), r.y = Bt.byteToSByte(t[++i]);
|
|
8251
8273
|
const a = Bt.byteToSByte(t[++i]);
|
|
8252
8274
|
return s.currentPoint = this.handleArcSegment(
|
|
@@ -8261,7 +8283,7 @@ class zf {
|
|
|
8261
8283
|
handleMultipleBulgeArcs(t, e, s) {
|
|
8262
8284
|
let i = e;
|
|
8263
8285
|
for (; !(i + 1 >= t.length); ) {
|
|
8264
|
-
const r = new
|
|
8286
|
+
const r = new at();
|
|
8265
8287
|
if (r.x = Bt.byteToSByte(t[++i]), r.y = Bt.byteToSByte(t[++i]), r.x === 0 && r.y === 0 || i + 1 >= t.length)
|
|
8266
8288
|
break;
|
|
8267
8289
|
const a = Bt.byteToSByte(t[++i]);
|
|
@@ -10511,23 +10533,23 @@ A.prototype.parseTupleVariationStore = function(n, t, e, s, i) {
|
|
|
10511
10533
|
g.privatePoints = [], this.relativeOffset = f, e === "cvar" && !g.peakTuple && console.warn("An embedded peak tuple is required in TupleVariationHeaders for the cvar table."), g.flags.privatePointNumbers && (g.privatePoints = this.parsePackedPointNumbers()), delete g.flags;
|
|
10512
10534
|
const x = this.offset, b = this.relativeOffset, S = (v) => {
|
|
10513
10535
|
let w, F;
|
|
10514
|
-
const
|
|
10515
|
-
let
|
|
10536
|
+
const M = () => {
|
|
10537
|
+
let O = 0;
|
|
10516
10538
|
if (e === "gvar") {
|
|
10517
|
-
if (
|
|
10539
|
+
if (O = g.privatePoints.length || u.length, !O) {
|
|
10518
10540
|
const I = s.get(i);
|
|
10519
|
-
I.path,
|
|
10541
|
+
I.path, O = I.points.length, O += 4;
|
|
10520
10542
|
}
|
|
10521
|
-
} else e === "cvar" && (
|
|
10522
|
-
this.offset = x, this.relativeOffset = b, w = this.parsePackedDeltas(
|
|
10543
|
+
} else e === "cvar" && (O = s.length);
|
|
10544
|
+
this.offset = x, this.relativeOffset = b, w = this.parsePackedDeltas(O), e === "gvar" && (F = this.parsePackedDeltas(O));
|
|
10523
10545
|
};
|
|
10524
10546
|
return {
|
|
10525
10547
|
configurable: !0,
|
|
10526
10548
|
get: function() {
|
|
10527
|
-
return w === void 0 &&
|
|
10549
|
+
return w === void 0 && M(), v === "deltasY" ? F : w;
|
|
10528
10550
|
},
|
|
10529
|
-
set: function(
|
|
10530
|
-
w === void 0 &&
|
|
10551
|
+
set: function(O) {
|
|
10552
|
+
w === void 0 && M(), v === "deltasY" ? F = O : w = O;
|
|
10531
10553
|
}
|
|
10532
10554
|
};
|
|
10533
10555
|
};
|
|
@@ -11416,14 +11438,14 @@ function Ip(n, t) {
|
|
|
11416
11438
|
const w = ba(p, v, S);
|
|
11417
11439
|
let F = N.MACSTRING(b, w);
|
|
11418
11440
|
if (p === 0 && (S = t.indexOf(x), S < 0 && (S = t.length, t.push(x)), v = 4, F = N.UTF16(b)), F !== void 0) {
|
|
11419
|
-
const
|
|
11441
|
+
const M = jo(F, a);
|
|
11420
11442
|
r.push(qo(
|
|
11421
11443
|
p,
|
|
11422
11444
|
v,
|
|
11423
11445
|
S,
|
|
11424
11446
|
h,
|
|
11425
11447
|
F.length,
|
|
11426
|
-
|
|
11448
|
+
M
|
|
11427
11449
|
));
|
|
11428
11450
|
}
|
|
11429
11451
|
}
|
|
@@ -14139,7 +14161,7 @@ function ll(n, t) {
|
|
|
14139
14161
|
function ra(n, t, e, s, i) {
|
|
14140
14162
|
let r, a, o, c;
|
|
14141
14163
|
const h = new Vn(), l = [];
|
|
14142
|
-
let u = 0, f = !1, p = !1, d = 0, g = 0, x, b, S, v, w = 0, F = [],
|
|
14164
|
+
let u = 0, f = !1, p = !1, d = 0, g = 0, x, b, S, v, w = 0, F = [], M, O = 0;
|
|
14143
14165
|
const I = n.tables.cff2 || n.tables.cff;
|
|
14144
14166
|
if (S = I.topDict._defaultWidthX, v = I.topDict._nominalWidthX, i = i || n.variation && n.variation.get(), t.getBlendPath || (t.getBlendPath = function(U) {
|
|
14145
14167
|
return ra(n, t, e, s, U);
|
|
@@ -14158,10 +14180,10 @@ function ra(n, t, e, s, i) {
|
|
|
14158
14180
|
U = (l.length & 1) !== 0, U && !f && (D = l.shift() + v), u += l.length >> 1, l.length = 0, f = !0;
|
|
14159
14181
|
}
|
|
14160
14182
|
function R(U) {
|
|
14161
|
-
let P, Q, yt, Ut, Ct,
|
|
14162
|
-
for (;
|
|
14163
|
-
let Et = U[
|
|
14164
|
-
switch (
|
|
14183
|
+
let P, Q, yt, Ut, Ct, ut, j, rt, bt, At, St, Tt, ht = 0;
|
|
14184
|
+
for (; ht < U.length; ) {
|
|
14185
|
+
let Et = U[ht];
|
|
14186
|
+
switch (ht += 1, Et) {
|
|
14165
14187
|
case 1:
|
|
14166
14188
|
J();
|
|
14167
14189
|
break;
|
|
@@ -14188,12 +14210,12 @@ function ra(n, t, e, s, i) {
|
|
|
14188
14210
|
r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), d = o + l.shift(), g = c + l.shift(), h.curveTo(r, a, o, c, d, g);
|
|
14189
14211
|
break;
|
|
14190
14212
|
case 10:
|
|
14191
|
-
if (Ct = l.pop() + b,
|
|
14192
|
-
if (
|
|
14213
|
+
if (Ct = l.pop() + b, ut = x[Ct], ut) {
|
|
14214
|
+
if (O >= Xo) {
|
|
14193
14215
|
console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");
|
|
14194
14216
|
break;
|
|
14195
14217
|
}
|
|
14196
|
-
|
|
14218
|
+
O++, R(ut), O--;
|
|
14197
14219
|
}
|
|
14198
14220
|
break;
|
|
14199
14221
|
case 11:
|
|
@@ -14203,7 +14225,7 @@ function ra(n, t, e, s, i) {
|
|
|
14203
14225
|
}
|
|
14204
14226
|
return;
|
|
14205
14227
|
case 12:
|
|
14206
|
-
switch (Et = U[
|
|
14228
|
+
switch (Et = U[ht], ht += 1, Et) {
|
|
14207
14229
|
case 35:
|
|
14208
14230
|
r = d + l.shift(), a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), j = o + l.shift(), rt = c + l.shift(), bt = j + l.shift(), At = rt + l.shift(), St = bt + l.shift(), Tt = At + l.shift(), d = St + l.shift(), g = Tt + l.shift(), l.shift(), h.curveTo(r, a, o, c, j, rt), h.curveTo(bt, At, St, Tt, d, g);
|
|
14209
14231
|
break;
|
|
@@ -14261,13 +14283,13 @@ function ra(n, t, e, s, i) {
|
|
|
14261
14283
|
console.error("CFF2 CharString operator blend (16) is not supported in CFF");
|
|
14262
14284
|
break;
|
|
14263
14285
|
}
|
|
14264
|
-
|
|
14265
|
-
var tt = l.pop(), kt =
|
|
14266
|
-
if (
|
|
14286
|
+
M || (M = n.variation && i && n.variation.process.getBlendVector(F, w, i));
|
|
14287
|
+
var tt = l.pop(), kt = M ? M.length : F.itemVariationSubtables[w].regionIndexes.length, Pt = tt * kt, Nt = l.length - Pt, zt = Nt - tt;
|
|
14288
|
+
if (M)
|
|
14267
14289
|
for (let Ce = 0; Ce < tt; Ce++) {
|
|
14268
14290
|
var Vt = l[zt + Ce];
|
|
14269
14291
|
for (let C = 0; C < kt; C++)
|
|
14270
|
-
Vt +=
|
|
14292
|
+
Vt += M[C] * l[Nt++];
|
|
14271
14293
|
l[zt + Ce] = Vt;
|
|
14272
14294
|
}
|
|
14273
14295
|
for (; Pt--; )
|
|
@@ -14278,7 +14300,7 @@ function ra(n, t, e, s, i) {
|
|
|
14278
14300
|
break;
|
|
14279
14301
|
case 19:
|
|
14280
14302
|
case 20:
|
|
14281
|
-
J(),
|
|
14303
|
+
J(), ht += u + 7 >> 3;
|
|
14282
14304
|
break;
|
|
14283
14305
|
case 21:
|
|
14284
14306
|
l.length > 2 && !f && (D = l.shift() + v, f = !0), g += l.pop(), d += l.pop(), W(d, g);
|
|
@@ -14308,15 +14330,15 @@ function ra(n, t, e, s, i) {
|
|
|
14308
14330
|
r = d + l.shift(), a = g, o = r + l.shift(), c = a + l.shift(), d = o + l.shift(), g = c, h.curveTo(r, a, o, c, d, g);
|
|
14309
14331
|
break;
|
|
14310
14332
|
case 28:
|
|
14311
|
-
P = U[
|
|
14333
|
+
P = U[ht], Q = U[ht + 1], l.push((P << 24 | Q << 16) >> 16), ht += 2;
|
|
14312
14334
|
break;
|
|
14313
14335
|
case 29:
|
|
14314
|
-
if (Ct = l.pop() + n.gsubrsBias,
|
|
14315
|
-
if (
|
|
14336
|
+
if (Ct = l.pop() + n.gsubrsBias, ut = n.gsubrs[Ct], ut) {
|
|
14337
|
+
if (O >= Xo) {
|
|
14316
14338
|
console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");
|
|
14317
14339
|
break;
|
|
14318
14340
|
}
|
|
14319
|
-
|
|
14341
|
+
O++, R(ut), O--;
|
|
14320
14342
|
}
|
|
14321
14343
|
break;
|
|
14322
14344
|
case 30:
|
|
@@ -14328,7 +14350,7 @@ function ra(n, t, e, s, i) {
|
|
|
14328
14350
|
r = d, a = g + l.shift(), o = r + l.shift(), c = a + l.shift(), d = o + l.shift(), g = c + (l.length === 1 ? l.shift() : 0), h.curveTo(r, a, o, c, d, g);
|
|
14329
14351
|
break;
|
|
14330
14352
|
default:
|
|
14331
|
-
Et < 32 ? console.log("Glyph " + t.index + ": unknown operator " + Et) : Et < 247 ? l.push(Et - 139) : Et < 251 ? (P = U[
|
|
14353
|
+
Et < 32 ? console.log("Glyph " + t.index + ": unknown operator " + Et) : Et < 247 ? l.push(Et - 139) : Et < 251 ? (P = U[ht], ht += 1, l.push((Et - 247) * 256 + P + 108)) : Et < 255 ? (P = U[ht], ht += 1, l.push(-(Et - 251) * 256 - P - 108)) : (P = U[ht], Q = U[ht + 1], yt = U[ht + 2], Ut = U[ht + 3], ht += 4, l.push((P << 24 | Q << 16 | yt << 8 | Ut) / 65536));
|
|
14332
14354
|
}
|
|
14333
14355
|
}
|
|
14334
14356
|
}
|
|
@@ -15982,9 +16004,9 @@ function T0(n) {
|
|
|
15982
16004
|
// Use space as the default character, if available.
|
|
15983
16005
|
usBreakChar: n.hasChar(" ") ? 32 : 0
|
|
15984
16006
|
// Use space as the break character, if available.
|
|
15985
|
-
}, n.tables.os2)), w = gl.make(n.glyphs), F = tl.make(n.glyphs),
|
|
16007
|
+
}, n.tables.os2)), w = gl.make(n.glyphs), F = tl.make(n.glyphs), M = n.getEnglishName("fontFamily"), O = n.getEnglishName("fontSubfamily"), I = M + " " + O;
|
|
15986
16008
|
let H = n.getEnglishName("postScriptName");
|
|
15987
|
-
H || (H =
|
|
16009
|
+
H || (H = M.replace(/\s/g, "") + "-" + O);
|
|
15988
16010
|
const D = {};
|
|
15989
16011
|
for (let tt in n.names)
|
|
15990
16012
|
D[tt] = n.names[tt];
|
|
@@ -16001,14 +16023,14 @@ function T0(n) {
|
|
|
16001
16023
|
const U = [], P = Qh.make(D, U), Q = U.length > 0 ? ml.make(U) : void 0, yt = xl.make(n), Ut = aa.make(n.glyphs, {
|
|
16002
16024
|
version: n.getEnglishName("version"),
|
|
16003
16025
|
fullName: I,
|
|
16004
|
-
familyName:
|
|
16005
|
-
weightName:
|
|
16026
|
+
familyName: M,
|
|
16027
|
+
weightName: O,
|
|
16006
16028
|
postScriptName: H,
|
|
16007
16029
|
unitsPerEm: n.unitsPerEm,
|
|
16008
16030
|
fontBBox: [0, d.yMin, d.ascender, d.advanceWidthMax],
|
|
16009
16031
|
topDict: n.tables.cff && n.tables.cff.topDict || {}
|
|
16010
|
-
}), Ct = n.metas && Object.keys(n.metas).length > 0 ? vl.make(n.metas) : void 0,
|
|
16011
|
-
Q &&
|
|
16032
|
+
}), Ct = n.metas && Object.keys(n.metas).length > 0 ? vl.make(n.metas) : void 0, ut = [x, b, S, v, P, F, yt, Ut, w];
|
|
16033
|
+
Q && ut.push(Q);
|
|
16012
16034
|
const j = {
|
|
16013
16035
|
gsub: bl,
|
|
16014
16036
|
cpal: al,
|
|
@@ -16028,18 +16050,18 @@ function T0(n) {
|
|
|
16028
16050
|
const kt = n.tables[tt];
|
|
16029
16051
|
if (kt) {
|
|
16030
16052
|
const Pt = j[tt].make.call(n, kt, ...rt[tt] || []);
|
|
16031
|
-
Pt &&
|
|
16053
|
+
Pt && ut.push(Pt);
|
|
16032
16054
|
}
|
|
16033
16055
|
}
|
|
16034
|
-
Ct &&
|
|
16035
|
-
const bt = Ml(
|
|
16036
|
-
let
|
|
16056
|
+
Ct && ut.push(Ct);
|
|
16057
|
+
const bt = Ml(ut), At = bt.encode(), St = Fa(At), Tt = bt.fields;
|
|
16058
|
+
let ht = !1;
|
|
16037
16059
|
for (let tt = 0; tt < Tt.length; tt += 1)
|
|
16038
16060
|
if (Tt[tt].name === "head table") {
|
|
16039
|
-
Tt[tt].value.checkSumAdjustment = 2981146554 - St,
|
|
16061
|
+
Tt[tt].value.checkSumAdjustment = 2981146554 - St, ht = !0;
|
|
16040
16062
|
break;
|
|
16041
16063
|
}
|
|
16042
|
-
if (!
|
|
16064
|
+
if (!ht)
|
|
16043
16065
|
throw new Error("Could not find head table with checkSum to adjust.");
|
|
16044
16066
|
return bt;
|
|
16045
16067
|
}
|
|
@@ -18042,8 +18064,8 @@ function r1(n) {
|
|
|
18042
18064
|
n.fv = n.pv;
|
|
18043
18065
|
}
|
|
18044
18066
|
function a1(n) {
|
|
18045
|
-
const t = n.stack, e = t.pop(), s = t.pop(), i = t.pop(), r = t.pop(), a = t.pop(), o = n.z0, c = n.z1, h = o[e], l = o[s], u = c[i], f = c[r], p = n.z2[a], d = h.x, g = h.y, x = l.x, b = l.y, S = u.x, v = u.y, w = f.x, F = f.y,
|
|
18046
|
-
p.x = (
|
|
18067
|
+
const t = n.stack, e = t.pop(), s = t.pop(), i = t.pop(), r = t.pop(), a = t.pop(), o = n.z0, c = n.z1, h = o[e], l = o[s], u = c[i], f = c[r], p = n.z2[a], d = h.x, g = h.y, x = l.x, b = l.y, S = u.x, v = u.y, w = f.x, F = f.y, M = (d - x) * (v - F) - (g - b) * (S - w), O = d * b - g * x, I = S * F - v * w;
|
|
18068
|
+
p.x = (O * (S - w) - I * (d - x)) / M, p.y = (O * (v - F) - I * (g - b)) / M;
|
|
18047
18069
|
}
|
|
18048
18070
|
function o1(n) {
|
|
18049
18071
|
n.rp0 = n.stack.pop();
|
|
@@ -19456,11 +19478,11 @@ function _g(n, t) {
|
|
|
19456
19478
|
for (let b = 0; b < x.subtables.length; b++) {
|
|
19457
19479
|
let S = x.subtables[b], v, w = this.getSubstitutionType(x, S);
|
|
19458
19480
|
if (w === "71" ? (w = this.getSubstitutionType(S, S.extension), v = this.getLookupMethod(S, S.extension), S = S.extension) : v = this.getLookupMethod(x, S), w === "12") {
|
|
19459
|
-
const F = n.get(d.sequenceIndex),
|
|
19460
|
-
|
|
19481
|
+
const F = n.get(d.sequenceIndex), M = v(F);
|
|
19482
|
+
M && f.push(M);
|
|
19461
19483
|
} else if (w === "21") {
|
|
19462
|
-
const F = n.get(d.sequenceIndex),
|
|
19463
|
-
|
|
19484
|
+
const F = n.get(d.sequenceIndex), M = v(F);
|
|
19485
|
+
M && f.push(M);
|
|
19464
19486
|
} else
|
|
19465
19487
|
throw new Error(`Substitution type ${w} is not supported in chaining substitution`);
|
|
19466
19488
|
}
|
|
@@ -20809,7 +20831,7 @@ function ty(n, t = {}) {
|
|
|
20809
20831
|
throw new Error("WOFF2 require an external decompressor library, see examples at: " + R);
|
|
20810
20832
|
} else
|
|
20811
20833
|
throw new Error("Unsupported OpenType signature " + c);
|
|
20812
|
-
let h, l, u, f, p, d, g, x, b, S, v, w, F,
|
|
20834
|
+
let h, l, u, f, p, d, g, x, b, S, v, w, F, M, O, I, H, D;
|
|
20813
20835
|
for (let R = 0; R < a; R += 1) {
|
|
20814
20836
|
const U = o[R];
|
|
20815
20837
|
let P;
|
|
@@ -20878,7 +20900,7 @@ function ty(n, t = {}) {
|
|
|
20878
20900
|
x = U;
|
|
20879
20901
|
break;
|
|
20880
20902
|
case "loca":
|
|
20881
|
-
|
|
20903
|
+
O = U;
|
|
20882
20904
|
break;
|
|
20883
20905
|
case "CFF ":
|
|
20884
20906
|
h = U;
|
|
@@ -20887,7 +20909,7 @@ function ty(n, t = {}) {
|
|
|
20887
20909
|
l = U;
|
|
20888
20910
|
break;
|
|
20889
20911
|
case "kern":
|
|
20890
|
-
|
|
20912
|
+
M = U;
|
|
20891
20913
|
break;
|
|
20892
20914
|
case "GDEF":
|
|
20893
20915
|
b = U;
|
|
@@ -20914,8 +20936,8 @@ function ty(n, t = {}) {
|
|
|
20914
20936
|
}
|
|
20915
20937
|
}
|
|
20916
20938
|
const W = et(r, I);
|
|
20917
|
-
if (i.tables.name = Qh.parse(W.data, W.offset, s), i.names = i.tables.name, x &&
|
|
20918
|
-
const R = e === 0, U = et(r,
|
|
20939
|
+
if (i.tables.name = Qh.parse(W.data, W.offset, s), i.names = i.tables.name, x && O) {
|
|
20940
|
+
const R = e === 0, U = et(r, O), P = Km.parse(U.data, U.offset, i.numGlyphs, R), Q = et(r, x);
|
|
20919
20941
|
i.glyphs = Dl.parse(Q.data, Q.offset, P, i, t);
|
|
20920
20942
|
} else if (h) {
|
|
20921
20943
|
const R = et(r, h);
|
|
@@ -20926,8 +20948,8 @@ function ty(n, t = {}) {
|
|
|
20926
20948
|
} else
|
|
20927
20949
|
throw new Error("Font doesn't contain TrueType, CFF or CFF2 outlines.");
|
|
20928
20950
|
const J = et(r, w);
|
|
20929
|
-
if (gl.parse(i, J.data, J.offset, i.numberOfHMetrics, i.numGlyphs, i.glyphs, t), $p(i, t),
|
|
20930
|
-
const R = et(r,
|
|
20951
|
+
if (gl.parse(i, J.data, J.offset, i.numberOfHMetrics, i.numGlyphs, i.glyphs, t), $p(i, t), M) {
|
|
20952
|
+
const R = et(r, M);
|
|
20931
20953
|
i.kerningPairs = Zm.parse(R.data, R.offset);
|
|
20932
20954
|
} else
|
|
20933
20955
|
i.kerningPairs = {};
|
|
@@ -21086,26 +21108,26 @@ function ny(n, t = 1e-4) {
|
|
|
21086
21108
|
F.itemSize,
|
|
21087
21109
|
F.normalized
|
|
21088
21110
|
);
|
|
21089
|
-
const
|
|
21090
|
-
|
|
21091
|
-
const H = new
|
|
21092
|
-
h[w][I] = new
|
|
21111
|
+
const M = n.morphAttributes[w];
|
|
21112
|
+
M && (h[w] || (h[w] = []), M.forEach((O, I) => {
|
|
21113
|
+
const H = new O.array.constructor(O.count * O.itemSize);
|
|
21114
|
+
h[w][I] = new O.constructor(H, O.itemSize, O.normalized);
|
|
21093
21115
|
}));
|
|
21094
21116
|
}
|
|
21095
21117
|
const p = t * 0.5, d = Math.log10(1 / t), g = Math.pow(10, d), x = p * g;
|
|
21096
21118
|
for (let S = 0; S < r; S++) {
|
|
21097
21119
|
const v = s ? s.getX(S) : S;
|
|
21098
21120
|
let w = "";
|
|
21099
|
-
for (let F = 0,
|
|
21100
|
-
const
|
|
21121
|
+
for (let F = 0, M = o.length; F < M; F++) {
|
|
21122
|
+
const O = o[F], I = n.getAttribute(O), H = I.itemSize;
|
|
21101
21123
|
for (let D = 0; D < H; D++)
|
|
21102
21124
|
w += `${~~(I[u[D]](v) * g + x)},`;
|
|
21103
21125
|
}
|
|
21104
21126
|
if (w in e)
|
|
21105
21127
|
l.push(e[w]);
|
|
21106
21128
|
else {
|
|
21107
|
-
for (let F = 0,
|
|
21108
|
-
const
|
|
21129
|
+
for (let F = 0, M = o.length; F < M; F++) {
|
|
21130
|
+
const O = o[F], I = n.getAttribute(O), H = n.morphAttributes[O], D = I.itemSize, W = c[O], J = h[O];
|
|
21109
21131
|
for (let R = 0; R < D; R++) {
|
|
21110
21132
|
const U = u[R], P = f[R];
|
|
21111
21133
|
if (W[P](a, I[U](v)), H)
|
|
@@ -22002,7 +22024,7 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22002
22024
|
case "ucs-2":
|
|
22003
22025
|
case "utf16le":
|
|
22004
22026
|
case "utf-16le":
|
|
22005
|
-
return
|
|
22027
|
+
return ut(this, m, y);
|
|
22006
22028
|
default:
|
|
22007
22029
|
if (T) throw new TypeError("Unknown encoding: " + C);
|
|
22008
22030
|
C = (C + "").toLowerCase(), T = !0;
|
|
@@ -22057,14 +22079,14 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22057
22079
|
if (y >= T)
|
|
22058
22080
|
return 1;
|
|
22059
22081
|
if (y >>>= 0, T >>>= 0, k >>>= 0, _ >>>= 0, this === m) return 0;
|
|
22060
|
-
for (var B = _ - k, $ = T - y, Y = Math.min(B, $),
|
|
22061
|
-
if (
|
|
22062
|
-
B =
|
|
22082
|
+
for (var B = _ - k, $ = T - y, Y = Math.min(B, $), ot = this.slice(k, _), Mt = m.slice(y, T), ft = 0; ft < Y; ++ft)
|
|
22083
|
+
if (ot[ft] !== Mt[ft]) {
|
|
22084
|
+
B = ot[ft], $ = Mt[ft];
|
|
22063
22085
|
break;
|
|
22064
22086
|
}
|
|
22065
22087
|
return B < $ ? -1 : $ < B ? 1 : 0;
|
|
22066
22088
|
};
|
|
22067
|
-
function
|
|
22089
|
+
function M(C, m, y, T, k) {
|
|
22068
22090
|
if (C.length === 0) return -1;
|
|
22069
22091
|
if (typeof y == "string" ? (T = y, y = 0) : y > 2147483647 ? y = 2147483647 : y < -2147483648 && (y = -2147483648), y = +y, Et(y) && (y = k ? 0 : C.length - 1), y < 0 && (y = C.length + y), y >= C.length) {
|
|
22070
22092
|
if (k) return -1;
|
|
@@ -22073,12 +22095,12 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22073
22095
|
if (k) y = 0;
|
|
22074
22096
|
else return -1;
|
|
22075
22097
|
if (typeof m == "string" && (m = o.from(m, T)), o.isBuffer(m))
|
|
22076
|
-
return m.length === 0 ? -1 :
|
|
22098
|
+
return m.length === 0 ? -1 : O(C, m, y, T, k);
|
|
22077
22099
|
if (typeof m == "number")
|
|
22078
|
-
return m = m & 255, typeof Uint8Array.prototype.indexOf == "function" ? k ? Uint8Array.prototype.indexOf.call(C, m, y) : Uint8Array.prototype.lastIndexOf.call(C, m, y) :
|
|
22100
|
+
return m = m & 255, typeof Uint8Array.prototype.indexOf == "function" ? k ? Uint8Array.prototype.indexOf.call(C, m, y) : Uint8Array.prototype.lastIndexOf.call(C, m, y) : O(C, [m], y, T, k);
|
|
22079
22101
|
throw new TypeError("val must be string, number or Buffer");
|
|
22080
22102
|
}
|
|
22081
|
-
function
|
|
22103
|
+
function O(C, m, y, T, k) {
|
|
22082
22104
|
var _ = 1, B = C.length, $ = m.length;
|
|
22083
22105
|
if (T !== void 0 && (T = String(T).toLowerCase(), T === "ucs2" || T === "ucs-2" || T === "utf16le" || T === "utf-16le")) {
|
|
22084
22106
|
if (C.length < 2 || m.length < 2)
|
|
@@ -22088,31 +22110,31 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22088
22110
|
function Y(Ua, Pa) {
|
|
22089
22111
|
return _ === 1 ? Ua[Pa] : Ua.readUInt16BE(Pa * _);
|
|
22090
22112
|
}
|
|
22091
|
-
var
|
|
22113
|
+
var ot;
|
|
22092
22114
|
if (k) {
|
|
22093
22115
|
var Mt = -1;
|
|
22094
|
-
for (
|
|
22095
|
-
if (Y(C,
|
|
22096
|
-
if (Mt === -1 && (Mt =
|
|
22116
|
+
for (ot = y; ot < B; ot++)
|
|
22117
|
+
if (Y(C, ot) === Y(m, Mt === -1 ? 0 : ot - Mt)) {
|
|
22118
|
+
if (Mt === -1 && (Mt = ot), ot - Mt + 1 === $) return Mt * _;
|
|
22097
22119
|
} else
|
|
22098
|
-
Mt !== -1 && (
|
|
22120
|
+
Mt !== -1 && (ot -= ot - Mt), Mt = -1;
|
|
22099
22121
|
} else
|
|
22100
|
-
for (y + $ > B && (y = B - $),
|
|
22122
|
+
for (y + $ > B && (y = B - $), ot = y; ot >= 0; ot--) {
|
|
22101
22123
|
for (var ft = !0, Ms = 0; Ms < $; Ms++)
|
|
22102
|
-
if (Y(C,
|
|
22124
|
+
if (Y(C, ot + Ms) !== Y(m, Ms)) {
|
|
22103
22125
|
ft = !1;
|
|
22104
22126
|
break;
|
|
22105
22127
|
}
|
|
22106
|
-
if (ft) return
|
|
22128
|
+
if (ft) return ot;
|
|
22107
22129
|
}
|
|
22108
22130
|
return -1;
|
|
22109
22131
|
}
|
|
22110
22132
|
o.prototype.includes = function(m, y, T) {
|
|
22111
22133
|
return this.indexOf(m, y, T) !== -1;
|
|
22112
22134
|
}, o.prototype.indexOf = function(m, y, T) {
|
|
22113
|
-
return
|
|
22135
|
+
return M(this, m, y, T, !0);
|
|
22114
22136
|
}, o.prototype.lastIndexOf = function(m, y, T) {
|
|
22115
|
-
return
|
|
22137
|
+
return M(this, m, y, T, !1);
|
|
22116
22138
|
};
|
|
22117
22139
|
function I(C, m, y, T) {
|
|
22118
22140
|
y = Number(y) || 0;
|
|
@@ -22190,7 +22212,7 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22190
22212
|
for (var T = [], k = m; k < y; ) {
|
|
22191
22213
|
var _ = C[k], B = null, $ = _ > 239 ? 4 : _ > 223 ? 3 : _ > 191 ? 2 : 1;
|
|
22192
22214
|
if (k + $ <= y) {
|
|
22193
|
-
var Y,
|
|
22215
|
+
var Y, ot, Mt, ft;
|
|
22194
22216
|
switch ($) {
|
|
22195
22217
|
case 1:
|
|
22196
22218
|
_ < 128 && (B = _);
|
|
@@ -22199,10 +22221,10 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22199
22221
|
Y = C[k + 1], (Y & 192) === 128 && (ft = (_ & 31) << 6 | Y & 63, ft > 127 && (B = ft));
|
|
22200
22222
|
break;
|
|
22201
22223
|
case 3:
|
|
22202
|
-
Y = C[k + 1],
|
|
22224
|
+
Y = C[k + 1], ot = C[k + 2], (Y & 192) === 128 && (ot & 192) === 128 && (ft = (_ & 15) << 12 | (Y & 63) << 6 | ot & 63, ft > 2047 && (ft < 55296 || ft > 57343) && (B = ft));
|
|
22203
22225
|
break;
|
|
22204
22226
|
case 4:
|
|
22205
|
-
Y = C[k + 1],
|
|
22227
|
+
Y = C[k + 1], ot = C[k + 2], Mt = C[k + 3], (Y & 192) === 128 && (ot & 192) === 128 && (Mt & 192) === 128 && (ft = (_ & 15) << 18 | (Y & 63) << 12 | (ot & 63) << 6 | Mt & 63, ft > 65535 && ft < 1114112 && (B = ft));
|
|
22206
22228
|
}
|
|
22207
22229
|
}
|
|
22208
22230
|
B === null ? (B = 65533, $ = 1) : B > 65535 && (B -= 65536, T.push(B >>> 10 & 1023 | 55296), B = 56320 | B & 1023), T.push(B), k += $;
|
|
@@ -22242,7 +22264,7 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22242
22264
|
k += Ce[C[_]];
|
|
22243
22265
|
return k;
|
|
22244
22266
|
}
|
|
22245
|
-
function
|
|
22267
|
+
function ut(C, m, y) {
|
|
22246
22268
|
for (var T = C.slice(m, y), k = "", _ = 0; _ < T.length - 1; _ += 2)
|
|
22247
22269
|
k += String.fromCharCode(T[_] + T[_ + 1] * 256);
|
|
22248
22270
|
return k;
|
|
@@ -22435,7 +22457,7 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22435
22457
|
return this;
|
|
22436
22458
|
};
|
|
22437
22459
|
var Tt = /[^+/0-9A-Za-z-_]/g;
|
|
22438
|
-
function
|
|
22460
|
+
function ht(C) {
|
|
22439
22461
|
if (C = C.split("=")[0], C = C.trim().replace(Tt, ""), C.length < 2) return "";
|
|
22440
22462
|
for (; C.length % 4 !== 0; )
|
|
22441
22463
|
C = C + "=";
|
|
@@ -22502,7 +22524,7 @@ Oa.write = function(n, t, e, s, i, r) {
|
|
|
22502
22524
|
return _;
|
|
22503
22525
|
}
|
|
22504
22526
|
function Nt(C) {
|
|
22505
|
-
return t.toByteArray(
|
|
22527
|
+
return t.toByteArray(ht(C));
|
|
22506
22528
|
}
|
|
22507
22529
|
function zt(C, m, y, T) {
|
|
22508
22530
|
for (var k = 0; k < T && !(k + y >= m.length || k >= C.length); ++k)
|
|
@@ -23105,8 +23127,8 @@ function Dy() {
|
|
|
23105
23127
|
if (!S)
|
|
23106
23128
|
x += this.iconv.decode(g.slice(b), "ascii");
|
|
23107
23129
|
else {
|
|
23108
|
-
var F = v + this.iconv.decode(g.slice(b), "ascii"),
|
|
23109
|
-
v = F.slice(
|
|
23130
|
+
var F = v + this.iconv.decode(g.slice(b), "ascii"), M = F.length - F.length % 8;
|
|
23131
|
+
v = F.slice(M), F = F.slice(0, M), x += this.iconv.decode(n.from(F, "base64"), "utf16-be");
|
|
23110
23132
|
}
|
|
23111
23133
|
return this.inBase64 = S, this.base64Accum = v, x;
|
|
23112
23134
|
}, i.prototype.end = function() {
|
|
@@ -23122,8 +23144,8 @@ function Dy() {
|
|
|
23122
23144
|
}
|
|
23123
23145
|
f.prototype.write = function(g) {
|
|
23124
23146
|
for (var x = this.inBase64, b = this.base64Accum, S = this.base64AccumIdx, v = n.alloc(g.length * 5 + 10), w = 0, F = 0; F < g.length; F++) {
|
|
23125
|
-
var
|
|
23126
|
-
|
|
23147
|
+
var M = g.charCodeAt(F);
|
|
23148
|
+
M >= 32 && M <= 126 ? (x && (S > 0 && (w += v.write(b.slice(0, S).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), w), S = 0), v[w++] = h, x = !1), x || (v[w++] = M, M === l && (v[w++] = h))) : (x || (v[w++] = l, x = !0), x && (b[S++] = M >> 8, b[S++] = M & 255, S == b.length && (w += v.write(b.toString("base64").replace(/\//g, ","), w), S = 0)));
|
|
23127
23149
|
}
|
|
23128
23150
|
return this.inBase64 = x, this.base64AccumIdx = S, v.slice(0, w);
|
|
23129
23151
|
}, f.prototype.end = function() {
|
|
@@ -23150,8 +23172,8 @@ function Dy() {
|
|
|
23150
23172
|
if (!S)
|
|
23151
23173
|
x += this.iconv.decode(g.slice(b), "ascii");
|
|
23152
23174
|
else {
|
|
23153
|
-
var F = v + this.iconv.decode(g.slice(b), "ascii").replace(/,/g, "/"),
|
|
23154
|
-
v = F.slice(
|
|
23175
|
+
var F = v + this.iconv.decode(g.slice(b), "ascii").replace(/,/g, "/"), M = F.length - F.length % 8;
|
|
23176
|
+
v = F.slice(M), F = F.slice(0, M), x += this.iconv.decode(n.from(F, "base64"), "utf16-be");
|
|
23155
23177
|
}
|
|
23156
23178
|
return this.inBase64 = S, this.base64Accum = v, x;
|
|
23157
23179
|
}, p.prototype.end = function() {
|
|
@@ -23834,17 +23856,17 @@ function Ny() {
|
|
|
23834
23856
|
v[w] = i - x;
|
|
23835
23857
|
else if (v[w] > i)
|
|
23836
23858
|
throw new Error("gb18030 decode tables conflict at byte 2");
|
|
23837
|
-
for (var F = this.decodeTables[i - v[w]],
|
|
23838
|
-
if (F[
|
|
23839
|
-
F[
|
|
23859
|
+
for (var F = this.decodeTables[i - v[w]], M = 129; M <= 254; M++) {
|
|
23860
|
+
if (F[M] === t)
|
|
23861
|
+
F[M] = i - b;
|
|
23840
23862
|
else {
|
|
23841
|
-
if (F[
|
|
23863
|
+
if (F[M] === i - b)
|
|
23842
23864
|
continue;
|
|
23843
|
-
if (F[
|
|
23865
|
+
if (F[M] > i)
|
|
23844
23866
|
throw new Error("gb18030 decode tables conflict at byte 3");
|
|
23845
23867
|
}
|
|
23846
|
-
for (var
|
|
23847
|
-
|
|
23868
|
+
for (var O = this.decodeTables[i - F[M]], I = 48; I <= 57; I++)
|
|
23869
|
+
O[I] === t && (O[I] = e);
|
|
23848
23870
|
}
|
|
23849
23871
|
}
|
|
23850
23872
|
}
|
|
@@ -23893,15 +23915,15 @@ function Ny() {
|
|
|
23893
23915
|
else
|
|
23894
23916
|
throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + f[0]);
|
|
23895
23917
|
} else if (S > 4080 && S <= 4095) {
|
|
23896
|
-
for (var w = 4095 - S + 2, F = [],
|
|
23918
|
+
for (var w = 4095 - S + 2, F = [], M = 0; M < w; M++)
|
|
23897
23919
|
F.push(x.charCodeAt(b++));
|
|
23898
23920
|
d[p++] = s - this.decodeTableSeq.length, this.decodeTableSeq.push(F);
|
|
23899
23921
|
} else
|
|
23900
23922
|
d[p++] = S;
|
|
23901
23923
|
}
|
|
23902
23924
|
else if (typeof x == "number")
|
|
23903
|
-
for (var
|
|
23904
|
-
d[p++] =
|
|
23925
|
+
for (var O = d[p - 1] + 1, b = 0; b < x; b++)
|
|
23926
|
+
d[p++] = O++;
|
|
23905
23927
|
else
|
|
23906
23928
|
throw new Error("Incorrect type '" + typeof x + "' given in " + this.encodingName + " at chunk " + f[0]);
|
|
23907
23929
|
}
|
|
@@ -23930,8 +23952,8 @@ function Ny() {
|
|
|
23930
23952
|
else if (v <= i) {
|
|
23931
23953
|
var F = i - v;
|
|
23932
23954
|
if (!b[F]) {
|
|
23933
|
-
var
|
|
23934
|
-
this._fillEncodeTable(F,
|
|
23955
|
+
var M = w << 8 >>> 0;
|
|
23956
|
+
this._fillEncodeTable(F, M, d) ? x = !0 : b[F] = !0;
|
|
23935
23957
|
}
|
|
23936
23958
|
} else v <= s && (this._setEncodeSequence(this.decodeTableSeq[s - v], w), x = !0);
|
|
23937
23959
|
}
|
|
@@ -23968,15 +23990,15 @@ function Ny() {
|
|
|
23968
23990
|
} else typeof F == "number" ? w = F : F == null && (F = g[a], F !== void 0 && (w = F, x = v));
|
|
23969
23991
|
g = void 0;
|
|
23970
23992
|
} else if (v >= 0) {
|
|
23971
|
-
var
|
|
23972
|
-
if (
|
|
23993
|
+
var M = this.encodeTable[v >> 8];
|
|
23994
|
+
if (M !== void 0 && (w = M[v & 255]), w <= s) {
|
|
23973
23995
|
g = this.encodeTableSeq[s - w];
|
|
23974
23996
|
continue;
|
|
23975
23997
|
}
|
|
23976
23998
|
if (w == t && this.gb18030) {
|
|
23977
|
-
var
|
|
23978
|
-
if (
|
|
23979
|
-
var w = this.gb18030.gbChars[
|
|
23999
|
+
var O = u(this.gb18030.uChars, v);
|
|
24000
|
+
if (O != -1) {
|
|
24001
|
+
var w = this.gb18030.gbChars[O] + (v - this.gb18030.uChars[O]);
|
|
23980
24002
|
p[S++] = 129 + Math.floor(w / 12600), w = w % 12600, p[S++] = 48 + Math.floor(w / 1260), w = w % 1260, p[S++] = 129 + Math.floor(w / 10), w = w % 10, p[S++] = 48 + w;
|
|
23981
24003
|
continue;
|
|
23982
24004
|
}
|
|
@@ -24005,11 +24027,11 @@ function Ny() {
|
|
|
24005
24027
|
S = this.defaultCharUnicode.charCodeAt(0), v = b;
|
|
24006
24028
|
else if (S === e) {
|
|
24007
24029
|
if (v >= 3)
|
|
24008
|
-
var
|
|
24030
|
+
var M = (f[v - 3] - 129) * 12600 + (f[v - 2] - 48) * 1260 + (f[v - 1] - 129) * 10 + (F - 48);
|
|
24009
24031
|
else
|
|
24010
|
-
var
|
|
24011
|
-
var
|
|
24012
|
-
S = this.gb18030.uChars[
|
|
24032
|
+
var M = (g[v - 3 + x] - 129) * 12600 + ((v - 2 >= 0 ? f[v - 2] : g[v - 2 + x]) - 48) * 1260 + ((v - 1 >= 0 ? f[v - 1] : g[v - 1 + x]) - 129) * 10 + (F - 48);
|
|
24033
|
+
var O = u(this.gb18030.gbChars, M);
|
|
24034
|
+
S = this.gb18030.uChars[O] + M - this.gb18030.gbChars[O];
|
|
24013
24035
|
} else if (S <= i) {
|
|
24014
24036
|
d = i - S;
|
|
24015
24037
|
continue;
|
|
@@ -32827,18 +32849,17 @@ const Xe = class Xe extends Fh {
|
|
|
32827
32849
|
generateShapes(t, e) {
|
|
32828
32850
|
const s = [];
|
|
32829
32851
|
let i = 0;
|
|
32830
|
-
for (
|
|
32831
|
-
|
|
32832
|
-
if (a === " ") {
|
|
32852
|
+
for (const r of t) {
|
|
32853
|
+
if (r === " ") {
|
|
32833
32854
|
i += this.getSpaceAdvance(e);
|
|
32834
32855
|
continue;
|
|
32835
32856
|
}
|
|
32836
|
-
const
|
|
32837
|
-
if (!
|
|
32838
|
-
i += this.getSpaceAdvance(e), this.addUnsupportedChar(
|
|
32857
|
+
const a = this.getCharShape(r, e);
|
|
32858
|
+
if (!a) {
|
|
32859
|
+
i += this.getSpaceAdvance(e), this.addUnsupportedChar(r);
|
|
32839
32860
|
continue;
|
|
32840
32861
|
}
|
|
32841
|
-
s.push(
|
|
32862
|
+
s.push(a.offset(new at(i, 0))), i += a.width;
|
|
32842
32863
|
}
|
|
32843
32864
|
return s;
|
|
32844
32865
|
}
|
|
@@ -34761,9 +34782,9 @@ class nh {
|
|
|
34761
34782
|
processWord(t, e, s, i, r) {
|
|
34762
34783
|
const a = [];
|
|
34763
34784
|
let o = 0;
|
|
34764
|
-
for (
|
|
34765
|
-
const h =
|
|
34766
|
-
a.push({ char:
|
|
34785
|
+
for (const c of t) {
|
|
34786
|
+
const h = this.resolveCharShape(c), l = h == null ? void 0 : h.shape;
|
|
34787
|
+
a.push({ char: c, shape: l }), l ? this.currentHorizontalAlignment == ct.DISTRIBUTED ? o += l.width * this.currentWidthFactor : o += l.width * this.currentWordSpace * this.currentWidthFactor : o += this.currentBlankAdvance;
|
|
34767
34788
|
}
|
|
34768
34789
|
this.hOffset + o > (this.maxLineWidth || 1 / 0) && (this._vOffset <= 0 && this._currentLineObjects.length <= 0 || (this.recordVisualLineBreak(i, r), this.advanceToNextLine(!1)));
|
|
34769
34790
|
for (const { char: c } of a)
|
|
@@ -34788,58 +34809,58 @@ class nh {
|
|
|
34788
34809
|
const [a, o, c] = t, h = this._hOffset, l = this._vOffset, u = this._currentContext.charTrackingFactor.value, f = this.currentFontSize, p = this._currentContext.fontSizeScaleFactor;
|
|
34789
34810
|
this._hOffset = h, this._currentContext.charTrackingFactor = { value: 1, isRelative: !1 };
|
|
34790
34811
|
let d = 0;
|
|
34791
|
-
for (
|
|
34792
|
-
const w = this.getCharShape(
|
|
34812
|
+
for (const v of a) {
|
|
34813
|
+
const w = this.getCharShape(v);
|
|
34793
34814
|
w && (d += w.width * this.currentWidthFactor);
|
|
34794
34815
|
}
|
|
34795
34816
|
this._hOffset = h;
|
|
34796
34817
|
let g = 0;
|
|
34797
|
-
for (
|
|
34798
|
-
const w = this.getCharShape(
|
|
34818
|
+
for (const v of o) {
|
|
34819
|
+
const w = this.getCharShape(v);
|
|
34799
34820
|
w && (g += w.width * this.currentWidthFactor);
|
|
34800
34821
|
}
|
|
34801
34822
|
const x = Math.max(d, g), b = (x - d) / 2, S = (x - g) / 2;
|
|
34802
34823
|
if (c === "^") {
|
|
34803
34824
|
if (a && !o) {
|
|
34804
34825
|
this._currentContext.fontSizeScaleFactor = p * 0.7, this.calcuateLineParams();
|
|
34805
|
-
const v = [], w = [], F = [],
|
|
34826
|
+
const v = [], w = [], F = [], M = [];
|
|
34806
34827
|
this._hOffset = h, this._vOffset = this.convertTopAlignedVOffset(
|
|
34807
34828
|
l + f * 0.1,
|
|
34808
34829
|
this.currentFontSize
|
|
34809
34830
|
);
|
|
34810
|
-
for (
|
|
34831
|
+
for (const O of a)
|
|
34811
34832
|
this.processChar(
|
|
34812
|
-
|
|
34833
|
+
O,
|
|
34813
34834
|
v,
|
|
34814
34835
|
w,
|
|
34815
34836
|
F,
|
|
34816
|
-
|
|
34837
|
+
M
|
|
34817
34838
|
);
|
|
34818
|
-
e.push(...v), s.push(...w), i.push(...F), r.push(...
|
|
34839
|
+
e.push(...v), s.push(...w), i.push(...F), r.push(...M), this._hOffset = h + d, this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams();
|
|
34819
34840
|
} else if (!a && o) {
|
|
34820
34841
|
this._currentContext.fontSizeScaleFactor = p * 0.7, this.calcuateLineParams();
|
|
34821
|
-
const v = [], w = [], F = [],
|
|
34842
|
+
const v = [], w = [], F = [], M = [];
|
|
34822
34843
|
this._hOffset = h, this._vOffset = this.convertTopAlignedVOffset(
|
|
34823
34844
|
l - f * 0.6,
|
|
34824
34845
|
this.currentFontSize
|
|
34825
34846
|
);
|
|
34826
|
-
for (
|
|
34847
|
+
for (const O of o)
|
|
34827
34848
|
this.processChar(
|
|
34828
|
-
|
|
34849
|
+
O,
|
|
34829
34850
|
v,
|
|
34830
34851
|
w,
|
|
34831
34852
|
F,
|
|
34832
|
-
|
|
34853
|
+
M
|
|
34833
34854
|
);
|
|
34834
|
-
e.push(...v), s.push(...w), i.push(...F), r.push(...
|
|
34855
|
+
e.push(...v), s.push(...w), i.push(...F), r.push(...M), this._hOffset = h + g, this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams();
|
|
34835
34856
|
} else if (a && o) {
|
|
34836
34857
|
const v = this._currentContext.fontScaleFactor || 1, w = (this._maxFontSize || this.currentFontSize) / v, F = Math.abs(this.currentLayoutFontSize - w) < 1e-6;
|
|
34837
34858
|
F && (this._currentContext.fontSizeScaleFactor = p * 0.7, this.calcuateLineParams());
|
|
34838
|
-
const
|
|
34839
|
-
this._hOffset = h +
|
|
34840
|
-
for (
|
|
34859
|
+
const M = Math.max(d, g), O = 0, I = 0, H = this.currentLayoutFontSize, D = l - w + H, W = D + this.currentFontSize, J = [], R = [], U = [], P = [];
|
|
34860
|
+
this._hOffset = h + O, this._vOffset = W;
|
|
34861
|
+
for (const ut of a)
|
|
34841
34862
|
this.processChar(
|
|
34842
|
-
|
|
34863
|
+
ut,
|
|
34843
34864
|
J,
|
|
34844
34865
|
R,
|
|
34845
34866
|
U,
|
|
@@ -34848,51 +34869,51 @@ class nh {
|
|
|
34848
34869
|
e.push(...J), s.push(...R), i.push(...U), r.push(...P);
|
|
34849
34870
|
const Q = [], yt = [], Ut = [], Ct = [];
|
|
34850
34871
|
this._hOffset = h + I, this._vOffset = D;
|
|
34851
|
-
for (
|
|
34872
|
+
for (const ut of o)
|
|
34852
34873
|
this.processChar(
|
|
34853
|
-
|
|
34874
|
+
ut,
|
|
34854
34875
|
Q,
|
|
34855
34876
|
yt,
|
|
34856
34877
|
Ut,
|
|
34857
34878
|
Ct
|
|
34858
34879
|
);
|
|
34859
|
-
e.push(...Q), s.push(...yt), i.push(...Ut), r.push(...Ct), this._hOffset = h +
|
|
34880
|
+
e.push(...Q), s.push(...yt), i.push(...Ut), r.push(...Ct), this._hOffset = h + M, F && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
|
|
34860
34881
|
}
|
|
34861
34882
|
} else {
|
|
34862
|
-
const v = [], w = [], F = [],
|
|
34883
|
+
const v = [], w = [], F = [], M = [];
|
|
34863
34884
|
this._hOffset = h + b, this._vOffset = this.convertTopAlignedVOffset(
|
|
34864
34885
|
l + this.currentFontSize * 0.3,
|
|
34865
34886
|
this.currentFontSize
|
|
34866
34887
|
);
|
|
34867
|
-
for (
|
|
34888
|
+
for (const W of a)
|
|
34868
34889
|
this.processChar(
|
|
34869
|
-
|
|
34890
|
+
W,
|
|
34870
34891
|
v,
|
|
34871
34892
|
w,
|
|
34872
34893
|
F,
|
|
34873
|
-
|
|
34894
|
+
M
|
|
34874
34895
|
);
|
|
34875
|
-
e.push(...v), s.push(...w), i.push(...F), r.push(...
|
|
34896
|
+
e.push(...v), s.push(...w), i.push(...F), r.push(...M), (c === "/" || c === "#") && this.recordStackDivider(
|
|
34876
34897
|
h,
|
|
34877
34898
|
l,
|
|
34878
34899
|
x,
|
|
34879
34900
|
i,
|
|
34880
34901
|
r
|
|
34881
34902
|
);
|
|
34882
|
-
const
|
|
34903
|
+
const O = [], I = [], H = [], D = [];
|
|
34883
34904
|
this._hOffset = h + S, this._vOffset = this.convertTopAlignedVOffset(
|
|
34884
34905
|
l - this.currentFontSize * 0.6,
|
|
34885
34906
|
this.currentFontSize
|
|
34886
34907
|
);
|
|
34887
|
-
for (
|
|
34908
|
+
for (const W of o)
|
|
34888
34909
|
this.processChar(
|
|
34889
|
-
|
|
34890
|
-
|
|
34910
|
+
W,
|
|
34911
|
+
O,
|
|
34891
34912
|
I,
|
|
34892
34913
|
H,
|
|
34893
34914
|
D
|
|
34894
34915
|
);
|
|
34895
|
-
if (e.push(...
|
|
34916
|
+
if (e.push(...O), s.push(...I), i.push(...H), r.push(...D), c === "/" || c === "#") {
|
|
34896
34917
|
const W = new Dt(), J = new Float32Array([
|
|
34897
34918
|
h,
|
|
34898
34919
|
l - this.currentFontSize * 0.8 + this.defaultFontSize * oi,
|
|
@@ -35064,7 +35085,7 @@ class nh {
|
|
|
35064
35085
|
r
|
|
35065
35086
|
);
|
|
35066
35087
|
const x = c.width * this.currentWidthFactor + d * this.currentWidthFactor;
|
|
35067
|
-
this.currentHorizontalAlignment ==
|
|
35088
|
+
this.currentHorizontalAlignment == ct.DISTRIBUTED ? this._hOffset += x : this._hOffset += c.width * this.currentWordSpace * this.currentWidthFactor + d * this.currentWidthFactor, this._lineHasRenderableChar = !0;
|
|
35068
35089
|
const b = u * 0.05, S = 1e-3;
|
|
35069
35090
|
if (this._currentContext.underline) {
|
|
35070
35091
|
const v = l - b;
|
|
@@ -35326,12 +35347,12 @@ class nh {
|
|
|
35326
35347
|
});
|
|
35327
35348
|
};
|
|
35328
35349
|
switch (this.currentHorizontalAlignment) {
|
|
35329
|
-
case
|
|
35330
|
-
case
|
|
35350
|
+
case ct.LEFT:
|
|
35351
|
+
case ct.JUSTIFIED: {
|
|
35331
35352
|
a();
|
|
35332
35353
|
break;
|
|
35333
35354
|
}
|
|
35334
|
-
case
|
|
35355
|
+
case ct.CENTER: {
|
|
35335
35356
|
if (!Number.isFinite(this.maxLineWidth)) {
|
|
35336
35357
|
a();
|
|
35337
35358
|
break;
|
|
@@ -35342,7 +35363,7 @@ class nh {
|
|
|
35342
35363
|
});
|
|
35343
35364
|
break;
|
|
35344
35365
|
}
|
|
35345
|
-
case
|
|
35366
|
+
case ct.RIGHT: {
|
|
35346
35367
|
if (!Number.isFinite(this.maxLineWidth)) {
|
|
35347
35368
|
a();
|
|
35348
35369
|
break;
|
|
@@ -35353,7 +35374,7 @@ class nh {
|
|
|
35353
35374
|
});
|
|
35354
35375
|
break;
|
|
35355
35376
|
}
|
|
35356
|
-
case
|
|
35377
|
+
case ct.DISTRIBUTED: {
|
|
35357
35378
|
if (!Number.isFinite(this.maxLineWidth)) {
|
|
35358
35379
|
a();
|
|
35359
35380
|
break;
|
|
@@ -35480,6 +35501,13 @@ function yx(n) {
|
|
|
35480
35501
|
}
|
|
35481
35502
|
});
|
|
35482
35503
|
}
|
|
35504
|
+
const xx = /\\U\+([0-9A-Fa-f]{4})/g;
|
|
35505
|
+
function bx(n) {
|
|
35506
|
+
return n.replace(xx, (t, e) => {
|
|
35507
|
+
const s = parseInt(e, 16);
|
|
35508
|
+
return String.fromCharCode(s);
|
|
35509
|
+
});
|
|
35510
|
+
}
|
|
35483
35511
|
const as = /* @__PURE__ */ new E(), _e = /* @__PURE__ */ new E(), Le = /* @__PURE__ */ new E(), sh = /* @__PURE__ */ new E(1, 0, 0);
|
|
35484
35512
|
class Ra extends Xt {
|
|
35485
35513
|
/**
|
|
@@ -35738,7 +35766,7 @@ class Ra extends Xt {
|
|
|
35738
35766
|
fontSize: s,
|
|
35739
35767
|
widthFactor: i,
|
|
35740
35768
|
lineSpaceFactor: $c,
|
|
35741
|
-
horizontalAlignment:
|
|
35769
|
+
horizontalAlignment: ct.LEFT,
|
|
35742
35770
|
maxWidth: 0,
|
|
35743
35771
|
flowDirection: oe.BOTTOM_TO_TOP,
|
|
35744
35772
|
byBlockColor: this._colorSettings.byBlockColor,
|
|
@@ -35772,23 +35800,23 @@ class Ra extends Xt {
|
|
|
35772
35800
|
this.styleManager.unsupportedTextStyles[b] || (this.styleManager.unsupportedTextStyles[b] = 0), this.styleManager.unsupportedTextStyles[b]++;
|
|
35773
35801
|
}
|
|
35774
35802
|
const s = Jc(t) || 0, i = Number.isFinite(s) && s > 0;
|
|
35775
|
-
let r =
|
|
35803
|
+
let r = ct.LEFT;
|
|
35776
35804
|
i && t.attachmentPoint && ([
|
|
35777
35805
|
nt.TopLeft,
|
|
35778
35806
|
nt.MiddleLeft,
|
|
35779
35807
|
nt.BottomLeft,
|
|
35780
35808
|
nt.BaselineLeft
|
|
35781
|
-
].includes(t.attachmentPoint) ? r =
|
|
35809
|
+
].includes(t.attachmentPoint) ? r = ct.LEFT : [
|
|
35782
35810
|
nt.TopCenter,
|
|
35783
35811
|
nt.MiddleCenter,
|
|
35784
35812
|
nt.BottomCenter,
|
|
35785
35813
|
nt.BaselineCenter
|
|
35786
|
-
].includes(t.attachmentPoint) ? r =
|
|
35814
|
+
].includes(t.attachmentPoint) ? r = ct.CENTER : [
|
|
35787
35815
|
nt.TopRight,
|
|
35788
35816
|
nt.MiddleRight,
|
|
35789
35817
|
nt.BottomRight,
|
|
35790
35818
|
nt.BaselineRight
|
|
35791
|
-
].includes(t.attachmentPoint) && (r =
|
|
35819
|
+
].includes(t.attachmentPoint) && (r = ct.RIGHT));
|
|
35792
35820
|
let a = Ye.BOTTOM;
|
|
35793
35821
|
t.attachmentPoint && ([
|
|
35794
35822
|
nt.TopLeft,
|
|
@@ -35824,11 +35852,15 @@ class Ra extends Xt {
|
|
|
35824
35852
|
this.styleManager,
|
|
35825
35853
|
this.fontManager,
|
|
35826
35854
|
u
|
|
35827
|
-
), g = new nu(
|
|
35828
|
-
|
|
35829
|
-
|
|
35830
|
-
|
|
35831
|
-
|
|
35855
|
+
), g = new nu(
|
|
35856
|
+
bx(yx(t.text)),
|
|
35857
|
+
f,
|
|
35858
|
+
{
|
|
35859
|
+
resetParagraphParameters: !0,
|
|
35860
|
+
yieldPropertyCommands: !0,
|
|
35861
|
+
yieldPercentSymbols: !0
|
|
35862
|
+
}
|
|
35863
|
+
).parse();
|
|
35832
35864
|
return {
|
|
35833
35865
|
object: p.processText(g),
|
|
35834
35866
|
height: p.totalHeight
|
|
@@ -36109,7 +36141,7 @@ self.addEventListener("message", async (n) => {
|
|
|
36109
36141
|
switch (t) {
|
|
36110
36142
|
case "render": {
|
|
36111
36143
|
if (!s) throw new Error("Missing data for render message");
|
|
36112
|
-
const { mtextContent: i, textStyle: r, colorSettings: a } = s, o =
|
|
36144
|
+
const { mtextContent: i, textStyle: r, colorSettings: a } = s, o = vx(a);
|
|
36113
36145
|
let c = new Ra(
|
|
36114
36146
|
i,
|
|
36115
36147
|
r,
|
|
@@ -36118,7 +36150,7 @@ self.addEventListener("message", async (n) => {
|
|
|
36118
36150
|
o
|
|
36119
36151
|
);
|
|
36120
36152
|
await c.asyncDraw(), c.updateMatrixWorld(!0);
|
|
36121
|
-
const { data: h, transferableObjects: l } =
|
|
36153
|
+
const { data: h, transferableObjects: l } = Sx(c);
|
|
36122
36154
|
self.postMessage(
|
|
36123
36155
|
{
|
|
36124
36156
|
type: "render",
|
|
@@ -36229,7 +36261,7 @@ self.addEventListener("message", async (n) => {
|
|
|
36229
36261
|
});
|
|
36230
36262
|
}
|
|
36231
36263
|
});
|
|
36232
|
-
function
|
|
36264
|
+
function vx(n) {
|
|
36233
36265
|
const t = {
|
|
36234
36266
|
byLayerColor: 16777215,
|
|
36235
36267
|
byBlockColor: 16777215,
|
|
@@ -36250,10 +36282,10 @@ function xx(n) {
|
|
|
36250
36282
|
color: i
|
|
36251
36283
|
};
|
|
36252
36284
|
}
|
|
36253
|
-
function
|
|
36285
|
+
function Sx(n) {
|
|
36254
36286
|
const e = n.children[0] ?? n, s = e.matrixWorld.clone(), i = new E(), r = new gn(), a = new E();
|
|
36255
36287
|
s.decompose(i, r, a);
|
|
36256
|
-
const o = n.box.clone(), { children: c, transferableObjects: h } =
|
|
36288
|
+
const o = n.box.clone(), { children: c, transferableObjects: h } = wx(e);
|
|
36257
36289
|
return { data: {
|
|
36258
36290
|
// Basic properties
|
|
36259
36291
|
type: "MText",
|
|
@@ -36290,7 +36322,7 @@ function bx(n) {
|
|
|
36290
36322
|
}, transferableObjects: h };
|
|
36291
36323
|
}
|
|
36292
36324
|
const rh = /* @__PURE__ */ new mt(), ah = /* @__PURE__ */ new mt();
|
|
36293
|
-
function
|
|
36325
|
+
function wx(n) {
|
|
36294
36326
|
const t = [], e = [];
|
|
36295
36327
|
return n.updateWorldMatrix(!0, !0), rh.copy(n.matrixWorld).invert(), n.traverse((s) => {
|
|
36296
36328
|
var i, r, a, o, c;
|
|
@@ -36304,13 +36336,13 @@ function vx(n) {
|
|
|
36304
36336
|
), ah.decompose(u, f, p);
|
|
36305
36337
|
const d = {};
|
|
36306
36338
|
h.attributes && Object.keys(h.attributes).forEach((v) => {
|
|
36307
|
-
const w = h.attributes[v],
|
|
36339
|
+
const w = h.attributes[v], O = new Uint8Array(
|
|
36308
36340
|
w.array.buffer,
|
|
36309
36341
|
w.array.byteOffset,
|
|
36310
36342
|
w.array.byteLength
|
|
36311
36343
|
).slice().buffer;
|
|
36312
|
-
e.push(
|
|
36313
|
-
arrayBuffer:
|
|
36344
|
+
e.push(O), d[v] = {
|
|
36345
|
+
arrayBuffer: O,
|
|
36314
36346
|
byteOffset: 0,
|
|
36315
36347
|
// Since we copied, offset is 0
|
|
36316
36348
|
length: w.array.length,
|
|
@@ -36320,13 +36352,13 @@ function vx(n) {
|
|
|
36320
36352
|
});
|
|
36321
36353
|
let g = null;
|
|
36322
36354
|
if (h.index) {
|
|
36323
|
-
const v = h.index.array,
|
|
36355
|
+
const v = h.index.array, M = new Uint8Array(
|
|
36324
36356
|
v.buffer,
|
|
36325
36357
|
v.byteOffset,
|
|
36326
36358
|
v.byteLength
|
|
36327
36359
|
).slice().buffer;
|
|
36328
|
-
e.push(
|
|
36329
|
-
arrayBuffer:
|
|
36360
|
+
e.push(M), g = {
|
|
36361
|
+
arrayBuffer: M,
|
|
36330
36362
|
byteOffset: 0,
|
|
36331
36363
|
length: v.length,
|
|
36332
36364
|
componentType: v instanceof Uint32Array ? "uint32" : "uint16"
|
|
@@ -36369,7 +36401,7 @@ function vx(n) {
|
|
|
36369
36401
|
},
|
|
36370
36402
|
material: x,
|
|
36371
36403
|
charBoxType: (r = s.userData) == null ? void 0 : r.charBoxType,
|
|
36372
|
-
lineLayouts: Array.isArray((a = s.userData) == null ? void 0 : a.lineLayouts) ?
|
|
36404
|
+
lineLayouts: Array.isArray((a = s.userData) == null ? void 0 : a.lineLayouts) ? Cx(s.userData.lineLayouts) : void 0,
|
|
36373
36405
|
charBoxes: Array.isArray((c = (o = s.userData) == null ? void 0 : o.layout) == null ? void 0 : c.chars) ? Xl(s.userData.layout.chars) : void 0
|
|
36374
36406
|
};
|
|
36375
36407
|
t.push(S);
|
|
@@ -36396,7 +36428,7 @@ function Xl(n) {
|
|
|
36396
36428
|
children: Xl(t.children ?? [])
|
|
36397
36429
|
}));
|
|
36398
36430
|
}
|
|
36399
|
-
function
|
|
36431
|
+
function Cx(n) {
|
|
36400
36432
|
return n.map((t) => ({
|
|
36401
36433
|
y: t.y,
|
|
36402
36434
|
height: t.height,
|