@mlightcad/mtext-renderer 0.12.8 → 0.12.10
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 +217 -144
- package/dist/index.umd.cjs +9 -9
- package/dist/mtext-renderer-worker.js +289 -216
- package/lib/font/defaultFontsPresets.d.ts +11 -2
- package/lib/font/fontManager.d.ts +22 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2560,7 +2560,7 @@ const St = {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
};
|
|
2562
2562
|
Be.DATABASE_NAME = "mlightcad", Be.DATABASE_VERSION = Kn[Kn.length - 1].version;
|
|
2563
|
-
let
|
|
2563
|
+
let ze = Be;
|
|
2564
2564
|
const Sc = 512;
|
|
2565
2565
|
function wc(t, e) {
|
|
2566
2566
|
return (t + e) * Sc;
|
|
@@ -2580,13 +2580,31 @@ const Ar = {
|
|
|
2580
2580
|
// BIGFONT SHX stays available via glyph fallback for CJK coverage.
|
|
2581
2581
|
modern: ["simsun", "hztxt"],
|
|
2582
2582
|
international: ["txt", "simplex", "romans", "simsun"],
|
|
2583
|
-
|
|
2583
|
+
// Full CJK: mesh faces for CN/KR/JP, then matching SHX big fonts.
|
|
2584
|
+
// `malgun` → Noto Sans KR; `msgothic` → MS Gothic in the font repository.
|
|
2585
|
+
cjk: [
|
|
2586
|
+
"simsun",
|
|
2587
|
+
"malgun",
|
|
2588
|
+
"msgothic",
|
|
2589
|
+
"gbcbig",
|
|
2590
|
+
"hztxt",
|
|
2591
|
+
"extfont2",
|
|
2592
|
+
"extfont",
|
|
2593
|
+
"whgtxt",
|
|
2594
|
+
"whgdtxt"
|
|
2595
|
+
],
|
|
2596
|
+
chinese: ["simsun", "gbcbig", "hztxt"],
|
|
2597
|
+
korean: ["malgun", "whgtxt", "whgdtxt"],
|
|
2598
|
+
japanese: ["msgothic", "extfont2", "extfont"]
|
|
2584
2599
|
}, Zn = {
|
|
2585
2600
|
minimal: ["simplex", "amgdt"],
|
|
2586
2601
|
r12r14: ["simplex", "amgdt"],
|
|
2587
2602
|
modern: ["simplex", "amgdt"],
|
|
2588
2603
|
international: ["simplex", "amgdt"],
|
|
2589
|
-
cjk: ["simplex", "amgdt"]
|
|
2604
|
+
cjk: ["simplex", "amgdt"],
|
|
2605
|
+
chinese: ["simplex", "amgdt"],
|
|
2606
|
+
korean: ["simplex", "amgdt"],
|
|
2607
|
+
japanese: ["simplex", "amgdt"]
|
|
2590
2608
|
};
|
|
2591
2609
|
function ks(t) {
|
|
2592
2610
|
return Object.prototype.hasOwnProperty.call(Ar, t);
|
|
@@ -2618,7 +2636,7 @@ var ma = new Jt(), ya = new Jt(), Vr = new Uint8Array(30), qr = new Uint16Array(
|
|
|
2618
2636
|
14,
|
|
2619
2637
|
1,
|
|
2620
2638
|
15
|
|
2621
|
-
]), Es = new Jt(),
|
|
2639
|
+
]), Es = new Jt(), $e = new Uint8Array(320);
|
|
2622
2640
|
function va(t, e, n, r) {
|
|
2623
2641
|
var s, i;
|
|
2624
2642
|
for (s = 0; s < n; ++s) t[s] = 0;
|
|
@@ -2651,7 +2669,7 @@ function Ac(t) {
|
|
|
2651
2669
|
var e = t.tag & 1;
|
|
2652
2670
|
return t.tag >>>= 1, e;
|
|
2653
2671
|
}
|
|
2654
|
-
function
|
|
2672
|
+
function Xe(t, e, n) {
|
|
2655
2673
|
if (!e)
|
|
2656
2674
|
return n;
|
|
2657
2675
|
for (; t.bitcount < 24; )
|
|
@@ -2670,33 +2688,33 @@ function Or(t, e) {
|
|
|
2670
2688
|
}
|
|
2671
2689
|
function Oc(t, e, n) {
|
|
2672
2690
|
var r, s, i, a, o, c;
|
|
2673
|
-
for (r =
|
|
2691
|
+
for (r = Xe(t, 5, 257), s = Xe(t, 5, 1), i = Xe(t, 4, 4), a = 0; a < 19; ++a) $e[a] = 0;
|
|
2674
2692
|
for (a = 0; a < i; ++a) {
|
|
2675
|
-
var l =
|
|
2676
|
-
|
|
2693
|
+
var l = Xe(t, 3, 0);
|
|
2694
|
+
$e[kc[a]] = l;
|
|
2677
2695
|
}
|
|
2678
|
-
for (Jn(Es,
|
|
2696
|
+
for (Jn(Es, $e, 0, 19), o = 0; o < r + s; ) {
|
|
2679
2697
|
var u = Or(t, Es);
|
|
2680
2698
|
switch (u) {
|
|
2681
2699
|
case 16:
|
|
2682
|
-
var f =
|
|
2683
|
-
for (c =
|
|
2684
|
-
|
|
2700
|
+
var f = $e[o - 1];
|
|
2701
|
+
for (c = Xe(t, 2, 3); c; --c)
|
|
2702
|
+
$e[o++] = f;
|
|
2685
2703
|
break;
|
|
2686
2704
|
case 17:
|
|
2687
|
-
for (c =
|
|
2688
|
-
|
|
2705
|
+
for (c = Xe(t, 3, 3); c; --c)
|
|
2706
|
+
$e[o++] = 0;
|
|
2689
2707
|
break;
|
|
2690
2708
|
case 18:
|
|
2691
|
-
for (c =
|
|
2692
|
-
|
|
2709
|
+
for (c = Xe(t, 7, 11); c; --c)
|
|
2710
|
+
$e[o++] = 0;
|
|
2693
2711
|
break;
|
|
2694
2712
|
default:
|
|
2695
|
-
|
|
2713
|
+
$e[o++] = u;
|
|
2696
2714
|
break;
|
|
2697
2715
|
}
|
|
2698
2716
|
}
|
|
2699
|
-
Jn(e,
|
|
2717
|
+
Jn(e, $e, 0, r), Jn(n, $e, r, s);
|
|
2700
2718
|
}
|
|
2701
2719
|
function Os(t, e, n) {
|
|
2702
2720
|
for (; ; ) {
|
|
@@ -2707,7 +2725,7 @@ function Os(t, e, n) {
|
|
|
2707
2725
|
t.dest[t.destLen++] = r;
|
|
2708
2726
|
else {
|
|
2709
2727
|
var s, i, a, o;
|
|
2710
|
-
for (r -= 257, s =
|
|
2728
|
+
for (r -= 257, s = Xe(t, Vr[r], qr[r]), i = Or(t, n), a = t.destLen - Xe(t, ba[i], xa[i]), o = a; o < a + s; ++o)
|
|
2711
2729
|
t.dest[t.destLen++] = t.dest[o];
|
|
2712
2730
|
}
|
|
2713
2731
|
}
|
|
@@ -2724,7 +2742,7 @@ function Lc(t) {
|
|
|
2724
2742
|
function Sa(t, e) {
|
|
2725
2743
|
var n = new Fc(t, e), r, s, i;
|
|
2726
2744
|
do {
|
|
2727
|
-
switch (r = Ac(n), s =
|
|
2745
|
+
switch (r = Ac(n), s = Xe(n, 2, 0), s) {
|
|
2728
2746
|
case 0:
|
|
2729
2747
|
i = Lc(n);
|
|
2730
2748
|
break;
|
|
@@ -3090,7 +3108,7 @@ function Ls(t, e) {
|
|
|
3090
3108
|
t || Fa(e);
|
|
3091
3109
|
}
|
|
3092
3110
|
var H = { fail: Fa, argument: Ls, assert: Ls }, Is = 32768, Rs = 2147483648, Bc = -32768, Mc = 32767 + 1 / 65536, Nt = {}, B = {}, z = {};
|
|
3093
|
-
function
|
|
3111
|
+
function je(t) {
|
|
3094
3112
|
return function() {
|
|
3095
3113
|
return t;
|
|
3096
3114
|
};
|
|
@@ -3098,11 +3116,11 @@ function qe(t) {
|
|
|
3098
3116
|
B.BYTE = function(t) {
|
|
3099
3117
|
return H.argument(t >= 0 && t <= 255, "Byte value should be between 0 and 255."), [t];
|
|
3100
3118
|
};
|
|
3101
|
-
z.BYTE =
|
|
3119
|
+
z.BYTE = je(1);
|
|
3102
3120
|
B.CHAR = function(t) {
|
|
3103
3121
|
return [t.charCodeAt(0)];
|
|
3104
3122
|
};
|
|
3105
|
-
z.CHAR =
|
|
3123
|
+
z.CHAR = je(1);
|
|
3106
3124
|
B.CHARARRAY = function(t) {
|
|
3107
3125
|
(t === null || typeof t > "u") && (t = "", console.warn("CHARARRAY with undefined or null value encountered and treated as an empty string. This is probably caused by a missing glyph name."));
|
|
3108
3126
|
const e = [];
|
|
@@ -3116,23 +3134,23 @@ z.CHARARRAY = function(t) {
|
|
|
3116
3134
|
B.USHORT = function(t) {
|
|
3117
3135
|
return [t >> 8 & 255, t & 255];
|
|
3118
3136
|
};
|
|
3119
|
-
z.USHORT =
|
|
3137
|
+
z.USHORT = je(2);
|
|
3120
3138
|
B.SHORT = function(t) {
|
|
3121
3139
|
return t >= Is && (t = -(2 * Is - t)), [t >> 8 & 255, t & 255];
|
|
3122
3140
|
};
|
|
3123
|
-
z.SHORT =
|
|
3141
|
+
z.SHORT = je(2);
|
|
3124
3142
|
B.UINT24 = function(t) {
|
|
3125
3143
|
return [t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
3126
3144
|
};
|
|
3127
|
-
z.UINT24 =
|
|
3145
|
+
z.UINT24 = je(3);
|
|
3128
3146
|
B.ULONG = function(t) {
|
|
3129
3147
|
return [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
3130
3148
|
};
|
|
3131
|
-
z.ULONG =
|
|
3149
|
+
z.ULONG = je(4);
|
|
3132
3150
|
B.LONG = function(t) {
|
|
3133
3151
|
return t >= Rs && (t = -(2 * Rs - t)), [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
3134
3152
|
};
|
|
3135
|
-
z.LONG =
|
|
3153
|
+
z.LONG = je(4);
|
|
3136
3154
|
B.FLOAT = function(t) {
|
|
3137
3155
|
if (t > Mc || t < Bc)
|
|
3138
3156
|
throw new Error(`Value ${t} is outside the range of representable values in 16.16 format`);
|
|
@@ -3153,7 +3171,7 @@ z.F2DOT14 = z.USHORT;
|
|
|
3153
3171
|
B.LONGDATETIME = function(t) {
|
|
3154
3172
|
return [0, 0, 0, 0, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
3155
3173
|
};
|
|
3156
|
-
z.LONGDATETIME =
|
|
3174
|
+
z.LONGDATETIME = je(8);
|
|
3157
3175
|
B.TAG = function(t) {
|
|
3158
3176
|
return H.argument(t.length === 4, "Tag should be exactly 4 ASCII characters."), [
|
|
3159
3177
|
t.charCodeAt(0),
|
|
@@ -3162,7 +3180,7 @@ B.TAG = function(t) {
|
|
|
3162
3180
|
t.charCodeAt(3)
|
|
3163
3181
|
];
|
|
3164
3182
|
};
|
|
3165
|
-
z.TAG =
|
|
3183
|
+
z.TAG = je(4);
|
|
3166
3184
|
B.Card8 = B.BYTE;
|
|
3167
3185
|
z.Card8 = z.BYTE;
|
|
3168
3186
|
B.Card16 = B.USHORT;
|
|
@@ -3180,11 +3198,11 @@ z.NUMBER = function(t) {
|
|
|
3180
3198
|
B.NUMBER16 = function(t) {
|
|
3181
3199
|
return [28, t >> 8 & 255, t & 255];
|
|
3182
3200
|
};
|
|
3183
|
-
z.NUMBER16 =
|
|
3201
|
+
z.NUMBER16 = je(3);
|
|
3184
3202
|
B.NUMBER32 = function(t) {
|
|
3185
3203
|
return [29, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
3186
3204
|
};
|
|
3187
|
-
z.NUMBER32 =
|
|
3205
|
+
z.NUMBER32 = je(5);
|
|
3188
3206
|
B.REAL = function(t) {
|
|
3189
3207
|
let e = t.toString();
|
|
3190
3208
|
const n = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);
|
|
@@ -7109,7 +7127,7 @@ function Xr(t, e, n = 0, r = "hexa") {
|
|
|
7109
7127
|
const a = _a(s.colorRecords[i]);
|
|
7110
7128
|
return r === "bgra" ? a : zt(a, r);
|
|
7111
7129
|
}
|
|
7112
|
-
function
|
|
7130
|
+
function We(t) {
|
|
7113
7131
|
return ("0" + parseInt(t).toString(16)).slice(-2);
|
|
7114
7132
|
}
|
|
7115
7133
|
function xl(t) {
|
|
@@ -7151,7 +7169,7 @@ function vl(t) {
|
|
|
7151
7169
|
};
|
|
7152
7170
|
}
|
|
7153
7171
|
function Ua(t) {
|
|
7154
|
-
return parseInt(`0x${
|
|
7172
|
+
return parseInt(`0x${We(t.b)}${We(t.g)}${We(t.r)}${We(t.a * 255)}`, 16);
|
|
7155
7173
|
}
|
|
7156
7174
|
function Dn(t, e = "hexa") {
|
|
7157
7175
|
const n = e == "raw" || e == "cpal", r = Number.isInteger(t);
|
|
@@ -7250,11 +7268,11 @@ function zt(t, e = "hexa") {
|
|
|
7250
7268
|
case "hex":
|
|
7251
7269
|
case "hex6":
|
|
7252
7270
|
case "hex-6":
|
|
7253
|
-
return `#${
|
|
7271
|
+
return `#${We(t.r)}${We(t.g)}${We(t.b)}`;
|
|
7254
7272
|
case "hexa":
|
|
7255
7273
|
case "hex8":
|
|
7256
7274
|
case "hex-8":
|
|
7257
|
-
return `#${
|
|
7275
|
+
return `#${We(t.r)}${We(t.g)}${We(t.b)}${We(t.a * 255)}`;
|
|
7258
7276
|
case "hsl":
|
|
7259
7277
|
return `hsl(${n.h.toFixed(2)}, ${n.s.toFixed(2)}%, ${n.l.toFixed(2)}%)`;
|
|
7260
7278
|
case "hsla":
|
|
@@ -7507,7 +7525,7 @@ function Tl(t, e, n, r, s) {
|
|
|
7507
7525
|
}, i;
|
|
7508
7526
|
};
|
|
7509
7527
|
}
|
|
7510
|
-
var
|
|
7528
|
+
var Qe = { GlyphSet: zn, glyphLoader: wl, ttfGlyphLoader: Cl, cffGlyphLoader: Tl };
|
|
7511
7529
|
function Na(t, e) {
|
|
7512
7530
|
if (t === e)
|
|
7513
7531
|
return !0;
|
|
@@ -7526,7 +7544,7 @@ function _n(t) {
|
|
|
7526
7544
|
let e;
|
|
7527
7545
|
return t.length < 1240 ? e = 107 : t.length < 33900 ? e = 1131 : e = 32768, e;
|
|
7528
7546
|
}
|
|
7529
|
-
function
|
|
7547
|
+
function Ye(t, e, n, r) {
|
|
7530
7548
|
const s = [], i = [], a = r > 1 ? D.getULong(t, e) : D.getCard16(t, e), o = r > 1 ? 4 : 2;
|
|
7531
7549
|
let c, l;
|
|
7532
7550
|
if (a !== 0) {
|
|
@@ -7739,7 +7757,7 @@ function _l(t, e, n) {
|
|
|
7739
7757
|
if (o !== 0 && c !== 0) {
|
|
7740
7758
|
const l = Jr(t, c + e, o, [], 2);
|
|
7741
7759
|
if (l.subrs) {
|
|
7742
|
-
const u = c + l.subrs, f =
|
|
7760
|
+
const u = c + l.subrs, f = Ye(t, u + e, void 0, 2);
|
|
7743
7761
|
a._subrs = f.objects, a._subrsBias = _n(a._subrs);
|
|
7744
7762
|
}
|
|
7745
7763
|
a._privateDict = l;
|
|
@@ -7757,7 +7775,7 @@ function Qn(t, e, n, r, s) {
|
|
|
7757
7775
|
if (l !== 0 && u !== 0) {
|
|
7758
7776
|
const f = Jr(t, u + e, l, r, s);
|
|
7759
7777
|
if (c._defaultWidthX = f.defaultWidthX, c._nominalWidthX = f.nominalWidthX, f.subrs !== 0) {
|
|
7760
|
-
const h = u + f.subrs, p =
|
|
7778
|
+
const h = u + f.subrs, p = Ye(t, h + e, void 0, s);
|
|
7761
7779
|
c._subrs = p.objects, c._subrsBias = _n(c._subrs);
|
|
7762
7780
|
}
|
|
7763
7781
|
c._privateDict = f;
|
|
@@ -7840,7 +7858,7 @@ function Mr(t, e, n, r, s) {
|
|
|
7840
7858
|
M = (u.length & 1) !== 0, M && !h && (N = u.shift() + C), f += u.length >> 1, u.length = 0, h = !0;
|
|
7841
7859
|
}
|
|
7842
7860
|
function U(M) {
|
|
7843
|
-
let _, re, Te,
|
|
7861
|
+
let _, re, Te, et, _e, me, Y, ne, pe, be, ge, ye, ce = 0;
|
|
7844
7862
|
for (; ce < M.length; ) {
|
|
7845
7863
|
let ve = M[ce];
|
|
7846
7864
|
switch (ce += 1, ve) {
|
|
@@ -7908,10 +7926,10 @@ function Mr(t, e, n, r, s) {
|
|
|
7908
7926
|
break;
|
|
7909
7927
|
}
|
|
7910
7928
|
if (u.length >= 4) {
|
|
7911
|
-
const
|
|
7912
|
-
if (
|
|
7929
|
+
const tt = Br[u.pop()], x = Br[u.pop()], d = u.pop(), g = u.pop();
|
|
7930
|
+
if (tt && x) {
|
|
7913
7931
|
e.isComposite = !0, e.components = [];
|
|
7914
|
-
const S = t.cffEncoding.charset.indexOf(
|
|
7932
|
+
const S = t.cffEncoding.charset.indexOf(tt), k = t.cffEncoding.charset.indexOf(x);
|
|
7915
7933
|
e.components.push({
|
|
7916
7934
|
glyphIndex: k,
|
|
7917
7935
|
dx: 0,
|
|
@@ -7946,11 +7964,11 @@ function Mr(t, e, n, r, s) {
|
|
|
7946
7964
|
R || (R = t.variation && s && t.variation.process.getBlendVector(E, T, s));
|
|
7947
7965
|
var Z = u.pop(), xe = R ? R.length : E.itemVariationSubtables[T].regionIndexes.length, Ee = Z * xe, Ae = u.length - Ee, Oe = Ae - Z;
|
|
7948
7966
|
if (R)
|
|
7949
|
-
for (let
|
|
7950
|
-
var Re = u[Oe +
|
|
7967
|
+
for (let tt = 0; tt < Z; tt++) {
|
|
7968
|
+
var Re = u[Oe + tt];
|
|
7951
7969
|
for (let x = 0; x < xe; x++)
|
|
7952
7970
|
Re += R[x] * u[Ae++];
|
|
7953
|
-
u[Oe +
|
|
7971
|
+
u[Oe + tt] = Re;
|
|
7954
7972
|
}
|
|
7955
7973
|
for (; Ee--; )
|
|
7956
7974
|
u.pop();
|
|
@@ -8010,7 +8028,7 @@ function Mr(t, e, n, r, s) {
|
|
|
8010
8028
|
i = y, a = m + u.shift(), o = i + u.shift(), c = a + u.shift(), y = o + u.shift(), m = c + (u.length === 1 ? u.shift() : 0), l.curveTo(i, a, o, c, y, m);
|
|
8011
8029
|
break;
|
|
8012
8030
|
default:
|
|
8013
|
-
ve < 32 ? console.log("Glyph " + e.index + ": unknown operator " + ve) : ve < 247 ? u.push(ve - 139) : ve < 251 ? (_ = M[ce], ce += 1, u.push((ve - 247) * 256 + _ + 108)) : ve < 255 ? (_ = M[ce], ce += 1, u.push(-(ve - 251) * 256 - _ - 108)) : (_ = M[ce], re = M[ce + 1], Te = M[ce + 2],
|
|
8031
|
+
ve < 32 ? console.log("Glyph " + e.index + ": unknown operator " + ve) : ve < 247 ? u.push(ve - 139) : ve < 251 ? (_ = M[ce], ce += 1, u.push((ve - 247) * 256 + _ + 108)) : ve < 255 ? (_ = M[ce], ce += 1, u.push(-(ve - 251) * 256 - _ - 108)) : (_ = M[ce], re = M[ce + 1], Te = M[ce + 2], et = M[ce + 3], ce += 4, u.push((_ << 24 | re << 16 | Te << 8 | et) / 65536));
|
|
8014
8032
|
}
|
|
8015
8033
|
}
|
|
8016
8034
|
}
|
|
@@ -8058,7 +8076,7 @@ function Gl(t, e, n, r) {
|
|
|
8058
8076
|
let s;
|
|
8059
8077
|
const i = Ll(t, e);
|
|
8060
8078
|
i.formatMajor === 2 ? s = n.tables.cff2 = {} : s = n.tables.cff = {};
|
|
8061
|
-
const a = i.formatMajor > 1 ? null :
|
|
8079
|
+
const a = i.formatMajor > 1 ? null : Ye(t, i.endOffset, D.bytesToString), o = i.formatMajor > 1 ? null : Ye(t, a.endOffset), c = i.formatMajor > 1 ? null : Ye(t, o.endOffset, D.bytesToString), l = Ye(t, i.formatMajor > 1 ? e + i.size + i.topDictLength : c.endOffset, void 0, i.formatMajor);
|
|
8062
8080
|
n.gsubrs = l.objects, n.gsubrsBias = _n(n.gsubrs);
|
|
8063
8081
|
let u;
|
|
8064
8082
|
if (i.formatMajor > 1) {
|
|
@@ -8074,38 +8092,38 @@ function Gl(t, e, n, r) {
|
|
|
8074
8092
|
let h = u.fdArray, p = u.fdSelect;
|
|
8075
8093
|
if (!h)
|
|
8076
8094
|
throw new Error("This is a CFF2 font, but FDArray information is missing");
|
|
8077
|
-
const y =
|
|
8095
|
+
const y = Ye(t, e + h, null, i.formatMajor), m = _l(t, e, y.objects);
|
|
8078
8096
|
u._fdArray = m, p && (u._fdSelect = Ps(t, e + p, n.numGlyphs, m.length, i.formatMajor));
|
|
8079
8097
|
} else if (n.isCIDFont) {
|
|
8080
8098
|
let h = u.fdArray, p = u.fdSelect;
|
|
8081
8099
|
if (h === 0 || p === 0)
|
|
8082
8100
|
throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");
|
|
8083
8101
|
h += e;
|
|
8084
|
-
const y =
|
|
8102
|
+
const y = Ye(t, h), m = Qn(t, e, y.objects, c.objects, i.formatMajor);
|
|
8085
8103
|
u._fdArray = m, p += e, u._fdSelect = Ps(t, p, n.numGlyphs, m.length, i.formatMajor);
|
|
8086
8104
|
}
|
|
8087
8105
|
if (i.formatMajor < 2) {
|
|
8088
8106
|
const h = e + u.private[1], p = Jr(t, h, u.private[0], c.objects, i.formatMajor);
|
|
8089
8107
|
if (n.defaultWidthX = p.defaultWidthX, n.nominalWidthX = p.nominalWidthX, p.subrs !== 0) {
|
|
8090
|
-
const y = h + p.subrs, m =
|
|
8108
|
+
const y = h + p.subrs, m = Ye(t, y);
|
|
8091
8109
|
n.subrs = m.objects, n.subrsBias = _n(n.subrs);
|
|
8092
8110
|
} else
|
|
8093
8111
|
n.subrs = [], n.subrsBias = 0;
|
|
8094
8112
|
}
|
|
8095
8113
|
let f;
|
|
8096
|
-
if (r.lowMemory ? (f = Fl(t, e + u.charStrings, i.formatMajor), n.nGlyphs = f.offsets.length - (i.formatMajor > 1 ? 1 : 0)) : (f =
|
|
8114
|
+
if (r.lowMemory ? (f = Fl(t, e + u.charStrings, i.formatMajor), n.nGlyphs = f.offsets.length - (i.formatMajor > 1 ? 1 : 0)) : (f = Ye(t, e + u.charStrings, null, i.formatMajor), n.nGlyphs = f.objects.length), i.formatMajor > 1 && n.tables.maxp && n.nGlyphs !== n.tables.maxp.numGlyphs && console.error(`Glyph count in the CFF2 table (${n.nGlyphs}) must correspond to the glyph count in the maxp table (${n.tables.maxp.numGlyphs})`), i.formatMajor < 2) {
|
|
8097
8115
|
let h = [], p = [];
|
|
8098
8116
|
u.charset === 0 ? h = ll : u.charset === 1 ? h = ul : u.charset === 2 ? h = hl : h = Ul(t, e + u.charset, n.nGlyphs, c.objects, n.isCIDFont), u.encoding === 0 ? p = Br : u.encoding === 1 ? p = fl : p = Pl(t, e + u.encoding), n.cffEncoding = new Da(p, h), n.encoding = n.encoding || n.cffEncoding;
|
|
8099
8117
|
}
|
|
8100
|
-
if (n.glyphs = new
|
|
8118
|
+
if (n.glyphs = new Qe.GlyphSet(n), r.lowMemory)
|
|
8101
8119
|
n._push = function(h) {
|
|
8102
8120
|
const p = kl(h, f.offsets, t, e + u.charStrings, void 0, i.formatMajor);
|
|
8103
|
-
n.glyphs.push(h,
|
|
8121
|
+
n.glyphs.push(h, Qe.cffGlyphLoader(n, h, Mr, p, i.formatMajor));
|
|
8104
8122
|
};
|
|
8105
8123
|
else
|
|
8106
8124
|
for (let h = 0; h < n.nGlyphs; h += 1) {
|
|
8107
8125
|
const p = f.objects[h];
|
|
8108
|
-
n.glyphs.push(h,
|
|
8126
|
+
n.glyphs.push(h, Qe.cffGlyphLoader(n, h, Mr, p, i.formatMajor));
|
|
8109
8127
|
}
|
|
8110
8128
|
if (u.vstore) {
|
|
8111
8129
|
const h = new D.Parser(t, e + u.vstore);
|
|
@@ -8743,8 +8761,8 @@ function fu(t) {
|
|
|
8743
8761
|
{ name: "maxMemType1", type: "ULONG", value: c }
|
|
8744
8762
|
]);
|
|
8745
8763
|
}
|
|
8746
|
-
var Ka = { parse: hu, make: fu },
|
|
8747
|
-
|
|
8764
|
+
var Ka = { parse: hu, make: fu }, Ve = new Array(9);
|
|
8765
|
+
Ve[1] = function() {
|
|
8748
8766
|
const e = this.offset + this.relativeOffset, n = this.parseUShort();
|
|
8749
8767
|
if (n === 1)
|
|
8750
8768
|
return {
|
|
@@ -8760,7 +8778,7 @@ We[1] = function() {
|
|
|
8760
8778
|
};
|
|
8761
8779
|
H.assert(!1, "0x" + e.toString(16) + ": lookup type 1 format must be 1 or 2.");
|
|
8762
8780
|
};
|
|
8763
|
-
|
|
8781
|
+
Ve[2] = function() {
|
|
8764
8782
|
const e = this.parseUShort();
|
|
8765
8783
|
return H.argument(e === 1, "GSUB Multiple Substitution Subtable identifier-format must be 1"), {
|
|
8766
8784
|
substFormat: e,
|
|
@@ -8768,7 +8786,7 @@ We[2] = function() {
|
|
|
8768
8786
|
sequences: this.parseListOfLists()
|
|
8769
8787
|
};
|
|
8770
8788
|
};
|
|
8771
|
-
|
|
8789
|
+
Ve[3] = function() {
|
|
8772
8790
|
const e = this.parseUShort();
|
|
8773
8791
|
return H.argument(e === 1, "GSUB Alternate Substitution Subtable identifier-format must be 1"), {
|
|
8774
8792
|
substFormat: e,
|
|
@@ -8776,7 +8794,7 @@ We[3] = function() {
|
|
|
8776
8794
|
alternateSets: this.parseListOfLists()
|
|
8777
8795
|
};
|
|
8778
8796
|
};
|
|
8779
|
-
|
|
8797
|
+
Ve[4] = function() {
|
|
8780
8798
|
const e = this.parseUShort();
|
|
8781
8799
|
return H.argument(e === 1, "GSUB ligature table identifier-format must be 1"), {
|
|
8782
8800
|
substFormat: e,
|
|
@@ -8793,7 +8811,7 @@ var Mt = {
|
|
|
8793
8811
|
sequenceIndex: F.uShort,
|
|
8794
8812
|
lookupListIndex: F.uShort
|
|
8795
8813
|
};
|
|
8796
|
-
|
|
8814
|
+
Ve[5] = function() {
|
|
8797
8815
|
const e = this.offset + this.relativeOffset, n = this.parseUShort();
|
|
8798
8816
|
if (n === 1)
|
|
8799
8817
|
return {
|
|
@@ -8830,7 +8848,7 @@ We[5] = function() {
|
|
|
8830
8848
|
}
|
|
8831
8849
|
H.assert(!1, "0x" + e.toString(16) + ": lookup type 5 format must be 1, 2 or 3.");
|
|
8832
8850
|
};
|
|
8833
|
-
|
|
8851
|
+
Ve[6] = function() {
|
|
8834
8852
|
const e = this.offset + this.relativeOffset, n = this.parseUShort();
|
|
8835
8853
|
if (n === 1)
|
|
8836
8854
|
return {
|
|
@@ -8871,17 +8889,17 @@ We[6] = function() {
|
|
|
8871
8889
|
};
|
|
8872
8890
|
H.assert(!1, "0x" + e.toString(16) + ": lookup type 6 format must be 1, 2 or 3.");
|
|
8873
8891
|
};
|
|
8874
|
-
|
|
8892
|
+
Ve[7] = function() {
|
|
8875
8893
|
const e = this.parseUShort();
|
|
8876
8894
|
H.argument(e === 1, "GSUB Extension Substitution subtable identifier-format must be 1");
|
|
8877
8895
|
const n = this.parseUShort(), r = new F(this.data, this.offset + this.parseULong());
|
|
8878
8896
|
return {
|
|
8879
8897
|
substFormat: 1,
|
|
8880
8898
|
lookupType: n,
|
|
8881
|
-
extension:
|
|
8899
|
+
extension: Ve[n].call(r)
|
|
8882
8900
|
};
|
|
8883
8901
|
};
|
|
8884
|
-
|
|
8902
|
+
Ve[8] = function() {
|
|
8885
8903
|
const e = this.parseUShort();
|
|
8886
8904
|
return H.argument(e === 1, "GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"), {
|
|
8887
8905
|
substFormat: e,
|
|
@@ -8898,12 +8916,12 @@ function pu(t, e) {
|
|
|
8898
8916
|
version: r,
|
|
8899
8917
|
scripts: n.parseScriptList(),
|
|
8900
8918
|
features: n.parseFeatureList(),
|
|
8901
|
-
lookups: n.parseLookupList(
|
|
8919
|
+
lookups: n.parseLookupList(Ve)
|
|
8902
8920
|
} : {
|
|
8903
8921
|
version: r,
|
|
8904
8922
|
scripts: n.parseScriptList(),
|
|
8905
8923
|
features: n.parseFeatureList(),
|
|
8906
|
-
lookups: n.parseLookupList(
|
|
8924
|
+
lookups: n.parseLookupList(Ve),
|
|
8907
8925
|
variations: n.parseFeatureVariationsList()
|
|
8908
8926
|
};
|
|
8909
8927
|
}
|
|
@@ -9680,7 +9698,7 @@ function Vu(t) {
|
|
|
9680
9698
|
N[Z].postScriptName || (N[Z].postScriptName = { en: j });
|
|
9681
9699
|
}
|
|
9682
9700
|
N.unicode.preferredFamily || (N.unicode.preferredFamily = X.fontFamily || ie.fontFamily || U.fontFamily), N.macintosh.preferredFamily || (N.macintosh.preferredFamily = ie.fontFamily || X.fontFamily || U.fontFamily), N.windows.preferredFamily || (N.windows.preferredFamily = U.fontFamily || X.fontFamily || ie.fontFamily), N.unicode.preferredSubfamily || (N.unicode.preferredSubfamily = X.fontSubfamily || ie.fontSubfamily || U.fontSubfamily), N.macintosh.preferredSubfamily || (N.macintosh.preferredSubfamily = ie.fontSubfamily || X.fontSubfamily || U.fontSubfamily), N.windows.preferredSubfamily || (N.windows.preferredSubfamily = U.fontSubfamily || X.fontSubfamily || ie.fontSubfamily);
|
|
9683
|
-
const M = [], _ = Ia.make(N, M), re = M.length > 0 ? Ya.make(M) : void 0, Te = Ka.make(t),
|
|
9701
|
+
const M = [], _ = Ia.make(N, M), re = M.length > 0 ? Ya.make(M) : void 0, Te = Ka.make(t), et = Dr.make(t.glyphs, {
|
|
9684
9702
|
version: t.getEnglishName("version"),
|
|
9685
9703
|
fullName: W,
|
|
9686
9704
|
familyName: R,
|
|
@@ -9689,7 +9707,7 @@ function Vu(t) {
|
|
|
9689
9707
|
unitsPerEm: t.unitsPerEm,
|
|
9690
9708
|
fontBBox: [0, y.yMin, y.ascender, y.advanceWidthMax],
|
|
9691
9709
|
topDict: t.tables.cff && t.tables.cff.topDict || {}
|
|
9692
|
-
}), _e = t.metas && Object.keys(t.metas).length > 0 ? Ja.make(t.metas) : void 0, me = [b, v, w, C, _, E, Te,
|
|
9710
|
+
}), _e = t.metas && Object.keys(t.metas).length > 0 ? Ja.make(t.metas) : void 0, me = [b, v, w, C, _, E, Te, et, T];
|
|
9693
9711
|
re && me.push(re);
|
|
9694
9712
|
const Y = {
|
|
9695
9713
|
gsub: Za,
|
|
@@ -10877,18 +10895,18 @@ function fo(t, e) {
|
|
|
10877
10895
|
return ts(e.points);
|
|
10878
10896
|
}
|
|
10879
10897
|
function uh(t, e, n, r) {
|
|
10880
|
-
const s = new
|
|
10898
|
+
const s = new Qe.GlyphSet(r);
|
|
10881
10899
|
for (let i = 0; i < n.length - 1; i += 1) {
|
|
10882
10900
|
const a = n[i], o = n[i + 1];
|
|
10883
|
-
a !== o ? s.push(i,
|
|
10901
|
+
a !== o ? s.push(i, Qe.ttfGlyphLoader(r, i, ho, t, e + a, fo)) : s.push(i, Qe.glyphLoader(r, i));
|
|
10884
10902
|
}
|
|
10885
10903
|
return s;
|
|
10886
10904
|
}
|
|
10887
10905
|
function hh(t, e, n, r) {
|
|
10888
|
-
const s = new
|
|
10906
|
+
const s = new Qe.GlyphSet(r);
|
|
10889
10907
|
return r._push = function(i) {
|
|
10890
10908
|
const a = n[i], o = n[i + 1];
|
|
10891
|
-
a !== o ? s.push(i,
|
|
10909
|
+
a !== o ? s.push(i, Qe.ttfGlyphLoader(r, i, ho, t, e + a, fo)) : s.push(i, Qe.glyphLoader(r, i));
|
|
10892
10910
|
}, s;
|
|
10893
10911
|
}
|
|
10894
10912
|
function fh(t, e, n, r, s) {
|
|
@@ -11368,7 +11386,7 @@ var xo = function(t) {
|
|
|
11368
11386
|
const r = this.srThreshold;
|
|
11369
11387
|
let s = 1;
|
|
11370
11388
|
return t < 0 && (t = -t, s = -1), t += r - n, t = Math.trunc(t / e) * e, t += n, t < 0 ? n * s : t * s;
|
|
11371
|
-
},
|
|
11389
|
+
}, Je = {
|
|
11372
11390
|
x: 1,
|
|
11373
11391
|
y: 0,
|
|
11374
11392
|
axis: "x",
|
|
@@ -11393,10 +11411,10 @@ var xo = function(t) {
|
|
|
11393
11411
|
return;
|
|
11394
11412
|
}
|
|
11395
11413
|
if (s = r.distance(t, e, !0, !0), i = r.distance(t, n, !0, !0), c = r.distance(e, e, !1, !0), l = r.distance(n, n, !1, !0), a = Math.abs(s), o = Math.abs(i), u = a + o, u === 0) {
|
|
11396
|
-
|
|
11414
|
+
Je.setRelative(t, t, (c + l) / 2, r, !0);
|
|
11397
11415
|
return;
|
|
11398
11416
|
}
|
|
11399
|
-
|
|
11417
|
+
Je.setRelative(t, t, (c * o + l * a) / u, r, !0);
|
|
11400
11418
|
},
|
|
11401
11419
|
// Slope of line normal to this
|
|
11402
11420
|
normalSlope: Number.NEGATIVE_INFINITY,
|
|
@@ -11497,13 +11515,13 @@ var xo = function(t) {
|
|
|
11497
11515
|
t.yTouched = !1;
|
|
11498
11516
|
}
|
|
11499
11517
|
};
|
|
11500
|
-
Object.freeze(
|
|
11518
|
+
Object.freeze(Je);
|
|
11501
11519
|
Object.freeze(it);
|
|
11502
11520
|
function an(t, e) {
|
|
11503
11521
|
this.x = t, this.y = e, this.axis = void 0, this.slope = e / t, this.normalSlope = -t / e, Object.freeze(this);
|
|
11504
11522
|
}
|
|
11505
11523
|
an.prototype.distance = function(t, e, n, r) {
|
|
11506
|
-
return this.x *
|
|
11524
|
+
return this.x * Je.distance(t, e, n, r) + this.y * it.distance(t, e, n, r);
|
|
11507
11525
|
};
|
|
11508
11526
|
an.prototype.interpolate = function(t, e, n, r) {
|
|
11509
11527
|
let s, i, a, o, c, l, u;
|
|
@@ -11523,7 +11541,7 @@ an.prototype.touch = function(t) {
|
|
|
11523
11541
|
};
|
|
11524
11542
|
function on(t, e) {
|
|
11525
11543
|
const n = Math.sqrt(t * t + e * e);
|
|
11526
|
-
return t /= n, e /= n, t === 1 && e === 0 ?
|
|
11544
|
+
return t /= n, e /= n, t === 1 && e === 0 ? Je : t === 0 && e === 1 ? it : new an(t, e);
|
|
11527
11545
|
}
|
|
11528
11546
|
function at(t, e, n, r) {
|
|
11529
11547
|
this.x = this.xo = Math.round(t * 64) / 64, this.y = this.yo = Math.round(e * 64) / 64, this.lastPointOfContour = n, this.onCurve = r, this.prevPointOnContour = void 0, this.nextPointOnContour = void 0, this.xTouched = !1, this.yTouched = !1, Object.preventExtensions(this);
|
|
@@ -11554,7 +11572,7 @@ function pt(t, e) {
|
|
|
11554
11572
|
case "glyf":
|
|
11555
11573
|
this.zp0 = this.zp1 = this.zp2 = 1, this.rp0 = this.rp1 = this.rp2 = 0;
|
|
11556
11574
|
case "prep":
|
|
11557
|
-
this.fv = this.pv = this.dpv =
|
|
11575
|
+
this.fv = this.pv = this.dpv = Je, this.round = bo;
|
|
11558
11576
|
}
|
|
11559
11577
|
}
|
|
11560
11578
|
yo.prototype.exec = function(t, e) {
|
|
@@ -12267,15 +12285,15 @@ go = [
|
|
|
12267
12285
|
/* 0x00 */
|
|
12268
12286
|
Xs.bind(void 0, it),
|
|
12269
12287
|
/* 0x01 */
|
|
12270
|
-
Xs.bind(void 0,
|
|
12288
|
+
Xs.bind(void 0, Je),
|
|
12271
12289
|
/* 0x02 */
|
|
12272
12290
|
Ks.bind(void 0, it),
|
|
12273
12291
|
/* 0x03 */
|
|
12274
|
-
Ks.bind(void 0,
|
|
12292
|
+
Ks.bind(void 0, Je),
|
|
12275
12293
|
/* 0x04 */
|
|
12276
12294
|
Zs.bind(void 0, it),
|
|
12277
12295
|
/* 0x05 */
|
|
12278
|
-
Zs.bind(void 0,
|
|
12296
|
+
Zs.bind(void 0, Je),
|
|
12279
12297
|
/* 0x06 */
|
|
12280
12298
|
Js.bind(void 0, 0),
|
|
12281
12299
|
/* 0x07 */
|
|
@@ -12368,7 +12386,7 @@ go = [
|
|
|
12368
12386
|
/* 0x30 */
|
|
12369
12387
|
ti.bind(void 0, it),
|
|
12370
12388
|
/* 0x31 */
|
|
12371
|
-
ti.bind(void 0,
|
|
12389
|
+
ti.bind(void 0, Je),
|
|
12372
12390
|
/* 0x32 */
|
|
12373
12391
|
ni.bind(void 0, 0),
|
|
12374
12392
|
/* 0x33 */
|
|
@@ -13974,7 +13992,7 @@ function te(t) {
|
|
|
13974
13992
|
}, t.tables.os2)
|
|
13975
13993
|
});
|
|
13976
13994
|
}
|
|
13977
|
-
this.supported = !0, this.glyphs = new
|
|
13995
|
+
this.supported = !0, this.glyphs = new Qe.GlyphSet(this, t.glyphs || []), this.encoding = new Ba(this), this.position = new ju(this), this.substitution = new Qu(this), this.tables = this.tables || {}, this.tables = new Proxy(this.tables, {
|
|
13978
13996
|
set: (e, n, r) => (e[n] = r, e.fvar && (e.gvar || e.cff2) && !this.variation && (this.variation = new dh(this)), !0)
|
|
13979
13997
|
}), this.palettes = new uo(this), this.layers = new eh(this), this.svgImages = new th(this), this._push = null, this._hmtxTableData = {}, Object.defineProperty(this, "hinting", {
|
|
13980
13998
|
get: function() {
|
|
@@ -14283,8 +14301,8 @@ function cd(t, e) {
|
|
|
14283
14301
|
};
|
|
14284
14302
|
return r >= 1.2 && (s.markGlyphSets = n.parsePointer(od)), s;
|
|
14285
14303
|
}
|
|
14286
|
-
var ld = { parse: cd },
|
|
14287
|
-
|
|
14304
|
+
var ld = { parse: cd }, qe = new Array(10);
|
|
14305
|
+
qe[1] = function() {
|
|
14288
14306
|
const e = this.offset + this.relativeOffset, n = this.parseUShort();
|
|
14289
14307
|
if (n === 1)
|
|
14290
14308
|
return {
|
|
@@ -14300,7 +14318,7 @@ Ve[1] = function() {
|
|
|
14300
14318
|
};
|
|
14301
14319
|
H.assert(!1, "0x" + e.toString(16) + ": GPOS lookup type 1 format must be 1 or 2.");
|
|
14302
14320
|
};
|
|
14303
|
-
|
|
14321
|
+
qe[2] = function() {
|
|
14304
14322
|
const e = this.offset + this.relativeOffset, n = this.parseUShort();
|
|
14305
14323
|
H.assert(n === 1 || n === 2, "0x" + e.toString(16) + ": GPOS lookup type 2 format must be 1 or 2.");
|
|
14306
14324
|
const r = this.parsePointer(F.coverage), s = this.parseUShort(), i = this.parseUShort();
|
|
@@ -14340,25 +14358,25 @@ Ve[2] = function() {
|
|
|
14340
14358
|
};
|
|
14341
14359
|
}
|
|
14342
14360
|
};
|
|
14343
|
-
|
|
14361
|
+
qe[3] = function() {
|
|
14344
14362
|
return { error: "GPOS Lookup 3 not supported" };
|
|
14345
14363
|
};
|
|
14346
|
-
|
|
14364
|
+
qe[4] = function() {
|
|
14347
14365
|
return { error: "GPOS Lookup 4 not supported" };
|
|
14348
14366
|
};
|
|
14349
|
-
|
|
14367
|
+
qe[5] = function() {
|
|
14350
14368
|
return { error: "GPOS Lookup 5 not supported" };
|
|
14351
14369
|
};
|
|
14352
|
-
|
|
14370
|
+
qe[6] = function() {
|
|
14353
14371
|
return { error: "GPOS Lookup 6 not supported" };
|
|
14354
14372
|
};
|
|
14355
|
-
|
|
14373
|
+
qe[7] = function() {
|
|
14356
14374
|
return { error: "GPOS Lookup 7 not supported" };
|
|
14357
14375
|
};
|
|
14358
|
-
|
|
14376
|
+
qe[8] = function() {
|
|
14359
14377
|
return { error: "GPOS Lookup 8 not supported" };
|
|
14360
14378
|
};
|
|
14361
|
-
|
|
14379
|
+
qe[9] = function() {
|
|
14362
14380
|
return { error: "GPOS Lookup 9 not supported" };
|
|
14363
14381
|
};
|
|
14364
14382
|
function ud(t, e) {
|
|
@@ -14368,12 +14386,12 @@ function ud(t, e) {
|
|
|
14368
14386
|
version: r,
|
|
14369
14387
|
scripts: n.parseScriptList(),
|
|
14370
14388
|
features: n.parseFeatureList(),
|
|
14371
|
-
lookups: n.parseLookupList(
|
|
14389
|
+
lookups: n.parseLookupList(qe)
|
|
14372
14390
|
} : {
|
|
14373
14391
|
version: r,
|
|
14374
14392
|
scripts: n.parseScriptList(),
|
|
14375
14393
|
features: n.parseFeatureList(),
|
|
14376
|
-
lookups: n.parseLookupList(
|
|
14394
|
+
lookups: n.parseLookupList(qe),
|
|
14377
14395
|
variations: n.parseFeatureVariationsList()
|
|
14378
14396
|
};
|
|
14379
14397
|
}
|
|
@@ -15372,9 +15390,9 @@ var wo = { exports: {} }, rs = {}, jn = {};
|
|
|
15372
15390
|
jn.byteLength = $d;
|
|
15373
15391
|
jn.toByteArray = Xd;
|
|
15374
15392
|
jn.fromByteArray = Jd;
|
|
15375
|
-
var
|
|
15393
|
+
var Ke = [], Ue = [], qd = typeof Uint8Array < "u" ? Uint8Array : Array, cr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
15376
15394
|
for (var Rt = 0, jd = cr.length; Rt < jd; ++Rt)
|
|
15377
|
-
|
|
15395
|
+
Ke[Rt] = cr[Rt], Ue[cr.charCodeAt(Rt)] = Rt;
|
|
15378
15396
|
Ue[45] = 62;
|
|
15379
15397
|
Ue[95] = 63;
|
|
15380
15398
|
function Co(t) {
|
|
@@ -15400,7 +15418,7 @@ function Xd(t) {
|
|
|
15400
15418
|
return s === 2 && (e = Ue[t.charCodeAt(c)] << 2 | Ue[t.charCodeAt(c + 1)] >> 4, i[a++] = e & 255), s === 1 && (e = Ue[t.charCodeAt(c)] << 10 | Ue[t.charCodeAt(c + 1)] << 4 | Ue[t.charCodeAt(c + 2)] >> 2, i[a++] = e >> 8 & 255, i[a++] = e & 255), i;
|
|
15401
15419
|
}
|
|
15402
15420
|
function Kd(t) {
|
|
15403
|
-
return
|
|
15421
|
+
return Ke[t >> 18 & 63] + Ke[t >> 12 & 63] + Ke[t >> 6 & 63] + Ke[t & 63];
|
|
15404
15422
|
}
|
|
15405
15423
|
function Zd(t, e, n) {
|
|
15406
15424
|
for (var r, s = [], i = e; i < n; i += 3)
|
|
@@ -15411,9 +15429,9 @@ function Jd(t) {
|
|
|
15411
15429
|
for (var e, n = t.length, r = n % 3, s = [], i = 16383, a = 0, o = n - r; a < o; a += i)
|
|
15412
15430
|
s.push(Zd(t, a, a + i > o ? o : a + i));
|
|
15413
15431
|
return r === 1 ? (e = t[n - 1], s.push(
|
|
15414
|
-
|
|
15432
|
+
Ke[e >> 2] + Ke[e << 4 & 63] + "=="
|
|
15415
15433
|
)) : r === 2 && (e = (t[n - 2] << 8) + t[n - 1], s.push(
|
|
15416
|
-
|
|
15434
|
+
Ke[e >> 10] + Ke[e >> 4 & 63] + Ke[e << 2 & 63] + "="
|
|
15417
15435
|
)), s.join("");
|
|
15418
15436
|
}
|
|
15419
15437
|
var ss = {};
|
|
@@ -15699,7 +15717,7 @@ ss.write = function(t, e, n, r, s, i) {
|
|
|
15699
15717
|
return Te(this, d, g);
|
|
15700
15718
|
case "latin1":
|
|
15701
15719
|
case "binary":
|
|
15702
|
-
return
|
|
15720
|
+
return et(this, d, g);
|
|
15703
15721
|
case "base64":
|
|
15704
15722
|
return U(this, d, g);
|
|
15705
15723
|
case "ucs2":
|
|
@@ -15932,7 +15950,7 @@ ss.write = function(t, e, n, r, s, i) {
|
|
|
15932
15950
|
S += String.fromCharCode(x[k] & 127);
|
|
15933
15951
|
return S;
|
|
15934
15952
|
}
|
|
15935
|
-
function
|
|
15953
|
+
function et(x, d, g) {
|
|
15936
15954
|
var S = "";
|
|
15937
15955
|
g = Math.min(x.length, g);
|
|
15938
15956
|
for (var k = d; k < g; ++k)
|
|
@@ -15943,7 +15961,7 @@ ss.write = function(t, e, n, r, s, i) {
|
|
|
15943
15961
|
var S = x.length;
|
|
15944
15962
|
(!d || d < 0) && (d = 0), (!g || g < 0 || g > S) && (g = S);
|
|
15945
15963
|
for (var k = "", A = d; A < g; ++A)
|
|
15946
|
-
k +=
|
|
15964
|
+
k += tt[x[A]];
|
|
15947
15965
|
return k;
|
|
15948
15966
|
}
|
|
15949
15967
|
function me(x, d, g) {
|
|
@@ -16219,7 +16237,7 @@ ss.write = function(t, e, n, r, s, i) {
|
|
|
16219
16237
|
function ve(x) {
|
|
16220
16238
|
return x !== x;
|
|
16221
16239
|
}
|
|
16222
|
-
var
|
|
16240
|
+
var tt = function() {
|
|
16223
16241
|
for (var x = "0123456789abcdef", d = new Array(256), g = 0; g < 16; ++g)
|
|
16224
16242
|
for (var S = g * 16, k = 0; k < 16; ++k)
|
|
16225
16243
|
d[S + k] = x[g] + x[k];
|
|
@@ -16562,16 +16580,16 @@ function r0() {
|
|
|
16562
16580
|
}
|
|
16563
16581
|
}, hr;
|
|
16564
16582
|
}
|
|
16565
|
-
var
|
|
16583
|
+
var nt = {}, Fi;
|
|
16566
16584
|
function s0() {
|
|
16567
|
-
if (Fi) return
|
|
16585
|
+
if (Fi) return nt;
|
|
16568
16586
|
Fi = 1;
|
|
16569
16587
|
var t = xt.Buffer;
|
|
16570
|
-
|
|
16588
|
+
nt._utf32 = e;
|
|
16571
16589
|
function e(l, u) {
|
|
16572
16590
|
this.iconv = u, this.bomAware = !0, this.isLE = l.isLE;
|
|
16573
16591
|
}
|
|
16574
|
-
|
|
16592
|
+
nt.utf32le = { type: "_utf32", isLE: !0 }, nt.utf32be = { type: "_utf32", isLE: !1 }, nt.ucs4le = "utf32le", nt.ucs4be = "utf32be", e.prototype.encoder = n, e.prototype.decoder = r;
|
|
16575
16593
|
function n(l, u) {
|
|
16576
16594
|
this.isLE = u.isLE, this.highSurrogate = 0;
|
|
16577
16595
|
}
|
|
@@ -16624,7 +16642,7 @@ function s0() {
|
|
|
16624
16642
|
}
|
|
16625
16643
|
r.prototype.end = function() {
|
|
16626
16644
|
this.overflow.length = 0;
|
|
16627
|
-
},
|
|
16645
|
+
}, nt.utf32 = i, nt.ucs4 = "utf32";
|
|
16628
16646
|
function i(l, u) {
|
|
16629
16647
|
this.iconv = u;
|
|
16630
16648
|
}
|
|
@@ -16679,7 +16697,7 @@ function s0() {
|
|
|
16679
16697
|
}
|
|
16680
16698
|
return b - y > m - p ? "utf-32be" : b - y < m - p ? "utf-32le" : u || "utf-32le";
|
|
16681
16699
|
}
|
|
16682
|
-
return
|
|
16700
|
+
return nt;
|
|
16683
16701
|
}
|
|
16684
16702
|
var yn = {}, ki;
|
|
16685
16703
|
function i0() {
|
|
@@ -26694,7 +26712,7 @@ const ft = class ft extends ia {
|
|
|
26694
26712
|
};
|
|
26695
26713
|
ft.NOT_ENCODABLE = -1;
|
|
26696
26714
|
let Gr = ft;
|
|
26697
|
-
class
|
|
26715
|
+
class Ze {
|
|
26698
26716
|
constructor() {
|
|
26699
26717
|
}
|
|
26700
26718
|
/**
|
|
@@ -26702,7 +26720,7 @@ class Ke {
|
|
|
26702
26720
|
* @returns The FontFactory instance
|
|
26703
26721
|
*/
|
|
26704
26722
|
static get instance() {
|
|
26705
|
-
return
|
|
26723
|
+
return Ze._instance || (Ze._instance = new Ze()), Ze._instance;
|
|
26706
26724
|
}
|
|
26707
26725
|
/**
|
|
26708
26726
|
* Creates a font instance based on the provided font data.
|
|
@@ -26811,7 +26829,7 @@ class $ {
|
|
|
26811
26829
|
const i = lt(s.file).toLowerCase();
|
|
26812
26830
|
n.set(i, { ...s, source: "remote" });
|
|
26813
26831
|
}
|
|
26814
|
-
const r = await
|
|
26832
|
+
const r = await ze.instance.getAll();
|
|
26815
26833
|
for (const s of r) {
|
|
26816
26834
|
const i = s.name.toLowerCase();
|
|
26817
26835
|
n.has(i) || n.set(i, this.cachedFontDataToFontInfo(s));
|
|
@@ -26946,8 +26964,8 @@ class $ {
|
|
|
26946
26964
|
data: i
|
|
26947
26965
|
};
|
|
26948
26966
|
try {
|
|
26949
|
-
const f =
|
|
26950
|
-
return l.forEach((h) => f.names.add(h)), this.registerFontInMap(o, f), this.enableFontCache && await
|
|
26967
|
+
const f = Ze.instance.createFont(u);
|
|
26968
|
+
return l.forEach((h) => f.names.add(h)), this.registerFontInMap(o, f), this.enableFontCache && await ze.instance.set(o, u), this.events.fontLoaded.dispatch({ fontName: o }), {
|
|
26951
26969
|
fontName: o,
|
|
26952
26970
|
url: "",
|
|
26953
26971
|
status: "Success"
|
|
@@ -26974,11 +26992,11 @@ class $ {
|
|
|
26974
26992
|
const n = lt(e).toLowerCase();
|
|
26975
26993
|
if (this.isFontLoaded(n))
|
|
26976
26994
|
return !0;
|
|
26977
|
-
const r = await
|
|
26995
|
+
const r = await ze.instance.find(e);
|
|
26978
26996
|
if (!r)
|
|
26979
26997
|
return !1;
|
|
26980
26998
|
try {
|
|
26981
|
-
const i =
|
|
26999
|
+
const i = Ze.instance.createFont(r);
|
|
26982
27000
|
return (s = r.alias) == null || s.forEach((a) => i.names.add(a)), this.registerFontInMap(r.name, i), this.events.fontLoaded.dispatch({ fontName: r.name }), !0;
|
|
26983
27001
|
} catch {
|
|
26984
27002
|
return !1;
|
|
@@ -27251,6 +27269,51 @@ class $ {
|
|
|
27251
27269
|
count: this.missedFonts[e]
|
|
27252
27270
|
}), n && this.lazyFontLoading && this.requestFont(e)));
|
|
27253
27271
|
}
|
|
27272
|
+
/**
|
|
27273
|
+
* Adds catalog / `fonts.json` names onto a font instance.
|
|
27274
|
+
*/
|
|
27275
|
+
applyCatalogNames(e, n) {
|
|
27276
|
+
n.forEach((r) => {
|
|
27277
|
+
r && e.names.add(r);
|
|
27278
|
+
});
|
|
27279
|
+
}
|
|
27280
|
+
/**
|
|
27281
|
+
* Ensures an already-loaded primary face is also addressable under the
|
|
27282
|
+
* current catalog names. Needed when IndexedDB still has an older alias
|
|
27283
|
+
* list (e.g. `noto-sans-kr` cached before `malgun` was added) or when the
|
|
27284
|
+
* binary was loaded under the file basename first.
|
|
27285
|
+
*/
|
|
27286
|
+
ensureCatalogAliases(e, n) {
|
|
27287
|
+
const r = this.loadedFontMap.get(e.toLowerCase()) ?? n.map((s) => this.loadedFontMap.get(s.toLowerCase())).find((s) => s != null);
|
|
27288
|
+
r && (this.applyCatalogNames(r, n), this.registerFontInMap(e, r));
|
|
27289
|
+
}
|
|
27290
|
+
/**
|
|
27291
|
+
* Merges catalog / primary names into an existing IndexedDB alias list so
|
|
27292
|
+
* cold starts after `getAllFontsFromCache` pick up newly added style names.
|
|
27293
|
+
*/
|
|
27294
|
+
async persistCatalogAliases(e, n) {
|
|
27295
|
+
if (!this.enableFontCache)
|
|
27296
|
+
return;
|
|
27297
|
+
const r = await ze.instance.get(e);
|
|
27298
|
+
if (!r)
|
|
27299
|
+
return;
|
|
27300
|
+
const s = [
|
|
27301
|
+
.../* @__PURE__ */ new Set([...r.alias ?? [], ...n, e])
|
|
27302
|
+
], i = r.alias ?? [];
|
|
27303
|
+
s.length === i.length && s.every((a) => i.includes(a)) || await ze.instance.set(e, {
|
|
27304
|
+
...r,
|
|
27305
|
+
alias: s
|
|
27306
|
+
});
|
|
27307
|
+
}
|
|
27308
|
+
/**
|
|
27309
|
+
* Clears miss / failed-request bookkeeping for a primary name and aliases
|
|
27310
|
+
* so a later alias request is not permanently blocked after the binary
|
|
27311
|
+
* loaded under a different key.
|
|
27312
|
+
*/
|
|
27313
|
+
clearRequestStateForNames(e) {
|
|
27314
|
+
for (const n of e)
|
|
27315
|
+
n && (this.clearMissedFontEntry(n), this.fontRequestFailed.delete(n.toLowerCase()));
|
|
27316
|
+
}
|
|
27254
27317
|
/**
|
|
27255
27318
|
* Loads a single font
|
|
27256
27319
|
* @param fontInfo - The matadata of the font to be loaded
|
|
@@ -27258,24 +27321,34 @@ class $ {
|
|
|
27258
27321
|
async loadFont(e) {
|
|
27259
27322
|
if (!ta(e.file))
|
|
27260
27323
|
throw new Error(`Invalid font file name: ${e.file}`);
|
|
27261
|
-
const r = this.fontInfoToFontData(e), s = r.name;
|
|
27262
|
-
if (this.isFontLoaded(r.name))
|
|
27324
|
+
const r = this.fontInfoToFontData(e), s = r.name, i = e.name ?? [];
|
|
27325
|
+
if (this.isFontLoaded(r.name)) {
|
|
27326
|
+
this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
|
|
27263
27327
|
return;
|
|
27264
|
-
|
|
27265
|
-
|
|
27266
|
-
|
|
27267
|
-
|
|
27328
|
+
}
|
|
27329
|
+
const a = this.loadEpoch, o = await ze.instance.get(s);
|
|
27330
|
+
if (a === this.loadEpoch) {
|
|
27331
|
+
if (o) {
|
|
27332
|
+
if (await new Promise((l) => setTimeout(l, 0)), a !== this.loadEpoch)
|
|
27333
|
+
return;
|
|
27334
|
+
if (this.isFontLoaded(s)) {
|
|
27335
|
+
this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
|
|
27268
27336
|
return;
|
|
27269
|
-
|
|
27270
|
-
|
|
27337
|
+
}
|
|
27338
|
+
const c = Ze.instance.createFont(o);
|
|
27339
|
+
c && (this.applyCatalogNames(c, i), this.registerFontInMap(s, c), await this.persistCatalogAliases(s, i));
|
|
27271
27340
|
} else {
|
|
27272
|
-
const
|
|
27273
|
-
if (
|
|
27341
|
+
const c = await this.loader.loadAsync(e.url);
|
|
27342
|
+
if (a !== this.loadEpoch || (r.data = c, await new Promise((u) => setTimeout(u, 0)), a !== this.loadEpoch))
|
|
27274
27343
|
return;
|
|
27275
|
-
|
|
27276
|
-
|
|
27344
|
+
if (this.isFontLoaded(s)) {
|
|
27345
|
+
this.ensureCatalogAliases(s, i), this.clearRequestStateForNames([s, ...i]), await this.persistCatalogAliases(s, i);
|
|
27346
|
+
return;
|
|
27347
|
+
}
|
|
27348
|
+
const l = Ze.instance.createFont(r);
|
|
27349
|
+
l && (this.applyCatalogNames(l, i), this.registerFontInMap(s, l), this.enableFontCache && await ze.instance.set(s, r));
|
|
27277
27350
|
}
|
|
27278
|
-
|
|
27351
|
+
a !== this.loadEpoch || !this.isFontLoaded(s) || (this.clearRequestStateForNames([s, ...i]), this.events.fontLoaded.dispatch({
|
|
27279
27352
|
fontName: s
|
|
27280
27353
|
}));
|
|
27281
27354
|
}
|
|
@@ -27295,12 +27368,12 @@ class $ {
|
|
|
27295
27368
|
async getAllFontsFromCache() {
|
|
27296
27369
|
if (this.loadedFontMap.size !== 0)
|
|
27297
27370
|
return;
|
|
27298
|
-
const e = await
|
|
27371
|
+
const e = await ze.instance.getAll();
|
|
27299
27372
|
for (const n of e) {
|
|
27300
27373
|
const { name: r } = n;
|
|
27301
27374
|
if (this.fileNames && !this.fileNames.includes(r))
|
|
27302
27375
|
continue;
|
|
27303
|
-
const s =
|
|
27376
|
+
const s = Ze.instance.createFont(n);
|
|
27304
27377
|
this.registerFontInMap(r, s);
|
|
27305
27378
|
}
|
|
27306
27379
|
}
|
|
@@ -29862,17 +29935,17 @@ class $i {
|
|
|
29862
29935
|
_
|
|
29863
29936
|
);
|
|
29864
29937
|
n.push(...ie), r.push(...U), s.push(...M), i.push(..._);
|
|
29865
|
-
const re = [], Te = [],
|
|
29938
|
+
const re = [], Te = [], et = [], _e = [];
|
|
29866
29939
|
this._hOffset = l + W, this._vOffset = N;
|
|
29867
29940
|
for (const me of o)
|
|
29868
29941
|
this.processChar(
|
|
29869
29942
|
me,
|
|
29870
29943
|
re,
|
|
29871
29944
|
Te,
|
|
29872
|
-
|
|
29945
|
+
et,
|
|
29873
29946
|
_e
|
|
29874
29947
|
);
|
|
29875
|
-
n.push(...re), r.push(...Te), s.push(...
|
|
29948
|
+
n.push(...re), r.push(...Te), s.push(...et), i.push(..._e), this._hOffset = l + R, E && (this._currentContext.fontSizeScaleFactor = p, this.calcuateLineParams());
|
|
29876
29949
|
}
|
|
29877
29950
|
} else {
|
|
29878
29951
|
const C = [], T = [], E = [], R = [];
|
|
@@ -30503,7 +30576,7 @@ function Q0(t) {
|
|
|
30503
30576
|
return String.fromCharCode(r);
|
|
30504
30577
|
});
|
|
30505
30578
|
}
|
|
30506
|
-
const $t = /* @__PURE__ */ new I.Vector3(),
|
|
30579
|
+
const $t = /* @__PURE__ */ new I.Vector3(), rt = /* @__PURE__ */ new I.Vector3(), st = /* @__PURE__ */ new I.Vector3(), Yi = /* @__PURE__ */ new I.Vector3(1, 0, 0);
|
|
30507
30580
|
class tn extends I.Object3D {
|
|
30508
30581
|
/**
|
|
30509
30582
|
* Extracts all unique font names used in an MText string.
|
|
@@ -30990,9 +31063,9 @@ class tn extends I.Object3D {
|
|
|
30990
31063
|
e.updateWorldMatrix(!1, !1);
|
|
30991
31064
|
const s = (c = (o = e.userData) == null ? void 0 : o.layout) == null ? void 0 : c.chars, i = (l = e.userData) == null ? void 0 : l.lineLayouts;
|
|
30992
31065
|
if (i && i.length > 0 && i.forEach((h) => {
|
|
30993
|
-
$t.set(0, h.y, 0).applyMatrix4(e.matrixWorld),
|
|
31066
|
+
$t.set(0, h.y, 0).applyMatrix4(e.matrixWorld), rt.set(0, h.y - h.height / 2, 0).applyMatrix4(e.matrixWorld), st.set(0, h.y + h.height / 2, 0).applyMatrix4(e.matrixWorld), r.push({
|
|
30994
31067
|
y: $t.y,
|
|
30995
|
-
height: Math.abs(
|
|
31068
|
+
height: Math.abs(st.y - rt.y),
|
|
30996
31069
|
breakIndex: h.breakIndex
|
|
30997
31070
|
});
|
|
30998
31071
|
}), s && s.length > 0) {
|
|
@@ -31057,7 +31130,7 @@ class tn extends I.Object3D {
|
|
|
31057
31130
|
}
|
|
31058
31131
|
const s = (c = e.userData) == null ? void 0 : c.lineLayouts;
|
|
31059
31132
|
s && s.length > 0 && s.forEach((p) => {
|
|
31060
|
-
|
|
31133
|
+
rt.set(0, p.y - p.height / 2, 0).applyMatrix4(e.matrixWorld), st.set(0, p.y + p.height / 2, 0).applyMatrix4(e.matrixWorld), n.hasLine = !0, n.minX = Math.min(n.minX, rt.x, st.x), n.maxX = Math.max(n.maxX, rt.x, st.x), n.minY = Math.min(n.minY, rt.y, st.y), n.maxY = Math.max(n.maxY, rt.y, st.y), n.minZ = Math.min(n.minZ, rt.z, st.z), n.maxZ = Math.max(n.maxZ, rt.z, st.z);
|
|
31061
31134
|
});
|
|
31062
31135
|
const i = (u = (l = e.userData) == null ? void 0 : l.layout) == null ? void 0 : u.chars;
|
|
31063
31136
|
if (i && i.length > 0) {
|
|
@@ -31973,7 +32046,7 @@ class c1 {
|
|
|
31973
32046
|
fonts: []
|
|
31974
32047
|
};
|
|
31975
32048
|
try {
|
|
31976
|
-
r = await
|
|
32049
|
+
r = await ze.instance.getStorageStats();
|
|
31977
32050
|
} catch {
|
|
31978
32051
|
}
|
|
31979
32052
|
const s = e.totalEstimatedBytes + n.reduce((i, a) => i + a.totalEstimatedBytes, 0);
|
|
@@ -32021,7 +32094,7 @@ export {
|
|
|
32021
32094
|
Gi as DEFAULT_LINE_SPACE_FACTOR,
|
|
32022
32095
|
F0 as DefaultFontLoader,
|
|
32023
32096
|
gs as EventManager,
|
|
32024
|
-
|
|
32097
|
+
Ze as FontFactory,
|
|
32025
32098
|
$ as FontManager,
|
|
32026
32099
|
N0 as LINE_SPACING_SCALE_FACTOR,
|
|
32027
32100
|
Sc as MATERIAL_ESTIMATED_BYTES,
|