@mlightcad/mtext-renderer 0.3.1 → 0.3.3
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 +309 -272
- package/dist/index.umd.cjs +2 -2
- package/dist/renderer/mtext.d.ts +16 -0
- package/dist/renderer/mtextProcessor.d.ts +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -630,8 +630,8 @@ function Ba(t, e, r) {
|
|
|
630
630
|
`)
|
|
631
631
|
u = 0, o -= s;
|
|
632
632
|
else {
|
|
633
|
-
const
|
|
634
|
-
u +=
|
|
633
|
+
const f = Pa(c, a, u, o, r);
|
|
634
|
+
u += f.offsetX, i.push(f.path);
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
return i;
|
|
@@ -643,7 +643,7 @@ function Pa(t, e, r, n, a) {
|
|
|
643
643
|
return;
|
|
644
644
|
}
|
|
645
645
|
const i = new va();
|
|
646
|
-
let u, o, l, c,
|
|
646
|
+
let u, o, l, c, f, h, p, d;
|
|
647
647
|
if (s.o) {
|
|
648
648
|
const g = s._cachedOutline || (s._cachedOutline = s.o.split(" "));
|
|
649
649
|
for (let y = 0, m = g.length; y < m; )
|
|
@@ -655,10 +655,10 @@ function Pa(t, e, r, n, a) {
|
|
|
655
655
|
u = g[y++] * e + r, o = g[y++] * e + n, i.lineTo(u, o);
|
|
656
656
|
break;
|
|
657
657
|
case "q":
|
|
658
|
-
l = g[y++] * e + r, c = g[y++] * e + n,
|
|
658
|
+
l = g[y++] * e + r, c = g[y++] * e + n, f = g[y++] * e + r, h = g[y++] * e + n, i.quadraticCurveTo(f, h, l, c);
|
|
659
659
|
break;
|
|
660
660
|
case "b":
|
|
661
|
-
l = g[y++] * e + r, c = g[y++] * e + n,
|
|
661
|
+
l = g[y++] * e + r, c = g[y++] * e + n, f = g[y++] * e + r, h = g[y++] * e + n, p = g[y++] * e + r, d = g[y++] * e + n, i.bezierCurveTo(f, h, p, d, l, c);
|
|
662
662
|
break;
|
|
663
663
|
}
|
|
664
664
|
}
|
|
@@ -834,9 +834,9 @@ function za(t, e, r) {
|
|
|
834
834
|
var c = Wt(t, Sr);
|
|
835
835
|
switch (c) {
|
|
836
836
|
case 16:
|
|
837
|
-
var
|
|
837
|
+
var f = he[u - 1];
|
|
838
838
|
for (o = fe(t, 2, 3); o; --o)
|
|
839
|
-
he[u++] =
|
|
839
|
+
he[u++] = f;
|
|
840
840
|
break;
|
|
841
841
|
case 17:
|
|
842
842
|
for (o = fe(t, 3, 3); o; --o)
|
|
@@ -922,23 +922,23 @@ Fe.prototype.addY = function(t) {
|
|
|
922
922
|
this.addPoint(null, t);
|
|
923
923
|
};
|
|
924
924
|
Fe.prototype.addBezier = function(t, e, r, n, a, s, i, u) {
|
|
925
|
-
var o = [t, e], l = [r, n], c = [a, s],
|
|
925
|
+
var o = [t, e], l = [r, n], c = [a, s], f = [i, u];
|
|
926
926
|
this.addPoint(t, e), this.addPoint(i, u);
|
|
927
927
|
for (var h = 0; h <= 1; h++) {
|
|
928
|
-
var
|
|
928
|
+
var p = 6 * o[h] - 12 * l[h] + 6 * c[h], d = -3 * o[h] + 9 * l[h] - 9 * c[h] + 3 * f[h], g = 3 * l[h] - 3 * o[h];
|
|
929
929
|
if (d === 0) {
|
|
930
|
-
if (
|
|
930
|
+
if (p === 0)
|
|
931
931
|
continue;
|
|
932
|
-
var y = -g /
|
|
933
|
-
0 < y && y < 1 && (h === 0 && this.addX(Re(o[h], l[h], c[h],
|
|
932
|
+
var y = -g / p;
|
|
933
|
+
0 < y && y < 1 && (h === 0 && this.addX(Re(o[h], l[h], c[h], f[h], y)), h === 1 && this.addY(Re(o[h], l[h], c[h], f[h], y)));
|
|
934
934
|
continue;
|
|
935
935
|
}
|
|
936
|
-
var m = Math.pow(
|
|
936
|
+
var m = Math.pow(p, 2) - 4 * g * d;
|
|
937
937
|
if (!(m < 0)) {
|
|
938
|
-
var S = (-
|
|
939
|
-
0 < S && S < 1 && (h === 0 && this.addX(Re(o[h], l[h], c[h],
|
|
940
|
-
var x = (-
|
|
941
|
-
0 < x && x < 1 && (h === 0 && this.addX(Re(o[h], l[h], c[h],
|
|
938
|
+
var S = (-p + Math.sqrt(m)) / (2 * d);
|
|
939
|
+
0 < S && S < 1 && (h === 0 && this.addX(Re(o[h], l[h], c[h], f[h], S)), h === 1 && this.addY(Re(o[h], l[h], c[h], f[h], S)));
|
|
940
|
+
var x = (-p - Math.sqrt(m)) / (2 * d);
|
|
941
|
+
0 < x && x < 1 && (h === 0 && this.addX(Re(o[h], l[h], c[h], f[h], x)), h === 1 && this.addY(Re(o[h], l[h], c[h], f[h], x)));
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
944
|
};
|
|
@@ -1406,8 +1406,8 @@ b.TABLE = function(t) {
|
|
|
1406
1406
|
i.type === "TABLE" ? (a.push(e.length), e = e.concat([0, 0]), n.push(l)) : e = e.concat(l);
|
|
1407
1407
|
}
|
|
1408
1408
|
for (var c = 0; c < n.length; c += 1) {
|
|
1409
|
-
var
|
|
1410
|
-
E.argument(h < 65536, "Table " + t.tableName + " too big."), e[
|
|
1409
|
+
var f = a[c], h = e.length;
|
|
1410
|
+
E.argument(h < 65536, "Table " + t.tableName + " too big."), e[f] = h >> 8, e[f + 1] = h & 255, e = e.concat(n[c]);
|
|
1411
1411
|
}
|
|
1412
1412
|
return e;
|
|
1413
1413
|
};
|
|
@@ -1914,8 +1914,8 @@ function ns(t, e, r, n, a) {
|
|
|
1914
1914
|
t.length = e.parseUShort(), t.language = e.parseUShort();
|
|
1915
1915
|
var s;
|
|
1916
1916
|
t.segCount = s = e.parseUShort() >> 1, e.skip("uShort", 3), t.glyphIndexMap = {};
|
|
1917
|
-
for (var i = new F.Parser(r, n + a + 14), u = new F.Parser(r, n + a + 16 + s * 2), o = new F.Parser(r, n + a + 16 + s * 4), l = new F.Parser(r, n + a + 16 + s * 6), c = n + a + 16 + s * 8,
|
|
1918
|
-
for (var h = void 0,
|
|
1917
|
+
for (var i = new F.Parser(r, n + a + 14), u = new F.Parser(r, n + a + 16 + s * 2), o = new F.Parser(r, n + a + 16 + s * 4), l = new F.Parser(r, n + a + 16 + s * 6), c = n + a + 16 + s * 8, f = 0; f < s - 1; f += 1)
|
|
1918
|
+
for (var h = void 0, p = i.parseUShort(), d = u.parseUShort(), g = o.parseShort(), y = l.parseUShort(), m = d; m <= p; m += 1)
|
|
1919
1919
|
y !== 0 ? (c = l.offset + l.relativeOffset - 2, c += y, c += (m - d) * 2, h = F.getUShort(r, c), h !== 0 && (h = h + g & 65535)) : h = m + g & 65535, t.glyphIndexMap[m] = h;
|
|
1920
1920
|
}
|
|
1921
1921
|
function as(t, e) {
|
|
@@ -1998,14 +1998,14 @@ function os(t) {
|
|
|
1998
1998
|
});
|
|
1999
1999
|
}
|
|
2000
2000
|
is(s);
|
|
2001
|
-
var o = s.segments.length, l = 0, c = [],
|
|
2001
|
+
var o = s.segments.length, l = 0, c = [], f = [], h = [], p = [], d = [], g = [];
|
|
2002
2002
|
for (r = 0; r < o; r += 1) {
|
|
2003
2003
|
var y = s.segments[r];
|
|
2004
|
-
y.end <= 65535 && y.start <= 65535 ? (c = c.concat({ name: "end_" + r, type: "USHORT", value: y.end }),
|
|
2004
|
+
y.end <= 65535 && y.start <= 65535 ? (c = c.concat({ name: "end_" + r, type: "USHORT", value: y.end }), f = f.concat({ name: "start_" + r, type: "USHORT", value: y.start }), h = h.concat({ name: "idDelta_" + r, type: "SHORT", value: y.delta }), p = p.concat({ name: "idRangeOffset_" + r, type: "USHORT", value: y.offset }), y.glyphId !== void 0 && (d = d.concat({ name: "glyph_" + r, type: "USHORT", value: y.glyphId }))) : l += 1, !e && y.glyphIndex !== void 0 && (g = g.concat({ name: "cmap12Start_" + r, type: "ULONG", value: y.start }), g = g.concat({ name: "cmap12End_" + r, type: "ULONG", value: y.end }), g = g.concat({ name: "cmap12Glyph_" + r, type: "ULONG", value: y.glyphIndex }));
|
|
2005
2005
|
}
|
|
2006
|
-
if (s.segCountX2 = (o - l) * 2, s.searchRange = Math.pow(2, Math.floor(Math.log(o - l) / Math.log(2))) * 2, s.entrySelector = Math.log(s.searchRange / 2) / Math.log(2), s.rangeShift = s.segCountX2 - s.searchRange, s.fields = s.fields.concat(c), s.fields.push({ name: "reservedPad", type: "USHORT", value: 0 }), s.fields = s.fields.concat(
|
|
2006
|
+
if (s.segCountX2 = (o - l) * 2, s.searchRange = Math.pow(2, Math.floor(Math.log(o - l) / Math.log(2))) * 2, s.entrySelector = Math.log(s.searchRange / 2) / Math.log(2), s.rangeShift = s.segCountX2 - s.searchRange, s.fields = s.fields.concat(c), s.fields.push({ name: "reservedPad", type: "USHORT", value: 0 }), s.fields = s.fields.concat(f), s.fields = s.fields.concat(h), s.fields = s.fields.concat(p), s.fields = s.fields.concat(d), s.cmap4Length = 14 + // Subtable header
|
|
2007
2007
|
c.length * 2 + 2 + // reservedPad
|
|
2008
|
-
|
|
2008
|
+
f.length * 2 + h.length * 2 + p.length * 2 + d.length * 2, !e) {
|
|
2009
2009
|
var m = 16 + // Subtable header
|
|
2010
2010
|
g.length * 4;
|
|
2011
2011
|
s.cmap12Offset = 12 + 2 * 2 + 4 + s.cmap4Length, s.fields = s.fields.concat([
|
|
@@ -3294,8 +3294,8 @@ ae.prototype.getPath = function(t, e, r, n, a) {
|
|
|
3294
3294
|
var l = 1 / (this.path.unitsPerEm || 1e3) * r;
|
|
3295
3295
|
u === void 0 && (u = l), o === void 0 && (o = l);
|
|
3296
3296
|
}
|
|
3297
|
-
for (var c = new _(),
|
|
3298
|
-
var h = s[
|
|
3297
|
+
for (var c = new _(), f = 0; f < s.length; f += 1) {
|
|
3298
|
+
var h = s[f];
|
|
3299
3299
|
h.type === "M" ? c.moveTo(t + h.x * u, e + -h.y * o) : h.type === "L" ? c.lineTo(t + h.x * u, e + -h.y * o) : h.type === "Q" ? c.quadraticCurveTo(
|
|
3300
3300
|
t + h.x1 * u,
|
|
3301
3301
|
e + -h.y1 * o,
|
|
@@ -3339,10 +3339,10 @@ ae.prototype.draw = function(t, e, r, n, a) {
|
|
|
3339
3339
|
this.getPath(e, r, n, a).draw(t);
|
|
3340
3340
|
};
|
|
3341
3341
|
ae.prototype.drawPoints = function(t, e, r, n) {
|
|
3342
|
-
function a(
|
|
3342
|
+
function a(f, h, p, d) {
|
|
3343
3343
|
t.beginPath();
|
|
3344
|
-
for (var g = 0; g <
|
|
3345
|
-
t.moveTo(h +
|
|
3344
|
+
for (var g = 0; g < f.length; g += 1)
|
|
3345
|
+
t.moveTo(h + f[g].x * d, p + f[g].y * d), t.arc(h + f[g].x * d, p + f[g].y * d, 2, 0, Math.PI * 2, !1);
|
|
3346
3346
|
t.closePath(), t.fill();
|
|
3347
3347
|
}
|
|
3348
3348
|
e = e !== void 0 ? e : 0, r = r !== void 0 ? r : 0, n = n !== void 0 ? n : 24;
|
|
@@ -3443,8 +3443,8 @@ function xe(t, e, r) {
|
|
|
3443
3443
|
u = i + n[s];
|
|
3444
3444
|
} else
|
|
3445
3445
|
u = e + 2;
|
|
3446
|
-
for (var
|
|
3447
|
-
var h = F.getBytes(t, i + n[
|
|
3446
|
+
for (var f = 0; f < n.length - 1; f += 1) {
|
|
3447
|
+
var h = F.getBytes(t, i + n[f], i + n[f + 1]);
|
|
3448
3448
|
r && (h = r(h)), a.push(h);
|
|
3449
3449
|
}
|
|
3450
3450
|
return { objects: a, startOffset: e, endOffset: u };
|
|
@@ -3591,7 +3591,7 @@ function Ur(t, e, r, n) {
|
|
|
3591
3591
|
if (o !== 0 && l !== 0) {
|
|
3592
3592
|
var c = In(t, l + e, o, n);
|
|
3593
3593
|
if (u._defaultWidthX = c.defaultWidthX, u._nominalWidthX = c.nominalWidthX, c.subrs !== 0) {
|
|
3594
|
-
var
|
|
3594
|
+
var f = l + c.subrs, h = xe(t, f + e);
|
|
3595
3595
|
u._subrs = h.objects, u._subrsBias = Yt(u._subrs);
|
|
3596
3596
|
}
|
|
3597
3597
|
u._privateDict = c;
|
|
@@ -3616,7 +3616,7 @@ function Cs(t, e, r, n) {
|
|
|
3616
3616
|
else if (o === 2)
|
|
3617
3617
|
for (; u.length <= r; ) {
|
|
3618
3618
|
a = i.parseSID(), s = i.parseCard16();
|
|
3619
|
-
for (var
|
|
3619
|
+
for (var f = 0; f <= s; f += 1)
|
|
3620
3620
|
u.push(ze(n, a)), a += 1;
|
|
3621
3621
|
}
|
|
3622
3622
|
else
|
|
@@ -3632,14 +3632,14 @@ function ws(t, e, r) {
|
|
|
3632
3632
|
var l = s.parseCard8();
|
|
3633
3633
|
n = 1;
|
|
3634
3634
|
for (var c = 0; c < l; c += 1)
|
|
3635
|
-
for (var
|
|
3636
|
-
a[
|
|
3635
|
+
for (var f = s.parseCard8(), h = s.parseCard8(), p = f; p <= f + h; p += 1)
|
|
3636
|
+
a[p] = n, n += 1;
|
|
3637
3637
|
} else
|
|
3638
3638
|
throw new Error("Unknown encoding format " + i);
|
|
3639
3639
|
return new dt(a, r);
|
|
3640
3640
|
}
|
|
3641
3641
|
function Lr(t, e, r) {
|
|
3642
|
-
var n, a, s, i, u = new _(), o = [], l = 0, c = !1,
|
|
3642
|
+
var n, a, s, i, u = new _(), o = [], l = 0, c = !1, f = !1, h = 0, p = 0, d, g, y, m;
|
|
3643
3643
|
if (t.isCIDFont) {
|
|
3644
3644
|
var S = t.tables.cff.topDict._fdSelect[e.index], x = t.tables.cff.topDict._fdArray[S];
|
|
3645
3645
|
d = x._subrs, g = x._subrsBias, y = x._defaultWidthX, m = x._nominalWidthX;
|
|
@@ -3647,7 +3647,7 @@ function Lr(t, e, r) {
|
|
|
3647
3647
|
d = t.tables.cff.topDict._subrs, g = t.tables.cff.topDict._subrsBias, y = t.tables.cff.topDict._defaultWidthX, m = t.tables.cff.topDict._nominalWidthX;
|
|
3648
3648
|
var O = y;
|
|
3649
3649
|
function C(w, N) {
|
|
3650
|
-
|
|
3650
|
+
f && u.closePath(), u.moveTo(w, N), f = !0;
|
|
3651
3651
|
}
|
|
3652
3652
|
function D() {
|
|
3653
3653
|
var w;
|
|
@@ -3664,23 +3664,23 @@ function Lr(t, e, r) {
|
|
|
3664
3664
|
D();
|
|
3665
3665
|
break;
|
|
3666
3666
|
case 4:
|
|
3667
|
-
o.length > 1 && !c && (O = o.shift() + m, c = !0),
|
|
3667
|
+
o.length > 1 && !c && (O = o.shift() + m, c = !0), p += o.pop(), C(h, p);
|
|
3668
3668
|
break;
|
|
3669
3669
|
case 5:
|
|
3670
3670
|
for (; o.length > 0; )
|
|
3671
|
-
h += o.shift(),
|
|
3671
|
+
h += o.shift(), p += o.shift(), u.lineTo(h, p);
|
|
3672
3672
|
break;
|
|
3673
3673
|
case 6:
|
|
3674
|
-
for (; o.length > 0 && (h += o.shift(), u.lineTo(h,
|
|
3675
|
-
|
|
3674
|
+
for (; o.length > 0 && (h += o.shift(), u.lineTo(h, p), o.length !== 0); )
|
|
3675
|
+
p += o.shift(), u.lineTo(h, p);
|
|
3676
3676
|
break;
|
|
3677
3677
|
case 7:
|
|
3678
|
-
for (; o.length > 0 && (
|
|
3679
|
-
h += o.shift(), u.lineTo(h,
|
|
3678
|
+
for (; o.length > 0 && (p += o.shift(), u.lineTo(h, p), o.length !== 0); )
|
|
3679
|
+
h += o.shift(), u.lineTo(h, p);
|
|
3680
3680
|
break;
|
|
3681
3681
|
case 8:
|
|
3682
3682
|
for (; o.length > 0; )
|
|
3683
|
-
n = h + o.shift(), a =
|
|
3683
|
+
n = h + o.shift(), a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), h = s + o.shift(), p = i + o.shift(), u.curveTo(n, a, s, i, h, p);
|
|
3684
3684
|
break;
|
|
3685
3685
|
case 10:
|
|
3686
3686
|
ne = o.pop() + g, G = d[ne], G && L(G);
|
|
@@ -3690,23 +3690,23 @@ function Lr(t, e, r) {
|
|
|
3690
3690
|
case 12:
|
|
3691
3691
|
switch (Y = w[M], M += 1, Y) {
|
|
3692
3692
|
case 35:
|
|
3693
|
-
n = h + o.shift(), a =
|
|
3693
|
+
n = h + o.shift(), a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), H = s + o.shift(), V = i + o.shift(), q = H + o.shift(), X = V + o.shift(), z = q + o.shift(), Z = X + o.shift(), h = z + o.shift(), p = Z + o.shift(), o.shift(), u.curveTo(n, a, s, i, H, V), u.curveTo(q, X, z, Z, h, p);
|
|
3694
3694
|
break;
|
|
3695
3695
|
case 34:
|
|
3696
|
-
n = h + o.shift(), a =
|
|
3696
|
+
n = h + o.shift(), a = p, s = n + o.shift(), i = a + o.shift(), H = s + o.shift(), V = i, q = H + o.shift(), X = i, z = q + o.shift(), Z = p, h = z + o.shift(), u.curveTo(n, a, s, i, H, V), u.curveTo(q, X, z, Z, h, p);
|
|
3697
3697
|
break;
|
|
3698
3698
|
case 36:
|
|
3699
|
-
n = h + o.shift(), a =
|
|
3699
|
+
n = h + o.shift(), a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), H = s + o.shift(), V = i, q = H + o.shift(), X = i, z = q + o.shift(), Z = X + o.shift(), h = z + o.shift(), u.curveTo(n, a, s, i, H, V), u.curveTo(q, X, z, Z, h, p);
|
|
3700
3700
|
break;
|
|
3701
3701
|
case 37:
|
|
3702
|
-
n = h + o.shift(), a =
|
|
3702
|
+
n = h + o.shift(), a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), H = s + o.shift(), V = i + o.shift(), q = H + o.shift(), X = V + o.shift(), z = q + o.shift(), Z = X + o.shift(), Math.abs(z - h) > Math.abs(Z - p) ? h = z + o.shift() : p = Z + o.shift(), u.curveTo(n, a, s, i, H, V), u.curveTo(q, X, z, Z, h, p);
|
|
3703
3703
|
break;
|
|
3704
3704
|
default:
|
|
3705
3705
|
console.log("Glyph " + e.index + ": unknown operator 1200" + Y), o.length = 0;
|
|
3706
3706
|
}
|
|
3707
3707
|
break;
|
|
3708
3708
|
case 14:
|
|
3709
|
-
o.length > 0 && !c && (O = o.shift() + m, c = !0),
|
|
3709
|
+
o.length > 0 && !c && (O = o.shift() + m, c = !0), f && (u.closePath(), f = !1);
|
|
3710
3710
|
break;
|
|
3711
3711
|
case 18:
|
|
3712
3712
|
D();
|
|
@@ -3716,31 +3716,31 @@ function Lr(t, e, r) {
|
|
|
3716
3716
|
D(), M += l + 7 >> 3;
|
|
3717
3717
|
break;
|
|
3718
3718
|
case 21:
|
|
3719
|
-
o.length > 2 && !c && (O = o.shift() + m, c = !0),
|
|
3719
|
+
o.length > 2 && !c && (O = o.shift() + m, c = !0), p += o.pop(), h += o.pop(), C(h, p);
|
|
3720
3720
|
break;
|
|
3721
3721
|
case 22:
|
|
3722
|
-
o.length > 1 && !c && (O = o.shift() + m, c = !0), h += o.pop(), C(h,
|
|
3722
|
+
o.length > 1 && !c && (O = o.shift() + m, c = !0), h += o.pop(), C(h, p);
|
|
3723
3723
|
break;
|
|
3724
3724
|
case 23:
|
|
3725
3725
|
D();
|
|
3726
3726
|
break;
|
|
3727
3727
|
case 24:
|
|
3728
3728
|
for (; o.length > 2; )
|
|
3729
|
-
n = h + o.shift(), a =
|
|
3730
|
-
h += o.shift(),
|
|
3729
|
+
n = h + o.shift(), a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), h = s + o.shift(), p = i + o.shift(), u.curveTo(n, a, s, i, h, p);
|
|
3730
|
+
h += o.shift(), p += o.shift(), u.lineTo(h, p);
|
|
3731
3731
|
break;
|
|
3732
3732
|
case 25:
|
|
3733
3733
|
for (; o.length > 6; )
|
|
3734
|
-
h += o.shift(),
|
|
3735
|
-
n = h + o.shift(), a =
|
|
3734
|
+
h += o.shift(), p += o.shift(), u.lineTo(h, p);
|
|
3735
|
+
n = h + o.shift(), a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), h = s + o.shift(), p = i + o.shift(), u.curveTo(n, a, s, i, h, p);
|
|
3736
3736
|
break;
|
|
3737
3737
|
case 26:
|
|
3738
3738
|
for (o.length % 2 && (h += o.shift()); o.length > 0; )
|
|
3739
|
-
n = h, a =
|
|
3739
|
+
n = h, a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), h = s, p = i + o.shift(), u.curveTo(n, a, s, i, h, p);
|
|
3740
3740
|
break;
|
|
3741
3741
|
case 27:
|
|
3742
|
-
for (o.length % 2 && (
|
|
3743
|
-
n = h + o.shift(), a =
|
|
3742
|
+
for (o.length % 2 && (p += o.shift()); o.length > 0; )
|
|
3743
|
+
n = h + o.shift(), a = p, s = n + o.shift(), i = a + o.shift(), h = s + o.shift(), p = i, u.curveTo(n, a, s, i, h, p);
|
|
3744
3744
|
break;
|
|
3745
3745
|
case 28:
|
|
3746
3746
|
N = w[M], j = w[M + 1], o.push((N << 24 | j << 16) >> 16), M += 2;
|
|
@@ -3749,12 +3749,12 @@ function Lr(t, e, r) {
|
|
|
3749
3749
|
ne = o.pop() + t.gsubrsBias, G = t.gsubrs[ne], G && L(G);
|
|
3750
3750
|
break;
|
|
3751
3751
|
case 30:
|
|
3752
|
-
for (; o.length > 0 && (n = h, a =
|
|
3753
|
-
n = h + o.shift(), a =
|
|
3752
|
+
for (; o.length > 0 && (n = h, a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), h = s + o.shift(), p = i + (o.length === 1 ? o.shift() : 0), u.curveTo(n, a, s, i, h, p), o.length !== 0); )
|
|
3753
|
+
n = h + o.shift(), a = p, s = n + o.shift(), i = a + o.shift(), p = i + o.shift(), h = s + (o.length === 1 ? o.shift() : 0), u.curveTo(n, a, s, i, h, p);
|
|
3754
3754
|
break;
|
|
3755
3755
|
case 31:
|
|
3756
|
-
for (; o.length > 0 && (n = h + o.shift(), a =
|
|
3757
|
-
n = h, a =
|
|
3756
|
+
for (; o.length > 0 && (n = h + o.shift(), a = p, s = n + o.shift(), i = a + o.shift(), p = i + o.shift(), h = s + (o.length === 1 ? o.shift() : 0), u.curveTo(n, a, s, i, h, p), o.length !== 0); )
|
|
3757
|
+
n = h, a = p + o.shift(), s = n + o.shift(), i = a + o.shift(), h = s + o.shift(), p = i + (o.length === 1 ? o.shift() : 0), u.curveTo(n, a, s, i, h, p);
|
|
3758
3758
|
break;
|
|
3759
3759
|
default:
|
|
3760
3760
|
Y < 32 ? console.log("Glyph " + e.index + ": unknown operator " + Y) : Y < 247 ? o.push(Y - 139) : Y < 251 ? (N = w[M], M += 1, o.push((Y - 247) * 256 + N + 108)) : Y < 255 ? (N = w[M], M += 1, o.push(-(Y - 251) * 256 - N - 108)) : (N = w[M], j = w[M + 1], K = w[M + 2], re = w[M + 3], M += 4, o.push((N << 24 | j << 16 | K << 8 | re) / 65536));
|
|
@@ -3775,17 +3775,17 @@ function Es(t, e, r, n) {
|
|
|
3775
3775
|
var l = i.parseCard16(), c = i.parseCard16();
|
|
3776
3776
|
if (c !== 0)
|
|
3777
3777
|
throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID " + c);
|
|
3778
|
-
for (var
|
|
3779
|
-
if (s = i.parseCard8(),
|
|
3778
|
+
for (var f, h = 0; h < l; h++) {
|
|
3779
|
+
if (s = i.parseCard8(), f = i.parseCard16(), s >= n)
|
|
3780
3780
|
throw new Error("CFF table CID Font FDSelect has bad FD index value " + s + " (FD count " + n + ")");
|
|
3781
|
-
if (
|
|
3782
|
-
throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID " +
|
|
3783
|
-
for (; c <
|
|
3781
|
+
if (f > r)
|
|
3782
|
+
throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID " + f);
|
|
3783
|
+
for (; c < f; c++)
|
|
3784
3784
|
a.push(s);
|
|
3785
|
-
c =
|
|
3785
|
+
c = f;
|
|
3786
3786
|
}
|
|
3787
|
-
if (
|
|
3788
|
-
throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID " +
|
|
3787
|
+
if (f !== r)
|
|
3788
|
+
throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID " + f);
|
|
3789
3789
|
} else
|
|
3790
3790
|
throw new Error("CFF Table CID Font FDSelect table has unsupported format " + u);
|
|
3791
3791
|
return a;
|
|
@@ -3799,11 +3799,11 @@ function Os(t, e, r, n) {
|
|
|
3799
3799
|
throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = " + l.length);
|
|
3800
3800
|
var c = l[0];
|
|
3801
3801
|
if (r.tables.cff.topDict = c, c._privateDict && (r.defaultWidthX = c._privateDict.defaultWidthX, r.nominalWidthX = c._privateDict.nominalWidthX), c.ros[0] !== void 0 && c.ros[1] !== void 0 && (r.isCIDFont = !0), r.isCIDFont) {
|
|
3802
|
-
var
|
|
3803
|
-
if (
|
|
3802
|
+
var f = c.fdArray, h = c.fdSelect;
|
|
3803
|
+
if (f === 0 || h === 0)
|
|
3804
3804
|
throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");
|
|
3805
|
-
|
|
3806
|
-
var
|
|
3805
|
+
f += e;
|
|
3806
|
+
var p = xe(t, f), d = Ur(t, e, p.objects, u.objects);
|
|
3807
3807
|
c._fdArray = d, h += e, c._fdSelect = Es(t, h, r.numGlyphs, d.length);
|
|
3808
3808
|
}
|
|
3809
3809
|
var g = e + c.private[1], y = In(t, g, c.private[0], u.objects);
|
|
@@ -3911,8 +3911,8 @@ function Ms(t) {
|
|
|
3911
3911
|
else if (o.type === "L")
|
|
3912
3912
|
i = Math.round(o.x - n), u = Math.round(o.y - a), e.push({ name: "dx", type: "NUMBER", value: i }), e.push({ name: "dy", type: "NUMBER", value: u }), e.push({ name: "rlineto", type: "OP", value: 5 }), n = Math.round(o.x), a = Math.round(o.y);
|
|
3913
3913
|
else if (o.type === "C") {
|
|
3914
|
-
var
|
|
3915
|
-
i = Math.round(o.x - o.x2), u = Math.round(o.y - o.y2), e.push({ name: "dx1", type: "NUMBER", value:
|
|
3914
|
+
var f = Math.round(o.x1 - n), h = Math.round(o.y1 - a), p = Math.round(o.x2 - o.x1), d = Math.round(o.y2 - o.y1);
|
|
3915
|
+
i = Math.round(o.x - o.x2), u = Math.round(o.y - o.y2), e.push({ name: "dx1", type: "NUMBER", value: f }), e.push({ name: "dy1", type: "NUMBER", value: h }), e.push({ name: "dx2", type: "NUMBER", value: p }), e.push({ name: "dy2", type: "NUMBER", value: d }), e.push({ name: "dx", type: "NUMBER", value: i }), e.push({ name: "dy", type: "NUMBER", value: u }), e.push({ name: "rrcurveto", type: "OP", value: 8 }), n = Math.round(o.x), a = Math.round(o.y);
|
|
3916
3916
|
}
|
|
3917
3917
|
}
|
|
3918
3918
|
return e.push({ name: "endchar", type: "OP", value: 14 }), e;
|
|
@@ -3959,8 +3959,8 @@ function Is(t, e) {
|
|
|
3959
3959
|
r.header = Us(), r.nameIndex = Ls([e.postScriptName]);
|
|
3960
3960
|
var c = Rr(a, l);
|
|
3961
3961
|
r.topDictIndex = Ar(c), r.globalSubrIndex = As(), r.charsets = Ds(i, l), r.charStringsIndex = Bs(t), r.privateDict = Ps(s, l), r.stringIndex = Rs(l);
|
|
3962
|
-
var
|
|
3963
|
-
return a.charset =
|
|
3962
|
+
var f = r.header.sizeOf() + r.nameIndex.sizeOf() + r.topDictIndex.sizeOf() + r.stringIndex.sizeOf() + r.globalSubrIndex.sizeOf();
|
|
3963
|
+
return a.charset = f, a.encoding = 0, a.charStrings = a.charset + r.charsets.sizeOf(), a.private[1] = a.charStrings + r.charStringsIndex.sizeOf(), c = Rr(a, l), r.topDictIndex = Ar(c), r;
|
|
3964
3964
|
}
|
|
3965
3965
|
var _n = { parse: Os, make: Is };
|
|
3966
3966
|
function Gs(t, e) {
|
|
@@ -4813,12 +4813,12 @@ function jn(t, e, r) {
|
|
|
4813
4813
|
}
|
|
4814
4814
|
function ei(t, e, r) {
|
|
4815
4815
|
for (var n = {}, a = new F.Parser(t, e), s = a.parseUShort(), i = a.parseUShort(), u = a.offset + a.parseUShort(), o = 0; o < i; o++) {
|
|
4816
|
-
var l = a.parseUShort(), c = a.parseUShort(),
|
|
4816
|
+
var l = a.parseUShort(), c = a.parseUShort(), f = a.parseUShort(), h = a.parseUShort(), p = Xn[h] || h, d = a.parseUShort(), g = a.parseUShort(), y = Qs(l, f, r), m = jn(l, c, f);
|
|
4817
4817
|
if (m !== void 0 && y !== void 0) {
|
|
4818
4818
|
var S = void 0;
|
|
4819
4819
|
if (m === Zt ? S = Pe.UTF16(t, u + g, d) : S = Pe.MACSTRING(t, u + g, d, m), S) {
|
|
4820
|
-
var x = n[
|
|
4821
|
-
x === void 0 && (x = n[
|
|
4820
|
+
var x = n[p];
|
|
4821
|
+
x === void 0 && (x = n[p] = {}), x[y] = S;
|
|
4822
4822
|
}
|
|
4823
4823
|
}
|
|
4824
4824
|
}
|
|
@@ -4869,13 +4869,13 @@ function ri(t, e) {
|
|
|
4869
4869
|
throw new Error('Name table entry "' + i + '" does not exist, see nameTableNames for complete list.');
|
|
4870
4870
|
a[r] = t[i], n.push(r);
|
|
4871
4871
|
}
|
|
4872
|
-
for (var o = Ct(Yn), l = Ct(Zn), c = [],
|
|
4872
|
+
for (var o = Ct(Yn), l = Ct(Zn), c = [], f = [], h = 0; h < n.length; h++) {
|
|
4873
4873
|
r = n[h];
|
|
4874
|
-
var
|
|
4875
|
-
for (var d in
|
|
4876
|
-
var g =
|
|
4874
|
+
var p = a[r];
|
|
4875
|
+
for (var d in p) {
|
|
4876
|
+
var g = p[d], y = 1, m = o[d], S = Ks[m], x = jn(y, S, m), O = b.MACSTRING(g, x);
|
|
4877
4877
|
O === void 0 && (y = 0, m = e.indexOf(d), m < 0 && (m = e.length, e.push(d)), S = 4, O = b.UTF16(g));
|
|
4878
|
-
var C = Mr(O,
|
|
4878
|
+
var C = Mr(O, f);
|
|
4879
4879
|
c.push(Dr(
|
|
4880
4880
|
y,
|
|
4881
4881
|
S,
|
|
@@ -4886,7 +4886,7 @@ function ri(t, e) {
|
|
|
4886
4886
|
));
|
|
4887
4887
|
var D = l[d];
|
|
4888
4888
|
if (D !== void 0) {
|
|
4889
|
-
var L = b.UTF16(g), w = Mr(L,
|
|
4889
|
+
var L = b.UTF16(g), w = Mr(L, f);
|
|
4890
4890
|
c.push(Dr(
|
|
4891
4891
|
3,
|
|
4892
4892
|
1,
|
|
@@ -4907,7 +4907,7 @@ function ri(t, e) {
|
|
|
4907
4907
|
{ name: "stringOffset", type: "USHORT", value: 6 + c.length * 12 }
|
|
4908
4908
|
]), j = 0; j < c.length; j++)
|
|
4909
4909
|
N.fields.push({ name: "record_" + j, type: "RECORD", value: c[j] });
|
|
4910
|
-
return N.fields.push({ name: "strings", type: "LITERAL", value:
|
|
4910
|
+
return N.fields.push({ name: "strings", type: "LITERAL", value: f }), N;
|
|
4911
4911
|
}
|
|
4912
4912
|
var Kn = { parse: ei, make: ri }, jt = [
|
|
4913
4913
|
{ begin: 0, end: 127 },
|
|
@@ -5569,8 +5569,8 @@ function ea(t) {
|
|
|
5569
5569
|
for (n.push({ name: l.tag + " Table Record", type: "RECORD", value: l }), a.push({ name: u.tableName + " table", type: "RECORD", value: u }), s += o, E.argument(!isNaN(s), "Something went wrong calculating the offset."); s % 4 !== 0; )
|
|
5570
5570
|
s += 1, a.push({ name: "padding", type: "BYTE", value: 0 });
|
|
5571
5571
|
}
|
|
5572
|
-
return n.sort(function(c,
|
|
5573
|
-
return c.value.tag >
|
|
5572
|
+
return n.sort(function(c, f) {
|
|
5573
|
+
return c.value.tag > f.value.tag ? 1 : -1;
|
|
5574
5574
|
}), e.fields = e.fields.concat(n), e.fields = e.fields.concat(a), e;
|
|
5575
5575
|
}
|
|
5576
5576
|
function Ir(t, e, r) {
|
|
@@ -5589,7 +5589,7 @@ function fi(t) {
|
|
|
5589
5589
|
return e / t.length;
|
|
5590
5590
|
}
|
|
5591
5591
|
function pi(t) {
|
|
5592
|
-
for (var e = [], r = [], n = [], a = [], s = [], i = [], u = [], o, l = 0, c = 0,
|
|
5592
|
+
for (var e = [], r = [], n = [], a = [], s = [], i = [], u = [], o, l = 0, c = 0, f = 0, h = 0, p = 0, d = 0; d < t.glyphs.length; d += 1) {
|
|
5593
5593
|
var g = t.glyphs.get(d), y = g.unicode | 0;
|
|
5594
5594
|
if (isNaN(g.advanceWidth))
|
|
5595
5595
|
throw new Error("Glyph " + g.name + " (" + d + "): advanceWidth is not a number.");
|
|
@@ -5598,11 +5598,11 @@ function pi(t) {
|
|
|
5598
5598
|
if (m < 32)
|
|
5599
5599
|
c |= 1 << m;
|
|
5600
5600
|
else if (m < 64)
|
|
5601
|
-
|
|
5601
|
+
f |= 1 << m - 32;
|
|
5602
5602
|
else if (m < 96)
|
|
5603
5603
|
h |= 1 << m - 64;
|
|
5604
5604
|
else if (m < 123)
|
|
5605
|
-
|
|
5605
|
+
p |= 1 << m - 96;
|
|
5606
5606
|
else
|
|
5607
5607
|
throw new Error("Unicode ranges bits > 123 are reserved for internal usage");
|
|
5608
5608
|
if (g.name !== ".notdef") {
|
|
@@ -5645,9 +5645,9 @@ function pi(t) {
|
|
|
5645
5645
|
usFirstCharIndex: o,
|
|
5646
5646
|
usLastCharIndex: l,
|
|
5647
5647
|
ulUnicodeRange1: c,
|
|
5648
|
-
ulUnicodeRange2:
|
|
5648
|
+
ulUnicodeRange2: f,
|
|
5649
5649
|
ulUnicodeRange3: h,
|
|
5650
|
-
ulUnicodeRange4:
|
|
5650
|
+
ulUnicodeRange4: p,
|
|
5651
5651
|
// See http://typophile.com/node/13081 for more info on vertical metrics.
|
|
5652
5652
|
// We get metrics for typical characters (such as "x" for xHeight).
|
|
5653
5653
|
// We provide some fallback characters if characters are unavailable: their
|
|
@@ -5881,8 +5881,8 @@ Ke.prototype = {
|
|
|
5881
5881
|
subtables: [],
|
|
5882
5882
|
markFilteringSet: void 0
|
|
5883
5883
|
};
|
|
5884
|
-
var
|
|
5885
|
-
return l.push(u), o.push(
|
|
5884
|
+
var f = l.length;
|
|
5885
|
+
return l.push(u), o.push(f), [u];
|
|
5886
5886
|
}
|
|
5887
5887
|
}
|
|
5888
5888
|
return i;
|
|
@@ -5959,8 +5959,8 @@ Qe.prototype.getKerningValue = function(t, e, r) {
|
|
|
5959
5959
|
}
|
|
5960
5960
|
break;
|
|
5961
5961
|
case 2:
|
|
5962
|
-
var
|
|
5963
|
-
return
|
|
5962
|
+
var f = this.getGlyphClass(i.classDef1, e), h = this.getGlyphClass(i.classDef2, r), p = i.classRecords[f][h];
|
|
5963
|
+
return p.value1 && p.value1.xAdvance || 0;
|
|
5964
5964
|
}
|
|
5965
5965
|
}
|
|
5966
5966
|
return 0;
|
|
@@ -6010,15 +6010,15 @@ ee.prototype.getSingle = function(t, e, r) {
|
|
|
6010
6010
|
for (var i = a[s].subtables, u = 0; u < i.length; u++) {
|
|
6011
6011
|
var o = i[u], l = this.expandCoverage(o.coverage), c = void 0;
|
|
6012
6012
|
if (o.substFormat === 1) {
|
|
6013
|
-
var
|
|
6013
|
+
var f = o.deltaGlyphId;
|
|
6014
6014
|
for (c = 0; c < l.length; c++) {
|
|
6015
6015
|
var h = l[c];
|
|
6016
|
-
n.push({ sub: h, by: h +
|
|
6016
|
+
n.push({ sub: h, by: h + f });
|
|
6017
6017
|
}
|
|
6018
6018
|
} else {
|
|
6019
|
-
var
|
|
6019
|
+
var p = o.substitute;
|
|
6020
6020
|
for (c = 0; c < l.length; c++)
|
|
6021
|
-
n.push({ sub: l[c], by:
|
|
6021
|
+
n.push({ sub: l[c], by: p[c] });
|
|
6022
6022
|
}
|
|
6023
6023
|
}
|
|
6024
6024
|
return n;
|
|
@@ -6028,8 +6028,8 @@ ee.prototype.getMultiple = function(t, e, r) {
|
|
|
6028
6028
|
for (var i = a[s].subtables, u = 0; u < i.length; u++) {
|
|
6029
6029
|
var o = i[u], l = this.expandCoverage(o.coverage), c = void 0;
|
|
6030
6030
|
for (c = 0; c < l.length; c++) {
|
|
6031
|
-
var
|
|
6032
|
-
n.push({ sub:
|
|
6031
|
+
var f = l[c], h = o.sequences[c];
|
|
6032
|
+
n.push({ sub: f, by: h });
|
|
6033
6033
|
}
|
|
6034
6034
|
}
|
|
6035
6035
|
return n;
|
|
@@ -6037,16 +6037,16 @@ ee.prototype.getMultiple = function(t, e, r) {
|
|
|
6037
6037
|
ee.prototype.getAlternates = function(t, e, r) {
|
|
6038
6038
|
for (var n = [], a = this.getLookupTables(e, r, t, 3), s = 0; s < a.length; s++)
|
|
6039
6039
|
for (var i = a[s].subtables, u = 0; u < i.length; u++)
|
|
6040
|
-
for (var o = i[u], l = this.expandCoverage(o.coverage), c = o.alternateSets,
|
|
6041
|
-
n.push({ sub: l[
|
|
6040
|
+
for (var o = i[u], l = this.expandCoverage(o.coverage), c = o.alternateSets, f = 0; f < l.length; f++)
|
|
6041
|
+
n.push({ sub: l[f], by: c[f] });
|
|
6042
6042
|
return n;
|
|
6043
6043
|
};
|
|
6044
6044
|
ee.prototype.getLigatures = function(t, e, r) {
|
|
6045
6045
|
for (var n = [], a = this.getLookupTables(e, r, t, 4), s = 0; s < a.length; s++)
|
|
6046
6046
|
for (var i = a[s].subtables, u = 0; u < i.length; u++)
|
|
6047
|
-
for (var o = i[u], l = this.expandCoverage(o.coverage), c = o.ligatureSets,
|
|
6048
|
-
for (var h = l[
|
|
6049
|
-
var g =
|
|
6047
|
+
for (var o = i[u], l = this.expandCoverage(o.coverage), c = o.ligatureSets, f = 0; f < l.length; f++)
|
|
6048
|
+
for (var h = l[f], p = c[f], d = 0; d < p.length; d++) {
|
|
6049
|
+
var g = p[d];
|
|
6050
6050
|
n.push({
|
|
6051
6051
|
sub: [h].concat(g.components),
|
|
6052
6052
|
by: g.ligGlyph
|
|
@@ -6101,8 +6101,8 @@ ee.prototype.addLigature = function(t, e, r, n) {
|
|
|
6101
6101
|
components: u
|
|
6102
6102
|
}, l = this.binSearch(s.coverage.glyphs, i);
|
|
6103
6103
|
if (l >= 0) {
|
|
6104
|
-
for (var c = s.ligatureSets[l],
|
|
6105
|
-
if (vi(c[
|
|
6104
|
+
for (var c = s.ligatureSets[l], f = 0; f < c.length; f++)
|
|
6105
|
+
if (vi(c[f].components, u))
|
|
6106
6106
|
return;
|
|
6107
6107
|
c.push(o);
|
|
6108
6108
|
} else
|
|
@@ -6170,19 +6170,19 @@ function ta(t, e, r) {
|
|
|
6170
6170
|
a = [];
|
|
6171
6171
|
for (var c = 0; c < l; c += 1)
|
|
6172
6172
|
if (s = n.parseByte(), a.push(s), (s & 8) > 0)
|
|
6173
|
-
for (var
|
|
6173
|
+
for (var f = n.parseByte(), h = 0; h < f; h += 1)
|
|
6174
6174
|
a.push(s), c += 1;
|
|
6175
6175
|
if (E.argument(a.length === l, "Bad flags."), i.length > 0) {
|
|
6176
|
-
var
|
|
6176
|
+
var p = [], d;
|
|
6177
6177
|
if (l > 0) {
|
|
6178
6178
|
for (var g = 0; g < l; g += 1)
|
|
6179
|
-
s = a[g], d = {}, d.onCurve = !!(s & 1), d.lastPointOfContour = i.indexOf(g) >= 0,
|
|
6179
|
+
s = a[g], d = {}, d.onCurve = !!(s & 1), d.lastPointOfContour = i.indexOf(g) >= 0, p.push(d);
|
|
6180
6180
|
for (var y = 0, m = 0; m < l; m += 1)
|
|
6181
|
-
s = a[m], d =
|
|
6181
|
+
s = a[m], d = p[m], d.x = _r(n, s, y, 2, 16), y = d.x;
|
|
6182
6182
|
for (var S = 0, x = 0; x < l; x += 1)
|
|
6183
|
-
s = a[x], d =
|
|
6183
|
+
s = a[x], d = p[x], d.y = _r(n, s, S, 4, 32), S = d.y;
|
|
6184
6184
|
}
|
|
6185
|
-
t.points =
|
|
6185
|
+
t.points = p;
|
|
6186
6186
|
} else
|
|
6187
6187
|
t.points = [];
|
|
6188
6188
|
} else if (t.numberOfContours === 0)
|
|
@@ -6470,8 +6470,8 @@ Je.prototype.interpolate = function(t, e, r, n) {
|
|
|
6470
6470
|
};
|
|
6471
6471
|
Je.prototype.setRelative = function(t, e, r, n, a) {
|
|
6472
6472
|
n = n || this;
|
|
6473
|
-
var s = a ? e.xo : e.x, i = a ? e.yo : e.y, u = s + r * n.x, o = i + r * n.y, l = n.normalSlope, c = this.slope,
|
|
6474
|
-
t.x = (c *
|
|
6473
|
+
var s = a ? e.xo : e.x, i = a ? e.yo : e.y, u = s + r * n.x, o = i + r * n.y, l = n.normalSlope, c = this.slope, f = t.x, h = t.y;
|
|
6474
|
+
t.x = (c * f - l * u + o - h) / (c - l), t.y = c * (t.x - f) + h;
|
|
6475
6475
|
};
|
|
6476
6476
|
Je.prototype.touch = function(t) {
|
|
6477
6477
|
t.xTouched = !0, t.yTouched = !0;
|
|
@@ -6559,11 +6559,11 @@ ia = function(t, e) {
|
|
|
6559
6559
|
var o = e.font;
|
|
6560
6560
|
i = [], s = [];
|
|
6561
6561
|
for (var l = 0; l < a.length; l++) {
|
|
6562
|
-
var c = a[l],
|
|
6563
|
-
u = new be("glyf",
|
|
6564
|
-
for (var h = Math.round(c.dx * r),
|
|
6562
|
+
var c = a[l], f = o.glyphs.get(c.glyphIndex);
|
|
6563
|
+
u = new be("glyf", f.instructions), exports.DEBUG && (console.log("---EXEC COMP " + l + "---"), u.step = -1), Qt(f, u, r, n);
|
|
6564
|
+
for (var h = Math.round(c.dx * r), p = Math.round(c.dy * n), d = u.gZone, g = u.contours, y = 0; y < d.length; y++) {
|
|
6565
6565
|
var m = d[y];
|
|
6566
|
-
m.xTouched = m.yTouched = !1, m.xo = m.x = m.x + h, m.yo = m.y = m.y +
|
|
6566
|
+
m.xTouched = m.yTouched = !1, m.xo = m.x = m.x + h, m.yo = m.y = m.y + p;
|
|
6567
6567
|
}
|
|
6568
6568
|
var S = i.length;
|
|
6569
6569
|
i.push.apply(i, d);
|
|
@@ -6585,13 +6585,13 @@ Qt = function(t, e, r, n) {
|
|
|
6585
6585
|
o.lastPointOfContour,
|
|
6586
6586
|
o.onCurve
|
|
6587
6587
|
);
|
|
6588
|
-
for (var c,
|
|
6589
|
-
o = i[h], c || (c = o, u.push(h)), o.lastPointOfContour ? (o.nextPointOnContour = c, c.prevPointOnContour = o, c = void 0) : (
|
|
6588
|
+
for (var c, f, h = 0; h < s; h++)
|
|
6589
|
+
o = i[h], c || (c = o, u.push(h)), o.lastPointOfContour ? (o.nextPointOnContour = c, c.prevPointOnContour = o, c = void 0) : (f = i[h + 1], o.nextPointOnContour = f, f.prevPointOnContour = o);
|
|
6590
6590
|
if (!e.inhibitGridFit) {
|
|
6591
6591
|
if (exports.DEBUG) {
|
|
6592
6592
|
console.log("PROCESSING GLYPH", e.stack);
|
|
6593
|
-
for (var
|
|
6594
|
-
console.log(
|
|
6593
|
+
for (var p = 0; p < s; p++)
|
|
6594
|
+
console.log(p, i[p].x, i[p].y);
|
|
6595
6595
|
}
|
|
6596
6596
|
if (i.push(
|
|
6597
6597
|
new ge(0, 0),
|
|
@@ -6681,10 +6681,10 @@ function Ai(t) {
|
|
|
6681
6681
|
t.fv = t.pv, exports.DEBUG && console.log(t.step, "SFVTPV[]");
|
|
6682
6682
|
}
|
|
6683
6683
|
function Di(t) {
|
|
6684
|
-
var e = t.stack, r = e.pop(), n = e.pop(), a = e.pop(), s = e.pop(), i = e.pop(), u = t.z0, o = t.z1, l = u[r], c = u[n],
|
|
6684
|
+
var e = t.stack, r = e.pop(), n = e.pop(), a = e.pop(), s = e.pop(), i = e.pop(), u = t.z0, o = t.z1, l = u[r], c = u[n], f = o[a], h = o[s], p = t.z2[i];
|
|
6685
6685
|
exports.DEBUG && console.log("ISECT[], ", r, n, a, s, i);
|
|
6686
|
-
var d = l.x, g = l.y, y = c.x, m = c.y, S =
|
|
6687
|
-
|
|
6686
|
+
var d = l.x, g = l.y, y = c.x, m = c.y, S = f.x, x = f.y, O = h.x, C = h.y, D = (d - y) * (x - C) - (g - m) * (S - O), L = d * m - g * y, w = S * C - x * O;
|
|
6687
|
+
p.x = (L * (S - O) - w * (d - y)) / D, p.y = (L * (x - C) - w * (g - m)) / D;
|
|
6688
6688
|
}
|
|
6689
6689
|
function Mi(t) {
|
|
6690
6690
|
t.rp0 = t.stack.pop(), exports.DEBUG && console.log(t.step, "SRP0[]", t.rp0);
|
|
@@ -6838,8 +6838,8 @@ function Yr(t, e) {
|
|
|
6838
6838
|
}
|
|
6839
6839
|
function Zr(t, e) {
|
|
6840
6840
|
for (var r = e.stack, n = t ? e.rp1 : e.rp2, a = (t ? e.z0 : e.z1)[n], s = e.fv, i = e.pv, u = e.loop, o = e.z2; u--; ) {
|
|
6841
|
-
var l = r.pop(), c = o[l],
|
|
6842
|
-
s.setRelative(c, c,
|
|
6841
|
+
var l = r.pop(), c = o[l], f = i.distance(a, a, !1, !0);
|
|
6842
|
+
s.setRelative(c, c, f, i), s.touch(c), exports.DEBUG && console.log(
|
|
6843
6843
|
e.step,
|
|
6844
6844
|
(e.loop > 1 ? "loop " + (e.loop - u) + ": " : "") + "SHP[" + (t ? "rp1" : "rp2") + "]",
|
|
6845
6845
|
l
|
|
@@ -6869,7 +6869,7 @@ function Kr(t, e) {
|
|
|
6869
6869
|
default:
|
|
6870
6870
|
throw new Error("Invalid zone");
|
|
6871
6871
|
}
|
|
6872
|
-
for (var l, c = i.distance(a, a, !1, !0),
|
|
6872
|
+
for (var l, c = i.distance(a, a, !1, !0), f = o.length - 2, h = 0; h < f; h++)
|
|
6873
6873
|
l = o[h], s.setRelative(l, l, c, i);
|
|
6874
6874
|
}
|
|
6875
6875
|
function no(t) {
|
|
@@ -6886,7 +6886,7 @@ function no(t) {
|
|
|
6886
6886
|
}
|
|
6887
6887
|
function ao(t) {
|
|
6888
6888
|
for (var e = t.stack, r = t.rp1, n = t.rp2, a = t.loop, s = t.z0[r], i = t.z1[n], u = t.fv, o = t.dpv, l = t.z2; a--; ) {
|
|
6889
|
-
var c = e.pop(),
|
|
6889
|
+
var c = e.pop(), f = l[c];
|
|
6890
6890
|
exports.DEBUG && console.log(
|
|
6891
6891
|
t.step,
|
|
6892
6892
|
(t.loop > 1 ? "loop " + (t.loop - a) + ": " : "") + "IP[]",
|
|
@@ -6894,7 +6894,7 @@ function ao(t) {
|
|
|
6894
6894
|
r,
|
|
6895
6895
|
"<->",
|
|
6896
6896
|
n
|
|
6897
|
-
), u.interpolate(
|
|
6897
|
+
), u.interpolate(f, s, i, o), u.touch(f);
|
|
6898
6898
|
}
|
|
6899
6899
|
t.loop = 1;
|
|
6900
6900
|
}
|
|
@@ -7035,11 +7035,11 @@ function Ut(t, e) {
|
|
|
7035
7035
|
var r = e.stack, n = r.pop(), a = e.fv, s = e.pv, i = e.ppem, u = e.deltaBase + (t - 1) * 16, o = e.deltaShift, l = e.z0;
|
|
7036
7036
|
exports.DEBUG && console.log(e.step, "DELTAP[" + t + "]", n, r);
|
|
7037
7037
|
for (var c = 0; c < n; c++) {
|
|
7038
|
-
var
|
|
7039
|
-
if (
|
|
7038
|
+
var f = r.pop(), h = r.pop(), p = u + ((h & 240) >> 4);
|
|
7039
|
+
if (p === i) {
|
|
7040
7040
|
var d = (h & 15) - 8;
|
|
7041
|
-
d >= 0 && d++, exports.DEBUG && console.log(e.step, "DELTAPFIX",
|
|
7042
|
-
var g = l[
|
|
7041
|
+
d >= 0 && d++, exports.DEBUG && console.log(e.step, "DELTAPFIX", f, "by", d * o);
|
|
7042
|
+
var g = l[f];
|
|
7043
7043
|
a.setRelative(g, g, d * o, s);
|
|
7044
7044
|
}
|
|
7045
7045
|
}
|
|
@@ -7098,9 +7098,9 @@ function Lt(t, e) {
|
|
|
7098
7098
|
for (var u = 0; u < n; u++) {
|
|
7099
7099
|
var o = r.pop(), l = r.pop(), c = s + ((l & 240) >> 4);
|
|
7100
7100
|
if (c === a) {
|
|
7101
|
-
var
|
|
7102
|
-
|
|
7103
|
-
var h =
|
|
7101
|
+
var f = (l & 15) - 8;
|
|
7102
|
+
f >= 0 && f++;
|
|
7103
|
+
var h = f * i;
|
|
7104
7104
|
exports.DEBUG && console.log(e.step, "DELTACFIX", o, "by", h), e.cvt[o] += h;
|
|
7105
7105
|
}
|
|
7106
7106
|
}
|
|
@@ -7244,8 +7244,8 @@ function me(t, e) {
|
|
|
7244
7244
|
e.ip = r;
|
|
7245
7245
|
}
|
|
7246
7246
|
function T(t, e, r, n, a, s) {
|
|
7247
|
-
var i = s.stack, u = t && i.pop(), o = i.pop(), l = s.rp0, c = s.z0[l],
|
|
7248
|
-
y = g = d.distance(
|
|
7247
|
+
var i = s.stack, u = t && i.pop(), o = i.pop(), l = s.rp0, c = s.z0[l], f = s.z1[o], h = s.minDis, p = s.fv, d = s.dpv, g, y, m, S;
|
|
7248
|
+
y = g = d.distance(f, c, !0, !0), m = y >= 0 ? 1 : -1, y = Math.abs(y), t && (S = s.cvt[u], n && Math.abs(y - S) < s.cvCutIn && (y = S)), r && y < h && (y = h), n && (y = s.round(y)), p.setRelative(f, c, m * y, d), p.touch(f), exports.DEBUG && console.log(
|
|
7249
7249
|
s.step,
|
|
7250
7250
|
(t ? "MIRP[" : "MDRP[") + (e ? "M" : "m") + (r ? ">" : "_") + (n ? "R" : "_") + (a === 0 ? "Gr" : a === 1 ? "Bl" : a === 2 ? "Wh" : "") + "]",
|
|
7251
7251
|
t ? u + "(" + s.cvt[u] + "," + S + ")" : "",
|
|
@@ -8129,10 +8129,10 @@ function nu(t, e) {
|
|
|
8129
8129
|
var l = new oe(o, 0), c = Rt(
|
|
8130
8130
|
e.backtrackCoverage,
|
|
8131
8131
|
l
|
|
8132
|
-
),
|
|
8133
|
-
if (
|
|
8134
|
-
for (var
|
|
8135
|
-
for (var d = e.lookupRecords[
|
|
8132
|
+
), f = n.length === e.inputCoverage.length && u.length === e.lookaheadCoverage.length && c.length === e.backtrackCoverage.length, h = [];
|
|
8133
|
+
if (f)
|
|
8134
|
+
for (var p = 0; p < e.lookupRecords.length; p++)
|
|
8135
|
+
for (var d = e.lookupRecords[p], g = d.lookupListIndex, y = this.getLookupByIndex(g), m = 0; m < y.subtables.length; m++) {
|
|
8136
8136
|
var S = y.subtables[m], x = this.getLookupMethod(y, S), O = this.getSubstitutionType(y, S);
|
|
8137
8137
|
if (O === "12")
|
|
8138
8138
|
for (var C = 0; C < n.length; C++) {
|
|
@@ -8270,45 +8270,45 @@ te.prototype.lookupFeature = function(t) {
|
|
|
8270
8270
|
);
|
|
8271
8271
|
for (var a = this.getFeatureLookups(n), s = [].concat(e.context), i = 0; i < a.length; i++)
|
|
8272
8272
|
for (var u = a[i], o = this.getLookupSubtables(u), l = 0; l < o.length; l++) {
|
|
8273
|
-
var c = o[l],
|
|
8274
|
-
switch (
|
|
8273
|
+
var c = o[l], f = this.getSubstitutionType(u, c), h = this.getLookupMethod(u, c), p = void 0;
|
|
8274
|
+
switch (f) {
|
|
8275
8275
|
case "11":
|
|
8276
|
-
|
|
8276
|
+
p = h(e.current), p && s.splice(r, 1, new Oe({
|
|
8277
8277
|
id: 11,
|
|
8278
8278
|
tag: t.tag,
|
|
8279
|
-
substitution:
|
|
8279
|
+
substitution: p
|
|
8280
8280
|
}));
|
|
8281
8281
|
break;
|
|
8282
8282
|
case "12":
|
|
8283
|
-
|
|
8283
|
+
p = h(e.current), p && s.splice(r, 1, new Oe({
|
|
8284
8284
|
id: 12,
|
|
8285
8285
|
tag: t.tag,
|
|
8286
|
-
substitution:
|
|
8286
|
+
substitution: p
|
|
8287
8287
|
}));
|
|
8288
8288
|
break;
|
|
8289
8289
|
case "63":
|
|
8290
|
-
|
|
8290
|
+
p = h(e), Array.isArray(p) && p.length && s.splice(r, 1, new Oe({
|
|
8291
8291
|
id: 63,
|
|
8292
8292
|
tag: t.tag,
|
|
8293
|
-
substitution:
|
|
8293
|
+
substitution: p
|
|
8294
8294
|
}));
|
|
8295
8295
|
break;
|
|
8296
8296
|
case "41":
|
|
8297
|
-
|
|
8297
|
+
p = h(e), p && s.splice(r, 1, new Oe({
|
|
8298
8298
|
id: 41,
|
|
8299
8299
|
tag: t.tag,
|
|
8300
|
-
substitution:
|
|
8300
|
+
substitution: p
|
|
8301
8301
|
}));
|
|
8302
8302
|
break;
|
|
8303
8303
|
case "21":
|
|
8304
|
-
|
|
8304
|
+
p = h(e.current), p && s.splice(r, 1, new Oe({
|
|
8305
8305
|
id: 21,
|
|
8306
8306
|
tag: t.tag,
|
|
8307
|
-
substitution:
|
|
8307
|
+
substitution: p
|
|
8308
8308
|
}));
|
|
8309
8309
|
break;
|
|
8310
8310
|
}
|
|
8311
|
-
e = new oe(s, r), !(Array.isArray(
|
|
8311
|
+
e = new oe(s, r), !(Array.isArray(p) && !p.length) && (p = null);
|
|
8312
8312
|
}
|
|
8313
8313
|
return s.length ? s : null;
|
|
8314
8314
|
};
|
|
@@ -8478,15 +8478,15 @@ function mu(t) {
|
|
|
8478
8478
|
break;
|
|
8479
8479
|
}
|
|
8480
8480
|
if (n.indexOf(c) !== -1) {
|
|
8481
|
-
var
|
|
8481
|
+
var f = e.query.lookupFeature({
|
|
8482
8482
|
tag: c,
|
|
8483
8483
|
script: r,
|
|
8484
8484
|
contextParams: s
|
|
8485
8485
|
});
|
|
8486
|
-
if (
|
|
8487
|
-
return console.info(
|
|
8488
|
-
|
|
8489
|
-
h instanceof Oe && (or(h, a,
|
|
8486
|
+
if (f instanceof Error)
|
|
8487
|
+
return console.info(f.message);
|
|
8488
|
+
f.forEach(function(h, p) {
|
|
8489
|
+
h instanceof Oe && (or(h, a, p), s.context[p] = h.substitution);
|
|
8490
8490
|
});
|
|
8491
8491
|
}
|
|
8492
8492
|
}
|
|
@@ -8730,8 +8730,8 @@ A.prototype.updateFeatures = function(t) {
|
|
|
8730
8730
|
});
|
|
8731
8731
|
};
|
|
8732
8732
|
A.prototype.stringToGlyphs = function(t, e) {
|
|
8733
|
-
var r = this, n = new ce(), a = function(
|
|
8734
|
-
return r.charToGlyphIndex(
|
|
8733
|
+
var r = this, n = new ce(), a = function(f) {
|
|
8734
|
+
return r.charToGlyphIndex(f.char);
|
|
8735
8735
|
};
|
|
8736
8736
|
n.registerModifier("glyphIndex", null, a);
|
|
8737
8737
|
var s = e ? this.updateFeatures(e.features) : this.defaultRenderOptions.features;
|
|
@@ -8774,9 +8774,9 @@ A.prototype.forEachGlyph = function(t, e, r, n, a, s) {
|
|
|
8774
8774
|
o = this.position.getKerningTables(l, a.language);
|
|
8775
8775
|
}
|
|
8776
8776
|
for (var c = 0; c < u.length; c += 1) {
|
|
8777
|
-
var
|
|
8778
|
-
if (s.call(this,
|
|
8779
|
-
var h = o ? this.position.getKerningValue(o,
|
|
8777
|
+
var f = u[c];
|
|
8778
|
+
if (s.call(this, f, e, r, n, a), f.advanceWidth && (e += f.advanceWidth * i), a.kerning && c < u.length - 1) {
|
|
8779
|
+
var h = o ? this.position.getKerningValue(o, f.index, u[c + 1].index) : this.getKerningValue(f, u[c + 1]);
|
|
8780
8780
|
e += h * i;
|
|
8781
8781
|
}
|
|
8782
8782
|
a.letterSpacing ? e += a.letterSpacing * n : a.tracking && (e += a.tracking / 1e3 * n);
|
|
@@ -8971,10 +8971,10 @@ function Mu(t, e, r) {
|
|
|
8971
8971
|
E.argument(a === 65536, "Unsupported fvar table version.");
|
|
8972
8972
|
var s = n.parseOffset16();
|
|
8973
8973
|
n.skip("uShort", 1);
|
|
8974
|
-
for (var i = n.parseUShort(), u = n.parseUShort(), o = n.parseUShort(), l = n.parseUShort(), c = [],
|
|
8975
|
-
c.push(Lu(t, e + s +
|
|
8976
|
-
for (var h = [],
|
|
8977
|
-
h.push(Au(t,
|
|
8974
|
+
for (var i = n.parseUShort(), u = n.parseUShort(), o = n.parseUShort(), l = n.parseUShort(), c = [], f = 0; f < i; f++)
|
|
8975
|
+
c.push(Lu(t, e + s + f * u, r));
|
|
8976
|
+
for (var h = [], p = e + s + i * u, d = 0; d < o; d++)
|
|
8977
|
+
h.push(Au(t, p + d * l, c, r));
|
|
8978
8978
|
return { axes: c, instances: h };
|
|
8979
8979
|
}
|
|
8980
8980
|
var Bu = { make: Du, parse: Mu }, Pu = function() {
|
|
@@ -9217,7 +9217,7 @@ function el(t, e) {
|
|
|
9217
9217
|
i = F.getUShort(s, 12), u = $u(s, i);
|
|
9218
9218
|
} else
|
|
9219
9219
|
throw new Error("Unsupported OpenType signature " + o);
|
|
9220
|
-
for (var c,
|
|
9220
|
+
for (var c, f, h, p, d, g, y, m, S, x, O, C, D = 0; D < i; D += 1) {
|
|
9221
9221
|
var L = u[D], w = void 0;
|
|
9222
9222
|
switch (L.tag) {
|
|
9223
9223
|
case "cmap":
|
|
@@ -9227,7 +9227,7 @@ function el(t, e) {
|
|
|
9227
9227
|
w = P(s, L), C = new F.Parser(w.data, w.offset), a.tables.cvt = C.parseShortList(L.length / 2);
|
|
9228
9228
|
break;
|
|
9229
9229
|
case "fvar":
|
|
9230
|
-
|
|
9230
|
+
f = L;
|
|
9231
9231
|
break;
|
|
9232
9232
|
case "fpgm":
|
|
9233
9233
|
w = P(s, L), C = new F.Parser(w.data, w.offset), a.tables.fpgm = C.parseByteList(L.length);
|
|
@@ -9272,7 +9272,7 @@ function el(t, e) {
|
|
|
9272
9272
|
m = L;
|
|
9273
9273
|
break;
|
|
9274
9274
|
case "GDEF":
|
|
9275
|
-
|
|
9275
|
+
p = L;
|
|
9276
9276
|
break;
|
|
9277
9277
|
case "GPOS":
|
|
9278
9278
|
d = L;
|
|
@@ -9300,8 +9300,8 @@ function el(t, e) {
|
|
|
9300
9300
|
a.kerningPairs = Ku.parse(V.data, V.offset);
|
|
9301
9301
|
} else
|
|
9302
9302
|
a.kerningPairs = {};
|
|
9303
|
-
if (
|
|
9304
|
-
var q = P(s,
|
|
9303
|
+
if (p) {
|
|
9304
|
+
var q = P(s, p);
|
|
9305
9305
|
a.tables.gdef = zu.parse(q.data, q.offset);
|
|
9306
9306
|
}
|
|
9307
9307
|
if (d) {
|
|
@@ -9312,8 +9312,8 @@ function el(t, e) {
|
|
|
9312
9312
|
var z = P(s, g);
|
|
9313
9313
|
a.tables.gsub = Jn.parse(z.data, z.offset);
|
|
9314
9314
|
}
|
|
9315
|
-
if (
|
|
9316
|
-
var Z = P(s,
|
|
9315
|
+
if (f) {
|
|
9316
|
+
var Z = P(s, f);
|
|
9317
9317
|
a.tables.fvar = Bu.parse(Z.data, Z.offset, a.names);
|
|
9318
9318
|
}
|
|
9319
9319
|
if (O) {
|
|
@@ -9328,17 +9328,17 @@ function tl(t) {
|
|
|
9328
9328
|
let l = 1;
|
|
9329
9329
|
o && (l = r.unitsPerEm / o.yMax);
|
|
9330
9330
|
for (let c = 0; c < u.length; c++) {
|
|
9331
|
-
const
|
|
9332
|
-
if (
|
|
9333
|
-
const
|
|
9331
|
+
const f = u[c], h = r.glyphs.glyphs[i[f]];
|
|
9332
|
+
if (f !== void 0) {
|
|
9333
|
+
const p = {
|
|
9334
9334
|
ha: a(h.advanceWidth),
|
|
9335
9335
|
x_min: a(h.xMin),
|
|
9336
9336
|
x_max: a(h.xMax),
|
|
9337
9337
|
o: ""
|
|
9338
9338
|
};
|
|
9339
9339
|
h.path.commands.forEach(function(d) {
|
|
9340
|
-
d.type.toLowerCase() === "c" && (d.type = "b"),
|
|
9341
|
-
}), s[String.fromCodePoint(h.unicode)] =
|
|
9340
|
+
d.type.toLowerCase() === "c" && (d.type = "b"), p.o += d.type.toLowerCase() + " ", d.x !== void 0 && d.y !== void 0 && (p.o += a(d.x) + " " + a(d.y) + " "), d.x1 !== void 0 && d.y1 !== void 0 && (p.o += a(d.x1) + " " + a(d.y1) + " "), d.x2 !== void 0 && d.y2 !== void 0 && (p.o += a(d.x2) + " " + a(d.y2) + " ");
|
|
9341
|
+
}), s[String.fromCodePoint(h.unicode)] = p;
|
|
9342
9342
|
}
|
|
9343
9343
|
}
|
|
9344
9344
|
return {
|
|
@@ -10011,20 +10011,20 @@ class We {
|
|
|
10011
10011
|
const { strokeWidth: r = "0.5%", strokeColor: n = "black", isAutoFit: a = !1 } = e;
|
|
10012
10012
|
let s, i;
|
|
10013
10013
|
if (a) {
|
|
10014
|
-
const u = this.bbox, o = 0.2, l = u.maxX - u.minX, c = u.maxY - u.minY,
|
|
10014
|
+
const u = this.bbox, o = 0.2, l = u.maxX - u.minX, c = u.maxY - u.minY, f = u.minX - l * o, h = u.maxX + l * o, p = u.minY - c * o, d = u.maxY + c * o;
|
|
10015
10015
|
i = this.polylines.map((g) => {
|
|
10016
10016
|
let y = "";
|
|
10017
10017
|
return g.forEach((m, S) => {
|
|
10018
10018
|
const x = m.x, O = -m.y;
|
|
10019
10019
|
y += S === 0 ? `M ${x} ${O} ` : `L ${x} ${O} `;
|
|
10020
10020
|
}), `<path d="${y}" stroke="${n}" stroke-width="${r}" fill="none"/>`;
|
|
10021
|
-
}).join(""), s = `${
|
|
10021
|
+
}).join(""), s = `${f} ${-d} ${h - f} ${d - p}`;
|
|
10022
10022
|
} else
|
|
10023
10023
|
s = "0 0 20 20", i = this.polylines.map((u) => {
|
|
10024
10024
|
let o = "";
|
|
10025
10025
|
return u.forEach((l, c) => {
|
|
10026
|
-
const
|
|
10027
|
-
o += c === 0 ? `M ${
|
|
10026
|
+
const f = l.x + 5, h = -l.y + 15;
|
|
10027
|
+
o += c === 0 ? `M ${f} ${h} ` : `L ${f} ${h} `;
|
|
10028
10028
|
}), `<path d="${o}" stroke="${n}" stroke-width="${r}" fill="none"/>`;
|
|
10029
10029
|
}).join("");
|
|
10030
10030
|
return `<svg width="100%" height="100%" viewBox="${s}" preserveAspectRatio="xMidYMid meet">${i}</svg>`;
|
|
@@ -10252,23 +10252,23 @@ class ul {
|
|
|
10252
10252
|
let s = r;
|
|
10253
10253
|
const i = e[++s] * n.scale, u = Q.byteToSByte(e[++s]), o = (u & 112) >> 4;
|
|
10254
10254
|
let l = u & 7;
|
|
10255
|
-
const c = u < 0,
|
|
10255
|
+
const c = u < 0, f = Math.PI / 4 * o, h = n.currentPoint.clone().subtract(new I(Math.cos(f) * i, Math.sin(f) * i)), p = Ze.fromOctant(h, i, o, l, c);
|
|
10256
10256
|
if (n.isPenDown) {
|
|
10257
|
-
const d =
|
|
10257
|
+
const d = p.tessellate();
|
|
10258
10258
|
n.currentPolyline.pop(), n.currentPolyline.push(...d.slice());
|
|
10259
10259
|
}
|
|
10260
|
-
return n.currentPoint = (a =
|
|
10260
|
+
return n.currentPoint = (a = p.tessellate().pop()) == null ? void 0 : a.clone(), s;
|
|
10261
10261
|
}
|
|
10262
10262
|
handleFractionalArc(e, r, n) {
|
|
10263
10263
|
let a = r;
|
|
10264
|
-
const s = e[++a], i = e[++a], u = e[++a], o = e[++a], l = (u * 255 + o) * n.scale, c = Q.byteToSByte(e[++a]),
|
|
10264
|
+
const s = e[++a], i = e[++a], u = e[++a], o = e[++a], l = (u * 255 + o) * n.scale, c = Q.byteToSByte(e[++a]), f = (c & 112) >> 4;
|
|
10265
10265
|
let h = c & 7;
|
|
10266
10266
|
h === 0 && (h = 8), i !== 0 && h--;
|
|
10267
|
-
const
|
|
10268
|
-
let d =
|
|
10267
|
+
const p = Math.PI / 4;
|
|
10268
|
+
let d = p * h, g = ol, y = 1;
|
|
10269
10269
|
c < 0 && (g = -g, d = -d, y = -1);
|
|
10270
|
-
let m =
|
|
10271
|
-
m +=
|
|
10270
|
+
let m = p * f, S = m + d;
|
|
10271
|
+
m += p * s / 256 * y, S += p * i / 256 * y;
|
|
10272
10272
|
const x = n.currentPoint.clone().subtract(new I(l * Math.cos(m), l * Math.sin(m)));
|
|
10273
10273
|
if (n.currentPoint = x.clone().add(new I(l * Math.cos(S), l * Math.sin(S))), n.isPenDown) {
|
|
10274
10274
|
let O = m;
|
|
@@ -10761,7 +10761,7 @@ class Me {
|
|
|
10761
10761
|
this.fontMap.clear();
|
|
10762
10762
|
}
|
|
10763
10763
|
}
|
|
10764
|
-
class
|
|
10764
|
+
class Sl {
|
|
10765
10765
|
/**
|
|
10766
10766
|
* Creates a new instance of DefaultFontLoader
|
|
10767
10767
|
*/
|
|
@@ -10824,7 +10824,14 @@ const hl = {
|
|
|
10824
10824
|
d: 5
|
|
10825
10825
|
/* DISTRIBUTED */
|
|
10826
10826
|
};
|
|
10827
|
-
|
|
10827
|
+
function pl(t, e = !1) {
|
|
10828
|
+
const r = /* @__PURE__ */ new Set(), n = /\\[fF](.*?)[;|]/g;
|
|
10829
|
+
return [...t.matchAll(n)].forEach((a) => {
|
|
10830
|
+
let s = a[1].toLowerCase();
|
|
10831
|
+
e && (s = s.replace(/\.(ttf|otf|woff|shx)$/, "")), r.add(s);
|
|
10832
|
+
}), r;
|
|
10833
|
+
}
|
|
10834
|
+
class dl {
|
|
10828
10835
|
/**
|
|
10829
10836
|
* Creates a new MTextParser instance
|
|
10830
10837
|
* @param content - The MText content to parse
|
|
@@ -10887,11 +10894,11 @@ class pl {
|
|
|
10887
10894
|
}, u = (o) => {
|
|
10888
10895
|
let l = "", c = o;
|
|
10889
10896
|
for (; e.hasData; ) {
|
|
10890
|
-
const [
|
|
10891
|
-
if (!(c &&
|
|
10892
|
-
if (c = !1, !h &&
|
|
10897
|
+
const [f, h] = s();
|
|
10898
|
+
if (!(c && f === " ")) {
|
|
10899
|
+
if (c = !1, !h && f === ";")
|
|
10893
10900
|
break;
|
|
10894
|
-
l +=
|
|
10901
|
+
l += f;
|
|
10895
10902
|
}
|
|
10896
10903
|
}
|
|
10897
10904
|
return l;
|
|
@@ -11709,61 +11716,61 @@ function fn(t, e = !1) {
|
|
|
11709
11716
|
const r = t[0].index !== null, n = new Set(Object.keys(t[0].attributes)), a = new Set(Object.keys(t[0].morphAttributes)), s = {}, i = {}, u = t[0].morphTargetsRelative, o = new ya();
|
|
11710
11717
|
let l = 0;
|
|
11711
11718
|
for (let c = 0; c < t.length; ++c) {
|
|
11712
|
-
const
|
|
11719
|
+
const f = t[c];
|
|
11713
11720
|
let h = 0;
|
|
11714
|
-
if (r !== (
|
|
11721
|
+
if (r !== (f.index !== null))
|
|
11715
11722
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + c + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
|
|
11716
|
-
for (const
|
|
11717
|
-
if (!n.has(
|
|
11718
|
-
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + c + '. All geometries must have compatible attributes; make sure "' +
|
|
11719
|
-
s[
|
|
11723
|
+
for (const p in f.attributes) {
|
|
11724
|
+
if (!n.has(p))
|
|
11725
|
+
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + c + '. All geometries must have compatible attributes; make sure "' + p + '" attribute exists among all geometries, or in none of them.'), null;
|
|
11726
|
+
s[p] === void 0 && (s[p] = []), s[p].push(f.attributes[p]), h++;
|
|
11720
11727
|
}
|
|
11721
11728
|
if (h !== n.size)
|
|
11722
11729
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + c + ". Make sure all geometries have the same number of attributes."), null;
|
|
11723
|
-
if (u !==
|
|
11730
|
+
if (u !== f.morphTargetsRelative)
|
|
11724
11731
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + c + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
|
|
11725
|
-
for (const
|
|
11726
|
-
if (!a.has(
|
|
11732
|
+
for (const p in f.morphAttributes) {
|
|
11733
|
+
if (!a.has(p))
|
|
11727
11734
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + c + ". .morphAttributes must be consistent throughout all geometries."), null;
|
|
11728
|
-
i[
|
|
11735
|
+
i[p] === void 0 && (i[p] = []), i[p].push(f.morphAttributes[p]);
|
|
11729
11736
|
}
|
|
11730
11737
|
if (e) {
|
|
11731
|
-
let
|
|
11738
|
+
let p;
|
|
11732
11739
|
if (r)
|
|
11733
|
-
|
|
11734
|
-
else if (
|
|
11735
|
-
|
|
11740
|
+
p = f.index.count;
|
|
11741
|
+
else if (f.attributes.position !== void 0)
|
|
11742
|
+
p = f.attributes.position.count;
|
|
11736
11743
|
else
|
|
11737
11744
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + c + ". The geometry must have either an index or a position attribute"), null;
|
|
11738
|
-
o.addGroup(l,
|
|
11745
|
+
o.addGroup(l, p, c), l += p;
|
|
11739
11746
|
}
|
|
11740
11747
|
}
|
|
11741
11748
|
if (r) {
|
|
11742
11749
|
let c = 0;
|
|
11743
|
-
const
|
|
11750
|
+
const f = [];
|
|
11744
11751
|
for (let h = 0; h < t.length; ++h) {
|
|
11745
|
-
const
|
|
11746
|
-
for (let d = 0; d <
|
|
11747
|
-
|
|
11752
|
+
const p = t[h].index;
|
|
11753
|
+
for (let d = 0; d < p.count; ++d)
|
|
11754
|
+
f.push(p.getX(d) + c);
|
|
11748
11755
|
c += t[h].attributes.position.count;
|
|
11749
11756
|
}
|
|
11750
|
-
o.setIndex(
|
|
11757
|
+
o.setIndex(f);
|
|
11751
11758
|
}
|
|
11752
11759
|
for (const c in s) {
|
|
11753
|
-
const
|
|
11754
|
-
if (!
|
|
11760
|
+
const f = pn(s[c]);
|
|
11761
|
+
if (!f)
|
|
11755
11762
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + c + " attribute."), null;
|
|
11756
|
-
o.setAttribute(c,
|
|
11763
|
+
o.setAttribute(c, f);
|
|
11757
11764
|
}
|
|
11758
11765
|
for (const c in i) {
|
|
11759
|
-
const
|
|
11760
|
-
if (
|
|
11766
|
+
const f = i[c][0].length;
|
|
11767
|
+
if (f === 0) break;
|
|
11761
11768
|
o.morphAttributes = o.morphAttributes || {}, o.morphAttributes[c] = [];
|
|
11762
|
-
for (let h = 0; h <
|
|
11763
|
-
const
|
|
11769
|
+
for (let h = 0; h < f; ++h) {
|
|
11770
|
+
const p = [];
|
|
11764
11771
|
for (let g = 0; g < i[c].length; ++g)
|
|
11765
|
-
|
|
11766
|
-
const d = pn(
|
|
11772
|
+
p.push(i[c][g][h]);
|
|
11773
|
+
const d = pn(p);
|
|
11767
11774
|
if (!d)
|
|
11768
11775
|
return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + c + " morphAttribute."), null;
|
|
11769
11776
|
o.morphAttributes[c].push(d);
|
|
@@ -11790,11 +11797,11 @@ function pn(t) {
|
|
|
11790
11797
|
for (let l = 0; l < t.length; ++l) {
|
|
11791
11798
|
const c = t[l];
|
|
11792
11799
|
if (c.isInterleavedBufferAttribute) {
|
|
11793
|
-
const
|
|
11794
|
-
for (let h = 0,
|
|
11800
|
+
const f = o / r;
|
|
11801
|
+
for (let h = 0, p = c.count; h < p; h++)
|
|
11795
11802
|
for (let d = 0; d < r; d++) {
|
|
11796
11803
|
const g = c.getComponent(h, d);
|
|
11797
|
-
u.setComponent(h +
|
|
11804
|
+
u.setComponent(h + f, d, g);
|
|
11798
11805
|
}
|
|
11799
11806
|
} else
|
|
11800
11807
|
i.set(c.array, o);
|
|
@@ -11802,16 +11809,25 @@ function pn(t) {
|
|
|
11802
11809
|
}
|
|
11803
11810
|
return a !== void 0 && (u.gpuType = a), u;
|
|
11804
11811
|
}
|
|
11805
|
-
const
|
|
11812
|
+
const vl = /* @__PURE__ */ new R.Vector3(), gl = 1.666666;
|
|
11806
11813
|
class hr {
|
|
11814
|
+
/**
|
|
11815
|
+
* Creates a new Context instance with optional initial values.
|
|
11816
|
+
* @param init - Partial object containing initial values for context properties
|
|
11817
|
+
*/
|
|
11807
11818
|
constructor(e) {
|
|
11808
11819
|
this.font = "", this.fontScaleFactor = 1, this.fontSize = 1, this.fontSizeScaleFactor = 1, this.color = 16777215, this.underline = !1, this.overline = !1, this.strikeThrough = !1, this.obliqueAngle = 0, this.italic = !1, this.bold = !1, this.widthFactor = 1, this.wordSpace = 1, this.blankWidth = 0, this.horizontalAlignment = se.LEFT, Object.assign(this, e);
|
|
11809
11820
|
}
|
|
11821
|
+
/**
|
|
11822
|
+
* Creates a deep copy of the current context.
|
|
11823
|
+
* This is useful for saving state before applying formatting changes.
|
|
11824
|
+
* @returns A new Context instance with identical property values
|
|
11825
|
+
*/
|
|
11810
11826
|
clone() {
|
|
11811
11827
|
return new hr({ ...this });
|
|
11812
11828
|
}
|
|
11813
11829
|
}
|
|
11814
|
-
class
|
|
11830
|
+
class yl {
|
|
11815
11831
|
/**
|
|
11816
11832
|
* Construct one instance of this class and initialize some properties with default values.
|
|
11817
11833
|
* @param style Input text style
|
|
@@ -11928,7 +11944,7 @@ class gl {
|
|
|
11928
11944
|
* The height of current line of texts
|
|
11929
11945
|
*/
|
|
11930
11946
|
get currentLineHeight() {
|
|
11931
|
-
return this.defaultLineSpaceFactor * this.currentFontSize *
|
|
11947
|
+
return this.defaultLineSpaceFactor * this.currentFontSize * gl + this.currentMaxFontSize;
|
|
11932
11948
|
}
|
|
11933
11949
|
/**
|
|
11934
11950
|
* The maximum font size in current line. Characters in one line may have different font and font
|
|
@@ -11939,7 +11955,10 @@ class gl {
|
|
|
11939
11955
|
return this._maxFontSize;
|
|
11940
11956
|
}
|
|
11941
11957
|
/**
|
|
11942
|
-
* The current space setting between two characters
|
|
11958
|
+
* The current space setting between two characters. The meaning of this value is as follows.
|
|
11959
|
+
* - 1: no extra spacing (default tracking)
|
|
11960
|
+
* - 1.2: increases spacing by 20% of the text height
|
|
11961
|
+
* - 0.8: decreases spacing by 20% of the text height
|
|
11943
11962
|
*/
|
|
11944
11963
|
get currentWordSpace() {
|
|
11945
11964
|
return this._currentContext.wordSpace;
|
|
@@ -12009,7 +12028,7 @@ class gl {
|
|
|
12009
12028
|
e.changes.capHeight && (e.changes.capHeight.isRelative ? this.changeFontSizeScaleFactor(e.changes.capHeight.value) : this.changeFontHeight(e.changes.capHeight.value));
|
|
12010
12029
|
break;
|
|
12011
12030
|
case "T":
|
|
12012
|
-
e.changes.charTrackingFactor && (this._currentContext.wordSpace = e.changes.charTrackingFactor.value);
|
|
12031
|
+
e.changes.charTrackingFactor && (e.changes.charTrackingFactor.isRelative ? this._currentContext.wordSpace = e.changes.charTrackingFactor.value + 1 : this._currentContext.wordSpace = e.changes.charTrackingFactor.value);
|
|
12013
12032
|
break;
|
|
12014
12033
|
case "q":
|
|
12015
12034
|
e.changes.paragraph && e.changes.paragraph.align && (this._currentContext.horizontalAlignment = e.changes.paragraph.align);
|
|
@@ -12053,7 +12072,7 @@ class gl {
|
|
|
12053
12072
|
this.processBlank();
|
|
12054
12073
|
else if (s.type === De.PROPERTIES_CHANGED) {
|
|
12055
12074
|
const i = s.data;
|
|
12056
|
-
i.command === void 0 ? this._contextStack.length > 0 && (this._currentContext = this._contextStack.pop()) : (this._contextStack.push(this._currentContext.clone()), this.processFormat(i)), this.processGeometries(r, n, a);
|
|
12075
|
+
i.command === void 0 ? this._contextStack.length > 0 && (this._currentContext = this._contextStack.pop()) : (this._contextStack.length === 0 && this._contextStack.push(this._currentContext.clone()), this.processFormat(i)), this.processGeometries(r, n, a);
|
|
12057
12076
|
} else s.type === De.STACK && (this.processStack(s.data, r, n), this.processGeometries(r, n, a));
|
|
12058
12077
|
return (r.length > 0 || n.length > 0) && this.processGeometries(r, n, a), a;
|
|
12059
12078
|
}
|
|
@@ -12068,7 +12087,7 @@ class gl {
|
|
|
12068
12087
|
this.processChar(e[a], r, n);
|
|
12069
12088
|
}
|
|
12070
12089
|
processStack(e, r, n) {
|
|
12071
|
-
const [a, s, i] = e, u = this._hOffset, o = this._vOffset, l = this._currentContext.wordSpace, c = this._currentContext.fontSize,
|
|
12090
|
+
const [a, s, i] = e, u = this._hOffset, o = this._vOffset, l = this._currentContext.wordSpace, c = this._currentContext.fontSize, f = this._currentContext.fontSizeScaleFactor;
|
|
12072
12091
|
this._hOffset = u, this._currentContext.wordSpace = 1;
|
|
12073
12092
|
let h = 0;
|
|
12074
12093
|
for (let m = 0; m < a.length; m++) {
|
|
@@ -12076,14 +12095,14 @@ class gl {
|
|
|
12076
12095
|
S && (h += S.width * this.currentWidthFactor);
|
|
12077
12096
|
}
|
|
12078
12097
|
this._hOffset = u;
|
|
12079
|
-
let
|
|
12098
|
+
let p = 0;
|
|
12080
12099
|
for (let m = 0; m < s.length; m++) {
|
|
12081
12100
|
const S = this.getCharShape(s[m]);
|
|
12082
|
-
S && (
|
|
12101
|
+
S && (p += S.width * this.currentWidthFactor);
|
|
12083
12102
|
}
|
|
12084
|
-
const d = Math.max(h,
|
|
12103
|
+
const d = Math.max(h, p), g = (d - h) / 2, y = (d - p) / 2;
|
|
12085
12104
|
if (i === "^") {
|
|
12086
|
-
if (this._currentContext.fontSizeScaleFactor =
|
|
12105
|
+
if (this._currentContext.fontSizeScaleFactor = f * 0.7, this.calcuateLineParams(), a && !s) {
|
|
12087
12106
|
const m = [], S = [];
|
|
12088
12107
|
this._hOffset = u, this._vOffset = o + c * 0.1;
|
|
12089
12108
|
for (let x = 0; x < a.length; x++)
|
|
@@ -12091,12 +12110,12 @@ class gl {
|
|
|
12091
12110
|
r.push(...m), n.push(...S), this._hOffset = u + h;
|
|
12092
12111
|
} else if (!a && s) {
|
|
12093
12112
|
const m = [], S = [];
|
|
12094
|
-
this._hOffset = u, this._vOffset = o - c * 0.
|
|
12113
|
+
this._hOffset = u, this._vOffset = o - c * 0.6;
|
|
12095
12114
|
for (let x = 0; x < s.length; x++)
|
|
12096
12115
|
this.processChar(s[x], m, S);
|
|
12097
|
-
r.push(...m), n.push(...S), this._hOffset = u +
|
|
12116
|
+
r.push(...m), n.push(...S), this._hOffset = u + p;
|
|
12098
12117
|
}
|
|
12099
|
-
this._currentContext.fontSizeScaleFactor =
|
|
12118
|
+
this._currentContext.fontSizeScaleFactor = f, this.calcuateLineParams();
|
|
12100
12119
|
} else {
|
|
12101
12120
|
const m = [], S = [];
|
|
12102
12121
|
this._hOffset = u + g, this._vOffset = o + this.currentFontSize * 0.3;
|
|
@@ -12140,35 +12159,35 @@ class gl {
|
|
|
12140
12159
|
}
|
|
12141
12160
|
const u = this.fontManager.getFontType(this.currentFont);
|
|
12142
12161
|
this._currentContext.bold && u === "mesh" && s.scale(1.06, 1.06, 1), this.hOffset > (this.maxWidth || 1 / 0) && this.startNewLine();
|
|
12143
|
-
let o = this.hOffset, l = this.flowDirection == je.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentFontSize, c = a.width * this.currentWidthFactor,
|
|
12162
|
+
let o = this.hOffset, l = this.flowDirection == je.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentFontSize, c = a.width * this.currentWidthFactor, f = this.currentFontSize;
|
|
12144
12163
|
s.translate(o, l, 0), this.currentHorizontalAlignment == se.DISTRIBUTED ? this._hOffset += a.width * this.currentWidthFactor : this._hOffset += a.width * this.currentWordSpace * this.currentWidthFactor, r.push(s);
|
|
12145
|
-
const h =
|
|
12164
|
+
const h = f * 0.05, p = 1e-3;
|
|
12146
12165
|
if (this._currentContext.underline) {
|
|
12147
12166
|
const d = new R.BufferGeometry(), g = l - h;
|
|
12148
12167
|
d.setAttribute(
|
|
12149
12168
|
"position",
|
|
12150
12169
|
new R.BufferAttribute(
|
|
12151
|
-
new Float32Array([o, g,
|
|
12170
|
+
new Float32Array([o, g, p, o + c, g, p]),
|
|
12152
12171
|
3
|
|
12153
12172
|
)
|
|
12154
12173
|
), d.setIndex(null), n.push(d);
|
|
12155
12174
|
}
|
|
12156
12175
|
if (this._currentContext.overline) {
|
|
12157
|
-
const d = new R.BufferGeometry(), g = l +
|
|
12176
|
+
const d = new R.BufferGeometry(), g = l + f + h;
|
|
12158
12177
|
d.setAttribute(
|
|
12159
12178
|
"position",
|
|
12160
12179
|
new R.BufferAttribute(
|
|
12161
|
-
new Float32Array([o, g,
|
|
12180
|
+
new Float32Array([o, g, p, o + c, g, p]),
|
|
12162
12181
|
3
|
|
12163
12182
|
)
|
|
12164
12183
|
), d.setIndex(null), n.push(d);
|
|
12165
12184
|
}
|
|
12166
12185
|
if (this._currentContext.strikeThrough) {
|
|
12167
|
-
const d = new R.BufferGeometry(), g = l +
|
|
12186
|
+
const d = new R.BufferGeometry(), g = l + f / 2 - f * 0.2;
|
|
12168
12187
|
d.setAttribute(
|
|
12169
12188
|
"position",
|
|
12170
12189
|
new R.BufferAttribute(
|
|
12171
|
-
new Float32Array([o, g,
|
|
12190
|
+
new Float32Array([o, g, p, o + c, g, p]),
|
|
12172
12191
|
3
|
|
12173
12192
|
)
|
|
12174
12193
|
), d.setIndex(null), n.push(d);
|
|
@@ -12221,7 +12240,7 @@ class gl {
|
|
|
12221
12240
|
if (e.forEach((n, a) => {
|
|
12222
12241
|
n.boundingBox || n.computeBoundingBox(), a === 0 ? r = n.boundingBox : r.union(n.boundingBox);
|
|
12223
12242
|
}), r) {
|
|
12224
|
-
const n = r.getSize(
|
|
12243
|
+
const n = r.getSize(vl);
|
|
12225
12244
|
switch (this.currentHorizontalAlignment) {
|
|
12226
12245
|
case se.LEFT:
|
|
12227
12246
|
break;
|
|
@@ -12283,7 +12302,25 @@ class gl {
|
|
|
12283
12302
|
}
|
|
12284
12303
|
}
|
|
12285
12304
|
const Mt = /* @__PURE__ */ new R.Vector3(), we = /* @__PURE__ */ new R.Vector3(), Bt = /* @__PURE__ */ new R.Vector3(), Pt = /* @__PURE__ */ new R.Quaternion(), It = /* @__PURE__ */ new R.Matrix4(), dn = /* @__PURE__ */ new R.Matrix4(), vn = /* @__PURE__ */ new R.Vector3(1, 0, 0);
|
|
12286
|
-
class
|
|
12305
|
+
class kl extends R.Object3D {
|
|
12306
|
+
/**
|
|
12307
|
+
* Extracts all unique font names used in an MText string.
|
|
12308
|
+
* This function searches for font commands in the format \f{fontname}| or \f{fontname}; and returns a set of unique font names.
|
|
12309
|
+
* Font names are converted to lowercase to ensure case-insensitive uniqueness.
|
|
12310
|
+
*
|
|
12311
|
+
* @param mtext - The MText string to analyze for font names
|
|
12312
|
+
* @param removeExtension - Whether to remove font file extensions (e.g., .ttf, .shx) from font names. Defaults to false.
|
|
12313
|
+
* @returns A Set containing all unique font names found in the MText string, converted to lowercase
|
|
12314
|
+
* @example
|
|
12315
|
+
* ```ts
|
|
12316
|
+
* const mtext = "\\fArial.ttf|Hello\\fTimes New Roman.otf|World";
|
|
12317
|
+
* const fonts = getFonts(mtext, true);
|
|
12318
|
+
* // Returns: Set(2) { "arial", "times new roman" }
|
|
12319
|
+
* ```
|
|
12320
|
+
*/
|
|
12321
|
+
static getFonts(e, r = !1) {
|
|
12322
|
+
return pl(e, r);
|
|
12323
|
+
}
|
|
12287
12324
|
/**
|
|
12288
12325
|
* Creates a new instance of MText.
|
|
12289
12326
|
* @param text - The MText data containing text content and properties
|
|
@@ -12375,8 +12412,8 @@ class Sl extends R.Object3D {
|
|
|
12375
12412
|
});
|
|
12376
12413
|
let u = e.rotation || 0;
|
|
12377
12414
|
if (e.directionVector) {
|
|
12378
|
-
const l = e.directionVector, c = new R.Vector3(l.x, l.y, l.z),
|
|
12379
|
-
u =
|
|
12415
|
+
const l = e.directionVector, c = new R.Vector3(l.x, l.y, l.z), f = c.clone().cross(vn), h = vn.angleTo(c);
|
|
12416
|
+
u = f.z > 0 ? -h : h;
|
|
12380
12417
|
}
|
|
12381
12418
|
n.matrix.compose(we, Pt, Bt);
|
|
12382
12419
|
const o = e.position ? we.clone().sub(e.position) : we;
|
|
@@ -12410,15 +12447,15 @@ class Sl extends R.Object3D {
|
|
|
12410
12447
|
removeFontExtension: !0
|
|
12411
12448
|
}, c = new mt();
|
|
12412
12449
|
c.fontFace.family = r.font, c.capHeight = { value: e.height || 1, isRelative: !0 }, c.widthFactor = { value: e.widthFactor ?? 1, isRelative: !0 }, c.align = s, c.paragraph.align = a;
|
|
12413
|
-
const h = new
|
|
12450
|
+
const h = new dl(e.text, c, !0).parse(), p = new yl(
|
|
12414
12451
|
r,
|
|
12415
12452
|
this.styleManager,
|
|
12416
12453
|
this.fontManager,
|
|
12417
12454
|
l
|
|
12418
|
-
), d =
|
|
12419
|
-
return
|
|
12455
|
+
), d = p.processText(h);
|
|
12456
|
+
return p.processLastLine(), {
|
|
12420
12457
|
object: d,
|
|
12421
|
-
height:
|
|
12458
|
+
height: p.totalHeight
|
|
12422
12459
|
};
|
|
12423
12460
|
}
|
|
12424
12461
|
/**
|
|
@@ -12480,7 +12517,7 @@ class Sl extends R.Object3D {
|
|
|
12480
12517
|
this.getBoxes(n[a], r);
|
|
12481
12518
|
}
|
|
12482
12519
|
}
|
|
12483
|
-
class
|
|
12520
|
+
class Tl {
|
|
12484
12521
|
constructor() {
|
|
12485
12522
|
this.lineBasicMaterials = {}, this.meshBasicMaterials = {}, this.unsupportedTextStyles = {};
|
|
12486
12523
|
}
|
|
@@ -12498,12 +12535,12 @@ class kl {
|
|
|
12498
12535
|
export {
|
|
12499
12536
|
gn as BaseFont,
|
|
12500
12537
|
yn as BaseTextShape,
|
|
12501
|
-
|
|
12538
|
+
Sl as DefaultFontLoader,
|
|
12502
12539
|
pr as EventManager,
|
|
12503
12540
|
Se as FontFactory,
|
|
12504
12541
|
Me as FontManager,
|
|
12505
|
-
|
|
12542
|
+
kl as MText,
|
|
12506
12543
|
cl as MTextAttachmentPoint,
|
|
12507
12544
|
je as MTextFlowDirection,
|
|
12508
|
-
|
|
12545
|
+
Tl as StyleManager
|
|
12509
12546
|
};
|