@mlightcad/mtext-renderer 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +191 -168
- package/dist/index.umd.cjs +5 -5
- package/dist/mtext-renderer-worker.js +32 -9
- package/lib/renderer/mtext.d.ts +3 -0
- package/package.json +4 -4
- package/README.md +0 -524
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as P from "three";
|
|
2
2
|
import { BufferGeometry as Ni, BufferAttribute as Gi, ShapePath as La, ShapeUtils as Ra, Shape as Hi, LineCurve as rr, QuadraticBezierCurve as gn, CubicBezierCurve as vn, EllipseCurve as yn } from "three";
|
|
3
3
|
class mn {
|
|
4
4
|
constructor() {
|
|
@@ -103,7 +103,7 @@ class Ma {
|
|
|
103
103
|
this.unsupportedChars[e] || (this.unsupportedChars[e] = 0), this.unsupportedChars[e]++;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
class Ia extends
|
|
106
|
+
class Ia extends P.Shape {
|
|
107
107
|
constructor() {
|
|
108
108
|
super(...arguments), this.width = 0;
|
|
109
109
|
}
|
|
@@ -235,13 +235,13 @@ Da((t) => ({
|
|
|
235
235
|
get: (e, r, n) => Sn(e, r) || t.get(e, r, n),
|
|
236
236
|
has: (e, r) => !!Sn(e, r) || t.has(e, r)
|
|
237
237
|
}));
|
|
238
|
-
const Qi = ["continue", "continuePrimaryKey", "advance"], wn = {}, Dr = /* @__PURE__ */ new WeakMap(),
|
|
238
|
+
const Qi = ["continue", "continuePrimaryKey", "advance"], wn = {}, Dr = /* @__PURE__ */ new WeakMap(), _a = /* @__PURE__ */ new WeakMap(), Ji = {
|
|
239
239
|
get(t, e) {
|
|
240
240
|
if (!Qi.includes(e))
|
|
241
241
|
return t[e];
|
|
242
242
|
let r = wn[e];
|
|
243
243
|
return r || (r = wn[e] = function(...n) {
|
|
244
|
-
Dr.set(this,
|
|
244
|
+
Dr.set(this, _a.get(this)[e](...n));
|
|
245
245
|
}), r;
|
|
246
246
|
}
|
|
247
247
|
};
|
|
@@ -251,7 +251,7 @@ async function* es(...t) {
|
|
|
251
251
|
return;
|
|
252
252
|
e = e;
|
|
253
253
|
const r = new Proxy(e, Ji);
|
|
254
|
-
for (
|
|
254
|
+
for (_a.set(r, e), Kt.set(r, Ir(e)); e; )
|
|
255
255
|
yield r, e = await (Dr.get(r) || e.continue()), Dr.delete(r);
|
|
256
256
|
}
|
|
257
257
|
function Fn(t, e) {
|
|
@@ -408,8 +408,8 @@ const Ze = {
|
|
|
408
408
|
};
|
|
409
409
|
pe.DATABASE_NAME = "mlightcad", pe.DATABASE_VERSION = ir[ir.length - 1].version;
|
|
410
410
|
let dt = pe;
|
|
411
|
-
const
|
|
412
|
-
const e =
|
|
411
|
+
const Pa = (t) => t.split("/").pop(), kn = (t) => {
|
|
412
|
+
const e = Pa(t);
|
|
413
413
|
if (e) {
|
|
414
414
|
const r = e.lastIndexOf(".");
|
|
415
415
|
return r === -1 ? e : e.substring(0, r);
|
|
@@ -780,7 +780,7 @@ function Ae(t, e, r) {
|
|
|
780
780
|
var n = t.tag & 65535 >>> 16 - e;
|
|
781
781
|
return t.tag >>>= e, t.bitcount -= e, n + r;
|
|
782
782
|
}
|
|
783
|
-
function
|
|
783
|
+
function _r(t, e) {
|
|
784
784
|
for (; t.bitcount < 24; )
|
|
785
785
|
t.tag |= t.source[t.sourceIndex++] << t.bitcount, t.bitcount += 8;
|
|
786
786
|
var r = 0, n = 0, a = 0, i = t.tag;
|
|
@@ -798,7 +798,7 @@ function os(t, e, r) {
|
|
|
798
798
|
Ue[as[s]] = u;
|
|
799
799
|
}
|
|
800
800
|
for (sr(Tn, Ue, 0, 19), o = 0; o < n + a; ) {
|
|
801
|
-
var h =
|
|
801
|
+
var h = _r(t, Tn);
|
|
802
802
|
switch (h) {
|
|
803
803
|
case 16:
|
|
804
804
|
var d = Ue[o - 1];
|
|
@@ -822,14 +822,14 @@ function os(t, e, r) {
|
|
|
822
822
|
}
|
|
823
823
|
function Cn(t, e, r) {
|
|
824
824
|
for (; ; ) {
|
|
825
|
-
var n =
|
|
825
|
+
var n = _r(t, e);
|
|
826
826
|
if (n === 256)
|
|
827
827
|
return Xr;
|
|
828
828
|
if (n < 256)
|
|
829
829
|
t.dest[t.destLen++] = n;
|
|
830
830
|
else {
|
|
831
831
|
var a, i, s, o;
|
|
832
|
-
for (n -= 257, a = Ae(t, Yr[n], jr[n]), i =
|
|
832
|
+
for (n -= 257, a = Ae(t, Yr[n], jr[n]), i = _r(t, r), s = t.destLen - Ae(t, za[i], Wa[i]), o = s; o < s + a; ++o)
|
|
833
833
|
t.dest[t.destLen++] = t.dest[o];
|
|
834
834
|
}
|
|
835
835
|
}
|
|
@@ -1030,14 +1030,14 @@ function Va(t) {
|
|
|
1030
1030
|
function Un(t, e) {
|
|
1031
1031
|
t || Va(e);
|
|
1032
1032
|
}
|
|
1033
|
-
var
|
|
1033
|
+
var _ = { fail: Va, argument: Un, assert: Un }, An = 32768, Bn = 2147483648, ot = {}, O = {}, N = {};
|
|
1034
1034
|
function Te(t) {
|
|
1035
1035
|
return function() {
|
|
1036
1036
|
return t;
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
1039
|
O.BYTE = function(t) {
|
|
1040
|
-
return
|
|
1040
|
+
return _.argument(t >= 0 && t <= 255, "Byte value should be between 0 and 255."), [t];
|
|
1041
1041
|
};
|
|
1042
1042
|
N.BYTE = Te(1);
|
|
1043
1043
|
O.CHAR = function(t) {
|
|
@@ -1084,7 +1084,7 @@ O.LONGDATETIME = function(t) {
|
|
|
1084
1084
|
};
|
|
1085
1085
|
N.LONGDATETIME = Te(8);
|
|
1086
1086
|
O.TAG = function(t) {
|
|
1087
|
-
return
|
|
1087
|
+
return _.argument(t.length === 4, "Tag should be exactly 4 ASCII characters."), [
|
|
1088
1088
|
t.charCodeAt(0),
|
|
1089
1089
|
t.charCodeAt(1),
|
|
1090
1090
|
t.charCodeAt(2),
|
|
@@ -1156,7 +1156,7 @@ O.UTF16 = function(t) {
|
|
|
1156
1156
|
N.UTF16 = function(t) {
|
|
1157
1157
|
return t.length * 2;
|
|
1158
1158
|
};
|
|
1159
|
-
var
|
|
1159
|
+
var Pr = {
|
|
1160
1160
|
"x-mac-croatian": (
|
|
1161
1161
|
// Python: 'mac_croatian'
|
|
1162
1162
|
"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ"
|
|
@@ -1199,7 +1199,7 @@ var _r = {
|
|
|
1199
1199
|
)
|
|
1200
1200
|
};
|
|
1201
1201
|
ot.MACSTRING = function(t, e, r, n) {
|
|
1202
|
-
var a =
|
|
1202
|
+
var a = Pr[n];
|
|
1203
1203
|
if (a !== void 0) {
|
|
1204
1204
|
for (var i = "", s = 0; s < r; s++) {
|
|
1205
1205
|
var o = t.getUint8(e + s);
|
|
@@ -1211,7 +1211,7 @@ ot.MACSTRING = function(t, e, r, n) {
|
|
|
1211
1211
|
var Mt = typeof WeakMap == "function" && /* @__PURE__ */ new WeakMap(), It, ls = function(t) {
|
|
1212
1212
|
if (!It) {
|
|
1213
1213
|
It = {};
|
|
1214
|
-
for (var e in
|
|
1214
|
+
for (var e in Pr)
|
|
1215
1215
|
It[e] = new String(e);
|
|
1216
1216
|
}
|
|
1217
1217
|
var r = It[t];
|
|
@@ -1221,7 +1221,7 @@ var Mt = typeof WeakMap == "function" && /* @__PURE__ */ new WeakMap(), It, ls =
|
|
|
1221
1221
|
if (n !== void 0)
|
|
1222
1222
|
return n;
|
|
1223
1223
|
}
|
|
1224
|
-
var a =
|
|
1224
|
+
var a = Pr[t];
|
|
1225
1225
|
if (a !== void 0) {
|
|
1226
1226
|
for (var i = {}, s = 0; s < a.length; s++)
|
|
1227
1227
|
i[a.charCodeAt(s)] = s + 128;
|
|
@@ -1324,7 +1324,7 @@ O.OPERAND = function(t, e) {
|
|
|
1324
1324
|
var r = [];
|
|
1325
1325
|
if (Array.isArray(e))
|
|
1326
1326
|
for (var n = 0; n < e.length; n += 1)
|
|
1327
|
-
|
|
1327
|
+
_.argument(t.length === e.length, "Not enough arguments given for type" + e), r = r.concat(O.OPERAND(t[n], e[n]));
|
|
1328
1328
|
else if (e === "SID")
|
|
1329
1329
|
r = r.concat(O.NUMBER(t));
|
|
1330
1330
|
else if (e === "offset")
|
|
@@ -1357,16 +1357,16 @@ N.CHARSTRING = function(t) {
|
|
|
1357
1357
|
};
|
|
1358
1358
|
O.OBJECT = function(t) {
|
|
1359
1359
|
var e = O[t.type];
|
|
1360
|
-
return
|
|
1360
|
+
return _.argument(e !== void 0, "No encoding function for type " + t.type), e(t.value);
|
|
1361
1361
|
};
|
|
1362
1362
|
N.OBJECT = function(t) {
|
|
1363
1363
|
var e = N[t.type];
|
|
1364
|
-
return
|
|
1364
|
+
return _.argument(e !== void 0, "No sizeOf function for type " + t.type), e(t.value);
|
|
1365
1365
|
};
|
|
1366
1366
|
O.TABLE = function(t) {
|
|
1367
1367
|
for (var e = [], r = t.fields.length, n = [], a = [], i = 0; i < r; i += 1) {
|
|
1368
1368
|
var s = t.fields[i], o = O[s.type];
|
|
1369
|
-
|
|
1369
|
+
_.argument(o !== void 0, "No encoding function for field type " + s.type + " (" + s.name + ")");
|
|
1370
1370
|
var c = t[s.name];
|
|
1371
1371
|
c === void 0 && (c = s.value);
|
|
1372
1372
|
var u = o(c);
|
|
@@ -1374,14 +1374,14 @@ O.TABLE = function(t) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
for (var h = 0; h < n.length; h += 1) {
|
|
1376
1376
|
var d = a[h], p = e.length;
|
|
1377
|
-
|
|
1377
|
+
_.argument(p < 65536, "Table " + t.tableName + " too big."), e[d] = p >> 8, e[d + 1] = p & 255, e = e.concat(n[h]);
|
|
1378
1378
|
}
|
|
1379
1379
|
return e;
|
|
1380
1380
|
};
|
|
1381
1381
|
N.TABLE = function(t) {
|
|
1382
1382
|
for (var e = 0, r = t.fields.length, n = 0; n < r; n += 1) {
|
|
1383
1383
|
var a = t.fields[n], i = N[a.type];
|
|
1384
|
-
|
|
1384
|
+
_.argument(i !== void 0, "No sizeOf function for field type " + a.type + " (" + a.name + ")");
|
|
1385
1385
|
var s = t[a.name];
|
|
1386
1386
|
s === void 0 && (s = a.value), e += i(s), a.type === "TABLE" && (e += 2);
|
|
1387
1387
|
}
|
|
@@ -1450,7 +1450,7 @@ function qt(t) {
|
|
|
1450
1450
|
{ name: "startCoverageIndex", type: "USHORT", value: e.index }
|
|
1451
1451
|
];
|
|
1452
1452
|
}))
|
|
1453
|
-
) :
|
|
1453
|
+
) : _.assert(!1, "Coverage format must be 1 or 2.");
|
|
1454
1454
|
}
|
|
1455
1455
|
qt.prototype = Object.create(ce.prototype);
|
|
1456
1456
|
qt.prototype.constructor = qt;
|
|
@@ -1460,7 +1460,7 @@ function Vt(t) {
|
|
|
1460
1460
|
"scriptListTable",
|
|
1461
1461
|
bt("scriptRecord", t, function(e, r) {
|
|
1462
1462
|
var n = e.script, a = n.defaultLangSys;
|
|
1463
|
-
return
|
|
1463
|
+
return _.assert(!!a, "Unable to write GSUB: script " + e.tag + " has no default language system."), [
|
|
1464
1464
|
{ name: "scriptTag" + r, type: "TAG", value: e.tag },
|
|
1465
1465
|
{ name: "script" + r, type: "TABLE", value: new ce("scriptTable", [
|
|
1466
1466
|
{ name: "defaultLangSys", type: "TABLE", value: new ce("defaultLangSys", [
|
|
@@ -1503,7 +1503,7 @@ Xt.prototype.constructor = Xt;
|
|
|
1503
1503
|
function Yt(t, e) {
|
|
1504
1504
|
ce.call(this, "lookupListTable", Gr("lookup", t, function(r) {
|
|
1505
1505
|
var n = e[r.lookupType];
|
|
1506
|
-
return
|
|
1506
|
+
return _.assert(!!n, "Unable to write GSUB lookup type " + r.lookupType + " tables."), new ce("lookupTable", [
|
|
1507
1507
|
{ name: "lookupType", type: "USHORT", value: r.lookupType },
|
|
1508
1508
|
{ name: "lookupFlag", type: "USHORT", value: r.lookupFlag }
|
|
1509
1509
|
].concat(Gr("subtable", r.subtables, n)));
|
|
@@ -1834,7 +1834,7 @@ C.prototype.parseFeatureList = function() {
|
|
|
1834
1834
|
C.prototype.parseLookupList = function(t) {
|
|
1835
1835
|
return this.parsePointer(C.list(C.pointer(function() {
|
|
1836
1836
|
var e = this.parseUShort();
|
|
1837
|
-
|
|
1837
|
+
_.argument(1 <= e && e <= 9, "GPOS/GSUB lookup type " + e + " unknown.");
|
|
1838
1838
|
var r = this.parseUShort(), n = r & 16;
|
|
1839
1839
|
return {
|
|
1840
1840
|
lookupType: e,
|
|
@@ -1847,7 +1847,7 @@ C.prototype.parseLookupList = function(t) {
|
|
|
1847
1847
|
C.prototype.parseFeatureVariationsList = function() {
|
|
1848
1848
|
return this.parsePointer32(function() {
|
|
1849
1849
|
var t = this.parseUShort(), e = this.parseUShort();
|
|
1850
|
-
|
|
1850
|
+
_.argument(t === 1 && e < 1, "GPOS/GSUB feature variations table unknown.");
|
|
1851
1851
|
var r = this.parseRecordList32({
|
|
1852
1852
|
conditionSetOffset: C.offset32,
|
|
1853
1853
|
featureTableSubstitutionOffset: C.offset32
|
|
@@ -1887,7 +1887,7 @@ function ws(t, e, r, n, a) {
|
|
|
1887
1887
|
}
|
|
1888
1888
|
function Fs(t, e) {
|
|
1889
1889
|
var r = {};
|
|
1890
|
-
r.version = D.getUShort(t, e),
|
|
1890
|
+
r.version = D.getUShort(t, e), _.argument(r.version === 0, "cmap table version should be 0."), r.numTables = D.getUShort(t, e + 2);
|
|
1891
1891
|
for (var n = -1, a = r.numTables - 1; a >= 0; a -= 1) {
|
|
1892
1892
|
var i = D.getUShort(t, e + 4 + a * 8), s = D.getUShort(t, e + 4 + a * 8 + 2);
|
|
1893
1893
|
if (i === 3 && (s === 0 || s === 1 || s === 10) || i === 0 && (s === 0 || s === 1 || s === 2 || s === 3 || s === 4)) {
|
|
@@ -3286,7 +3286,7 @@ xe.prototype.getContours = function() {
|
|
|
3286
3286
|
var n = this.points[r];
|
|
3287
3287
|
e.push(n), n.lastPointOfContour && (t.push(e), e = []);
|
|
3288
3288
|
}
|
|
3289
|
-
return
|
|
3289
|
+
return _.argument(e.length === 0, "There are still points left in the current contour."), t;
|
|
3290
3290
|
};
|
|
3291
3291
|
xe.prototype.getMetrics = function() {
|
|
3292
3292
|
for (var t = this.path.commands, e = [], r = [], n = 0; n < t.length; n += 1) {
|
|
@@ -3325,7 +3325,7 @@ xe.prototype.drawMetrics = function(t, e, r, n) {
|
|
|
3325
3325
|
var i = this.xMin || 0, s = this.yMin || 0, o = this.xMax || 0, c = this.yMax || 0, u = this.advanceWidth || 0;
|
|
3326
3326
|
t.strokeStyle = "blue", Ye.line(t, e + i * a, -1e4, e + i * a, 1e4), Ye.line(t, e + o * a, -1e4, e + o * a, 1e4), Ye.line(t, -1e4, r + -s * a, 1e4, r + -s * a), Ye.line(t, -1e4, r + -c * a, 1e4, r + -c * a), t.strokeStyle = "green", Ye.line(t, e + u * a, -1e4, e + u * a, 1e4);
|
|
3327
3327
|
};
|
|
3328
|
-
function
|
|
3328
|
+
function _t(t, e, r) {
|
|
3329
3329
|
Object.defineProperty(t, e, {
|
|
3330
3330
|
get: function() {
|
|
3331
3331
|
return t.path, t[r];
|
|
@@ -3370,7 +3370,7 @@ function Is(t, e, r, n, a, i) {
|
|
|
3370
3370
|
r(s, n, a);
|
|
3371
3371
|
var o = i(t.glyphs, s);
|
|
3372
3372
|
return o.unitsPerEm = t.unitsPerEm, o;
|
|
3373
|
-
},
|
|
3373
|
+
}, _t(s, "xMin", "_xMin"), _t(s, "xMax", "_xMax"), _t(s, "yMin", "_yMin"), _t(s, "yMax", "_yMax"), s;
|
|
3374
3374
|
};
|
|
3375
3375
|
}
|
|
3376
3376
|
function Ds(t, e, r, n) {
|
|
@@ -3416,7 +3416,7 @@ function Ge(t, e, r) {
|
|
|
3416
3416
|
}
|
|
3417
3417
|
return { objects: a, startOffset: e, endOffset: o };
|
|
3418
3418
|
}
|
|
3419
|
-
function
|
|
3419
|
+
function _s(t, e) {
|
|
3420
3420
|
var r = [], n = D.getCard16(t, e), a, i;
|
|
3421
3421
|
if (n !== 0) {
|
|
3422
3422
|
var s = D.getByte(t, e + 2);
|
|
@@ -3428,7 +3428,7 @@ function Ps(t, e) {
|
|
|
3428
3428
|
i = e + 2;
|
|
3429
3429
|
return { offsets: r, startOffset: e, endOffset: i };
|
|
3430
3430
|
}
|
|
3431
|
-
function
|
|
3431
|
+
function Ps(t, e, r, n, a) {
|
|
3432
3432
|
var i = D.getCard16(r, n), s = 0;
|
|
3433
3433
|
if (i !== 0) {
|
|
3434
3434
|
var o = D.getByte(r, n + 2);
|
|
@@ -3780,11 +3780,11 @@ function Ys(t, e, r, n) {
|
|
|
3780
3780
|
} else
|
|
3781
3781
|
r.subrs = [], r.subrsBias = 0;
|
|
3782
3782
|
var w;
|
|
3783
|
-
n.lowMemory ? (w =
|
|
3783
|
+
n.lowMemory ? (w = _s(t, e + h.charStrings), r.nGlyphs = w.offsets.length) : (w = Ge(t, e + h.charStrings), r.nGlyphs = w.objects.length);
|
|
3784
3784
|
var k = qs(t, e + h.charset, r.nGlyphs, o.objects);
|
|
3785
3785
|
if (h.encoding === 0 ? r.cffEncoding = new Zt(Cs, k) : h.encoding === 1 ? r.cffEncoding = new Zt(Us, k) : r.cffEncoding = Vs(t, e + h.encoding, k), r.encoding = r.encoding || r.cffEncoding, r.glyphs = new Re.GlyphSet(r), n.lowMemory)
|
|
3786
3786
|
r._push = function(L) {
|
|
3787
|
-
var B =
|
|
3787
|
+
var B = Ps(L, w.offsets, t, e + h.charStrings);
|
|
3788
3788
|
r.glyphs.push(L, Re.cffGlyphLoader(r, L, Mn, B));
|
|
3789
3789
|
};
|
|
3790
3790
|
else
|
|
@@ -3932,7 +3932,7 @@ function ro(t, e) {
|
|
|
3932
3932
|
var ai = { parse: Ys, make: ro };
|
|
3933
3933
|
function no(t, e) {
|
|
3934
3934
|
var r = {}, n = new D.Parser(t, e);
|
|
3935
|
-
return r.version = n.parseVersion(), r.fontRevision = Math.round(n.parseFixed() * 1e3) / 1e3, r.checkSumAdjustment = n.parseULong(), r.magicNumber = n.parseULong(),
|
|
3935
|
+
return r.version = n.parseVersion(), r.fontRevision = Math.round(n.parseFixed() * 1e3) / 1e3, r.checkSumAdjustment = n.parseULong(), r.magicNumber = n.parseULong(), _.argument(r.magicNumber === 1594834165, "Font header has wrong magic number."), r.flags = n.parseUShort(), r.unitsPerEm = n.parseUShort(), r.created = n.parseLongDateTime(), r.modified = n.parseLongDateTime(), r.xMin = n.parseShort(), r.yMin = n.parseShort(), r.xMax = n.parseShort(), r.yMax = n.parseShort(), r.macStyle = n.parseUShort(), r.lowestRecPPEM = n.parseUShort(), r.fontDirectionHint = n.parseShort(), r.indexToLocFormat = n.parseShort(), r.glyphDataFormat = n.parseShort(), r;
|
|
3936
3936
|
}
|
|
3937
3937
|
function ao(t) {
|
|
3938
3938
|
var e = Math.round((/* @__PURE__ */ new Date()).getTime() / 1e3) + 2082844800, r = e;
|
|
@@ -4022,7 +4022,7 @@ function lo(t) {
|
|
|
4022
4022
|
}
|
|
4023
4023
|
function fo(t, e) {
|
|
4024
4024
|
var r = new D.Parser(t, e), n = r.parseULong();
|
|
4025
|
-
|
|
4025
|
+
_.argument(n === 1, "Unsupported ltag table version."), r.skip("uLong", 1);
|
|
4026
4026
|
for (var a = r.parseULong(), i = [], s = 0; s < a; s++) {
|
|
4027
4027
|
for (var o = "", c = e + r.parseUShort(), u = r.parseUShort(), h = c; h < c + u; ++h)
|
|
4028
4028
|
o += String.fromCharCode(t.getInt8(h));
|
|
@@ -4797,7 +4797,7 @@ function or(t) {
|
|
|
4797
4797
|
e[t[r]] = parseInt(r);
|
|
4798
4798
|
return e;
|
|
4799
4799
|
}
|
|
4800
|
-
function
|
|
4800
|
+
function _n(t, e, r, n, a, i) {
|
|
4801
4801
|
return new M.Record("NameRecord", [
|
|
4802
4802
|
{ name: "platformID", type: "USHORT", value: t },
|
|
4803
4803
|
{ name: "encodingID", type: "USHORT", value: e },
|
|
@@ -4819,7 +4819,7 @@ function So(t, e) {
|
|
|
4819
4819
|
}
|
|
4820
4820
|
return -1;
|
|
4821
4821
|
}
|
|
4822
|
-
function
|
|
4822
|
+
function Pn(t, e) {
|
|
4823
4823
|
var r = So(t, e);
|
|
4824
4824
|
if (r < 0) {
|
|
4825
4825
|
r = e.length;
|
|
@@ -4842,8 +4842,8 @@ function wo(t, e) {
|
|
|
4842
4842
|
for (var x in g) {
|
|
4843
4843
|
var v = g[x], F = 1, m = c[x], S = vo[m], w = pi(F, S, m), k = O.MACSTRING(v, w);
|
|
4844
4844
|
k === void 0 && (F = 0, m = e.indexOf(x), m < 0 && (m = e.length, e.push(x)), S = 4, k = O.UTF16(v));
|
|
4845
|
-
var T =
|
|
4846
|
-
h.push(
|
|
4845
|
+
var T = Pn(k, d);
|
|
4846
|
+
h.push(_n(
|
|
4847
4847
|
F,
|
|
4848
4848
|
S,
|
|
4849
4849
|
m,
|
|
@@ -4853,8 +4853,8 @@ function wo(t, e) {
|
|
|
4853
4853
|
));
|
|
4854
4854
|
var R = u[x];
|
|
4855
4855
|
if (R !== void 0) {
|
|
4856
|
-
var L = O.UTF16(v), B =
|
|
4857
|
-
h.push(
|
|
4856
|
+
var L = O.UTF16(v), B = Pn(L, d);
|
|
4857
|
+
h.push(_n(
|
|
4858
4858
|
3,
|
|
4859
4859
|
1,
|
|
4860
4860
|
R,
|
|
@@ -5243,11 +5243,11 @@ we[1] = function() {
|
|
|
5243
5243
|
coverage: this.parsePointer(C.coverage),
|
|
5244
5244
|
substitute: this.parseOffset16List()
|
|
5245
5245
|
};
|
|
5246
|
-
|
|
5246
|
+
_.assert(!1, "0x" + e.toString(16) + ": lookup type 1 format must be 1 or 2.");
|
|
5247
5247
|
};
|
|
5248
5248
|
we[2] = function() {
|
|
5249
5249
|
var e = this.parseUShort();
|
|
5250
|
-
return
|
|
5250
|
+
return _.argument(e === 1, "GSUB Multiple Substitution Subtable identifier-format must be 1"), {
|
|
5251
5251
|
substFormat: e,
|
|
5252
5252
|
coverage: this.parsePointer(C.coverage),
|
|
5253
5253
|
sequences: this.parseListOfLists()
|
|
@@ -5255,7 +5255,7 @@ we[2] = function() {
|
|
|
5255
5255
|
};
|
|
5256
5256
|
we[3] = function() {
|
|
5257
5257
|
var e = this.parseUShort();
|
|
5258
|
-
return
|
|
5258
|
+
return _.argument(e === 1, "GSUB Alternate Substitution Subtable identifier-format must be 1"), {
|
|
5259
5259
|
substFormat: e,
|
|
5260
5260
|
coverage: this.parsePointer(C.coverage),
|
|
5261
5261
|
alternateSets: this.parseListOfLists()
|
|
@@ -5263,7 +5263,7 @@ we[3] = function() {
|
|
|
5263
5263
|
};
|
|
5264
5264
|
we[4] = function() {
|
|
5265
5265
|
var e = this.parseUShort();
|
|
5266
|
-
return
|
|
5266
|
+
return _.argument(e === 1, "GSUB ligature table identifier-format must be 1"), {
|
|
5267
5267
|
substFormat: e,
|
|
5268
5268
|
coverage: this.parsePointer(C.coverage),
|
|
5269
5269
|
ligatureSets: this.parseListOfLists(function() {
|
|
@@ -5313,7 +5313,7 @@ we[5] = function() {
|
|
|
5313
5313
|
lookupRecords: this.parseRecordList(a, at)
|
|
5314
5314
|
};
|
|
5315
5315
|
}
|
|
5316
|
-
|
|
5316
|
+
_.assert(!1, "0x" + e.toString(16) + ": lookup type 5 format must be 1, 2 or 3.");
|
|
5317
5317
|
};
|
|
5318
5318
|
we[6] = function() {
|
|
5319
5319
|
var e = this.offset + this.relativeOffset, r = this.parseUShort();
|
|
@@ -5354,11 +5354,11 @@ we[6] = function() {
|
|
|
5354
5354
|
lookaheadCoverage: this.parseList(C.pointer(C.coverage)),
|
|
5355
5355
|
lookupRecords: this.parseRecordList(at)
|
|
5356
5356
|
};
|
|
5357
|
-
|
|
5357
|
+
_.assert(!1, "0x" + e.toString(16) + ": lookup type 6 format must be 1, 2 or 3.");
|
|
5358
5358
|
};
|
|
5359
5359
|
we[7] = function() {
|
|
5360
5360
|
var e = this.parseUShort();
|
|
5361
|
-
|
|
5361
|
+
_.argument(e === 1, "GSUB Extension Substitution subtable identifier-format must be 1");
|
|
5362
5362
|
var r = this.parseUShort(), n = new C(this.data, this.offset + this.parseULong());
|
|
5363
5363
|
return {
|
|
5364
5364
|
substFormat: 1,
|
|
@@ -5368,7 +5368,7 @@ we[7] = function() {
|
|
|
5368
5368
|
};
|
|
5369
5369
|
we[8] = function() {
|
|
5370
5370
|
var e = this.parseUShort();
|
|
5371
|
-
return
|
|
5371
|
+
return _.argument(e === 1, "GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"), {
|
|
5372
5372
|
substFormat: e,
|
|
5373
5373
|
coverage: this.parsePointer(C.coverage),
|
|
5374
5374
|
backtrackCoverage: this.parseList(C.pointer(C.coverage)),
|
|
@@ -5379,7 +5379,7 @@ we[8] = function() {
|
|
|
5379
5379
|
function Uo(t, e) {
|
|
5380
5380
|
e = e || 0;
|
|
5381
5381
|
var r = new C(t, e), n = r.parseVersion(1);
|
|
5382
|
-
return
|
|
5382
|
+
return _.argument(n === 1 || n === 1.1, "Unsupported GSUB table version."), n === 1 ? {
|
|
5383
5383
|
version: n,
|
|
5384
5384
|
scripts: r.parseScriptList(),
|
|
5385
5385
|
features: r.parseFeatureList(),
|
|
@@ -5404,7 +5404,7 @@ ct[1] = function(e) {
|
|
|
5404
5404
|
].concat(M.ushortList("substitute", e.substitute)));
|
|
5405
5405
|
};
|
|
5406
5406
|
ct[2] = function(e) {
|
|
5407
|
-
return
|
|
5407
|
+
return _.assert(e.substFormat === 1, "Lookup type 2 substFormat must be 1."), new M.Table("substitutionTable", [
|
|
5408
5408
|
{ name: "substFormat", type: "USHORT", value: 1 },
|
|
5409
5409
|
{ name: "coverage", type: "TABLE", value: new M.Coverage(e.coverage) }
|
|
5410
5410
|
].concat(M.tableList("seqSet", e.sequences, function(r) {
|
|
@@ -5412,7 +5412,7 @@ ct[2] = function(e) {
|
|
|
5412
5412
|
})));
|
|
5413
5413
|
};
|
|
5414
5414
|
ct[3] = function(e) {
|
|
5415
|
-
return
|
|
5415
|
+
return _.assert(e.substFormat === 1, "Lookup type 3 substFormat must be 1."), new M.Table("substitutionTable", [
|
|
5416
5416
|
{ name: "substFormat", type: "USHORT", value: 1 },
|
|
5417
5417
|
{ name: "coverage", type: "TABLE", value: new M.Coverage(e.coverage) }
|
|
5418
5418
|
].concat(M.tableList("altSet", e.alternateSets, function(r) {
|
|
@@ -5420,7 +5420,7 @@ ct[3] = function(e) {
|
|
|
5420
5420
|
})));
|
|
5421
5421
|
};
|
|
5422
5422
|
ct[4] = function(e) {
|
|
5423
|
-
return
|
|
5423
|
+
return _.assert(e.substFormat === 1, "Lookup type 4 substFormat must be 1."), new M.Table("substitutionTable", [
|
|
5424
5424
|
{ name: "substFormat", type: "USHORT", value: 1 },
|
|
5425
5425
|
{ name: "coverage", type: "TABLE", value: new M.Coverage(e.coverage) }
|
|
5426
5426
|
].concat(M.tableList("ligSet", e.ligatureSets, function(r) {
|
|
@@ -5447,7 +5447,7 @@ ct[6] = function(e) {
|
|
|
5447
5447
|
})));
|
|
5448
5448
|
return r;
|
|
5449
5449
|
} else if (e.substFormat === 2)
|
|
5450
|
-
|
|
5450
|
+
_.assert(!1, "lookup type 6 format 2 is not yet supported.");
|
|
5451
5451
|
else if (e.substFormat === 3) {
|
|
5452
5452
|
var n = [
|
|
5453
5453
|
{ name: "substFormat", type: "USHORT", value: e.substFormat }
|
|
@@ -5464,7 +5464,7 @@ ct[6] = function(e) {
|
|
|
5464
5464
|
var a = new M.Table("chainContextTable", n);
|
|
5465
5465
|
return a;
|
|
5466
5466
|
}
|
|
5467
|
-
|
|
5467
|
+
_.assert(!1, "lookup type 6 format must be 1, 2 or 3.");
|
|
5468
5468
|
};
|
|
5469
5469
|
function Ao(t) {
|
|
5470
5470
|
return new M.Table("GSUB", [
|
|
@@ -5477,7 +5477,7 @@ function Ao(t) {
|
|
|
5477
5477
|
var vi = { parse: Uo, make: Ao };
|
|
5478
5478
|
function Bo(t, e) {
|
|
5479
5479
|
var r = new D.Parser(t, e), n = r.parseULong();
|
|
5480
|
-
|
|
5480
|
+
_.argument(n === 1, "Unsupported META table version."), r.parseULong(), r.parseULong();
|
|
5481
5481
|
for (var a = r.parseULong(), i = {}, s = 0; s < a; s++) {
|
|
5482
5482
|
var o = r.parseTag(), c = r.parseULong(), u = r.parseULong(), h = ot.UTF8(t, e + c, u);
|
|
5483
5483
|
i[o] = h;
|
|
@@ -5531,9 +5531,9 @@ function mi(t) {
|
|
|
5531
5531
|
i += 1, a.push({ name: "padding", type: "BYTE", value: 0 });
|
|
5532
5532
|
for (var s = 0; s < t.length; s += 1) {
|
|
5533
5533
|
var o = t[s];
|
|
5534
|
-
|
|
5534
|
+
_.argument(o.tableName.length === 4, "Table name" + o.tableName + " is invalid.");
|
|
5535
5535
|
var c = o.sizeOf(), u = Gn(o.tableName, Qr(o.encode()), i, c);
|
|
5536
|
-
for (n.push({ name: u.tag + " Table Record", type: "RECORD", value: u }), a.push({ name: o.tableName + " table", type: "RECORD", value: o }), i += c,
|
|
5536
|
+
for (n.push({ name: u.tag + " Table Record", type: "RECORD", value: u }), a.push({ name: o.tableName + " table", type: "RECORD", value: o }), i += c, _.argument(!isNaN(i), "Something went wrong calculating the offset."); i % 4 !== 0; )
|
|
5537
5537
|
i += 1, a.push({ name: "padding", type: "BYTE", value: 0 });
|
|
5538
5538
|
}
|
|
5539
5539
|
return n.sort(function(h, d) {
|
|
@@ -5648,9 +5648,9 @@ function Ro(t) {
|
|
|
5648
5648
|
fontBBox: [0, w.yMin, w.ascender, w.advanceWidthMax]
|
|
5649
5649
|
}), G = t.metas && Object.keys(t.metas).length > 0 ? yi.make(t.metas) : void 0, W = [k, T, R, L, te, H, ne, oe, B];
|
|
5650
5650
|
ie && W.push(ie), t.tables.gsub && W.push(vi.make(t.tables.gsub)), G && W.push(G);
|
|
5651
|
-
for (var et = mi(W), At = et.encode(), Bt = Qr(At), ht = et.fields, Ot = !1,
|
|
5652
|
-
if (ht[
|
|
5653
|
-
ht[
|
|
5651
|
+
for (var et = mi(W), At = et.encode(), Bt = Qr(At), ht = et.fields, Ot = !1, _e = 0; _e < ht.length; _e += 1)
|
|
5652
|
+
if (ht[_e].name === "head table") {
|
|
5653
|
+
ht[_e].value.checkSumAdjustment = 2981146554 - Bt, Ot = !0;
|
|
5654
5654
|
break;
|
|
5655
5655
|
}
|
|
5656
5656
|
if (!Ot)
|
|
@@ -5819,7 +5819,7 @@ Ft.prototype = {
|
|
|
5819
5819
|
return i.feature;
|
|
5820
5820
|
if (n) {
|
|
5821
5821
|
var u = o.length;
|
|
5822
|
-
return
|
|
5822
|
+
return _.assert(u === 0 || r >= o[u - 1].tag, "Features must be added in alphabetical order."), i = {
|
|
5823
5823
|
tag: r,
|
|
5824
5824
|
feature: { params: 0, lookupListIndexes: [] }
|
|
5825
5825
|
}, o.push(i), s.push(u), i.feature;
|
|
@@ -6028,19 +6028,19 @@ de.prototype.addSingle = function(t, e, r, n) {
|
|
|
6028
6028
|
coverage: { format: 1, glyphs: [] },
|
|
6029
6029
|
substitute: []
|
|
6030
6030
|
});
|
|
6031
|
-
|
|
6031
|
+
_.assert(i.coverage.format === 1, "Single: unable to modify coverage table format " + i.coverage.format);
|
|
6032
6032
|
var s = e.sub, o = this.binSearch(i.coverage.glyphs, s);
|
|
6033
6033
|
o < 0 && (o = -1 - o, i.coverage.glyphs.splice(o, 0, s), i.substitute.splice(o, 0, 0)), i.substitute[o] = e.by;
|
|
6034
6034
|
};
|
|
6035
6035
|
de.prototype.addMultiple = function(t, e, r, n) {
|
|
6036
|
-
|
|
6036
|
+
_.assert(e.by instanceof Array && e.by.length > 1, 'Multiple: "by" must be an array of two or more ids');
|
|
6037
6037
|
var a = this.getLookupTables(r, n, t, 2, !0)[0], i = Jr(a, 1, {
|
|
6038
6038
|
// lookup type 2 subtable, format 1, coverage format 1
|
|
6039
6039
|
substFormat: 1,
|
|
6040
6040
|
coverage: { format: 1, glyphs: [] },
|
|
6041
6041
|
sequences: []
|
|
6042
6042
|
});
|
|
6043
|
-
|
|
6043
|
+
_.assert(i.coverage.format === 1, "Multiple: unable to modify coverage table format " + i.coverage.format);
|
|
6044
6044
|
var s = e.sub, o = this.binSearch(i.coverage.glyphs, s);
|
|
6045
6045
|
o < 0 && (o = -1 - o, i.coverage.glyphs.splice(o, 0, s), i.sequences.splice(o, 0, 0)), i.sequences[o] = e.by;
|
|
6046
6046
|
};
|
|
@@ -6051,7 +6051,7 @@ de.prototype.addAlternate = function(t, e, r, n) {
|
|
|
6051
6051
|
coverage: { format: 1, glyphs: [] },
|
|
6052
6052
|
alternateSets: []
|
|
6053
6053
|
});
|
|
6054
|
-
|
|
6054
|
+
_.assert(i.coverage.format === 1, "Alternate: unable to modify coverage table format " + i.coverage.format);
|
|
6055
6055
|
var s = e.sub, o = this.binSearch(i.coverage.glyphs, s);
|
|
6056
6056
|
o < 0 && (o = -1 - o, i.coverage.glyphs.splice(o, 0, s), i.alternateSets.splice(o, 0, 0)), i.alternateSets[o] = e.by;
|
|
6057
6057
|
};
|
|
@@ -6062,7 +6062,7 @@ de.prototype.addLigature = function(t, e, r, n) {
|
|
|
6062
6062
|
substFormat: 1,
|
|
6063
6063
|
coverage: { format: 1, glyphs: [] },
|
|
6064
6064
|
ligatureSets: []
|
|
6065
|
-
}, a.subtables[0] = i),
|
|
6065
|
+
}, a.subtables[0] = i), _.assert(i.coverage.format === 1, "Ligature: unable to modify coverage table format " + i.coverage.format);
|
|
6066
6066
|
var s = e.sub[0], o = e.sub.slice(1), c = {
|
|
6067
6067
|
ligGlyph: e.by,
|
|
6068
6068
|
components: o
|
|
@@ -6110,7 +6110,7 @@ de.prototype.add = function(t, e, r, n) {
|
|
|
6110
6110
|
function Do() {
|
|
6111
6111
|
return typeof window < "u";
|
|
6112
6112
|
}
|
|
6113
|
-
function
|
|
6113
|
+
function _o(t) {
|
|
6114
6114
|
for (var e = new Buffer(t.byteLength), r = new Uint8Array(t), n = 0; n < e.length; ++n)
|
|
6115
6115
|
e[n] = r[n];
|
|
6116
6116
|
return e;
|
|
@@ -6139,7 +6139,7 @@ function bi(t, e, r) {
|
|
|
6139
6139
|
if (i = n.parseByte(), a.push(i), (i & 8) > 0)
|
|
6140
6140
|
for (var d = n.parseByte(), p = 0; p < d; p += 1)
|
|
6141
6141
|
a.push(i), h += 1;
|
|
6142
|
-
if (
|
|
6142
|
+
if (_.argument(a.length === u, "Bad flags."), s.length > 0) {
|
|
6143
6143
|
var g = [], x;
|
|
6144
6144
|
if (u > 0) {
|
|
6145
6145
|
for (var v = 0; v < u; v += 1)
|
|
@@ -6188,18 +6188,18 @@ function ur(t, e) {
|
|
|
6188
6188
|
}
|
|
6189
6189
|
return r;
|
|
6190
6190
|
}
|
|
6191
|
-
function
|
|
6191
|
+
function Po(t) {
|
|
6192
6192
|
for (var e = [], r = [], n = 0; n < t.length; n += 1) {
|
|
6193
6193
|
var a = t[n];
|
|
6194
6194
|
r.push(a), a.lastPointOfContour && (e.push(r), r = []);
|
|
6195
6195
|
}
|
|
6196
|
-
return
|
|
6196
|
+
return _.argument(r.length === 0, "There are still points left in the current contour."), e;
|
|
6197
6197
|
}
|
|
6198
6198
|
function xi(t) {
|
|
6199
6199
|
var e = new se();
|
|
6200
6200
|
if (!t)
|
|
6201
6201
|
return e;
|
|
6202
|
-
for (var r =
|
|
6202
|
+
for (var r = Po(t), n = 0; n < r.length; ++n) {
|
|
6203
6203
|
var a = r[n], i = null, s = a[a.length - 1], o = a[0];
|
|
6204
6204
|
if (s.onCurve)
|
|
6205
6205
|
e.moveTo(s.x, s.y);
|
|
@@ -6955,11 +6955,11 @@ function Dc(t) {
|
|
|
6955
6955
|
var e = t.stack, r = e.pop(), n = e.pop();
|
|
6956
6956
|
exports.DEBUG && console.log(t.step, "LTEQ[]", r, n), e.push(n <= r ? 1 : 0);
|
|
6957
6957
|
}
|
|
6958
|
-
function
|
|
6958
|
+
function _c(t) {
|
|
6959
6959
|
var e = t.stack, r = e.pop(), n = e.pop();
|
|
6960
6960
|
exports.DEBUG && console.log(t.step, "GT[]", r, n), e.push(n > r ? 1 : 0);
|
|
6961
6961
|
}
|
|
6962
|
-
function
|
|
6962
|
+
function Pc(t) {
|
|
6963
6963
|
var e = t.stack, r = e.pop(), n = e.pop();
|
|
6964
6964
|
exports.DEBUG && console.log(t.step, "GTEQ[]", r, n), e.push(n >= r ? 1 : 0);
|
|
6965
6965
|
}
|
|
@@ -7051,7 +7051,7 @@ function nu(t) {
|
|
|
7051
7051
|
var e = t.stack, r = e.pop();
|
|
7052
7052
|
exports.DEBUG && console.log(t.step, "CEILING[]", r), e.push(Math.ceil(r / 64) * 64);
|
|
7053
7053
|
}
|
|
7054
|
-
function
|
|
7054
|
+
function Pt(t, e) {
|
|
7055
7055
|
var r = e.stack, n = r.pop();
|
|
7056
7056
|
exports.DEBUG && console.log(e.step, "ROUND[]"), r.push(e.round(n / 64) * 64);
|
|
7057
7057
|
}
|
|
@@ -7194,7 +7194,7 @@ function vu(t) {
|
|
|
7194
7194
|
throw new Error("invalid INSTCTRL[] selector");
|
|
7195
7195
|
}
|
|
7196
7196
|
}
|
|
7197
|
-
function
|
|
7197
|
+
function Pe(t, e) {
|
|
7198
7198
|
var r = e.stack, n = e.prog, a = e.ip;
|
|
7199
7199
|
exports.DEBUG && console.log(e.step, "PUSHB[" + t + "]");
|
|
7200
7200
|
for (var i = 0; i < t; i++)
|
|
@@ -7399,9 +7399,9 @@ Fi = [
|
|
|
7399
7399
|
/* 0x51 */
|
|
7400
7400
|
Dc,
|
|
7401
7401
|
/* 0x52 */
|
|
7402
|
-
Pc,
|
|
7403
|
-
/* 0x53 */
|
|
7404
7402
|
_c,
|
|
7403
|
+
/* 0x53 */
|
|
7404
|
+
Pc,
|
|
7405
7405
|
/* 0x54 */
|
|
7406
7406
|
Nc,
|
|
7407
7407
|
/* 0x55 */
|
|
@@ -7443,13 +7443,13 @@ Fi = [
|
|
|
7443
7443
|
/* 0x67 */
|
|
7444
7444
|
nu,
|
|
7445
7445
|
/* 0x68 */
|
|
7446
|
-
|
|
7446
|
+
Pt.bind(void 0, 0),
|
|
7447
7447
|
/* 0x69 */
|
|
7448
|
-
|
|
7448
|
+
Pt.bind(void 0, 1),
|
|
7449
7449
|
/* 0x6A */
|
|
7450
|
-
|
|
7450
|
+
Pt.bind(void 0, 2),
|
|
7451
7451
|
/* 0x6B */
|
|
7452
|
-
|
|
7452
|
+
Pt.bind(void 0, 3),
|
|
7453
7453
|
/* 0x6C */
|
|
7454
7454
|
void 0,
|
|
7455
7455
|
// TODO NROUND[ab]
|
|
@@ -7599,21 +7599,21 @@ Fi = [
|
|
|
7599
7599
|
/* 0xAF */
|
|
7600
7600
|
void 0,
|
|
7601
7601
|
/* 0xB0 */
|
|
7602
|
-
|
|
7602
|
+
Pe.bind(void 0, 1),
|
|
7603
7603
|
/* 0xB1 */
|
|
7604
|
-
|
|
7604
|
+
Pe.bind(void 0, 2),
|
|
7605
7605
|
/* 0xB2 */
|
|
7606
|
-
|
|
7606
|
+
Pe.bind(void 0, 3),
|
|
7607
7607
|
/* 0xB3 */
|
|
7608
|
-
|
|
7608
|
+
Pe.bind(void 0, 4),
|
|
7609
7609
|
/* 0xB4 */
|
|
7610
|
-
|
|
7610
|
+
Pe.bind(void 0, 5),
|
|
7611
7611
|
/* 0xB5 */
|
|
7612
|
-
|
|
7612
|
+
Pe.bind(void 0, 6),
|
|
7613
7613
|
/* 0xB6 */
|
|
7614
|
-
|
|
7614
|
+
Pe.bind(void 0, 7),
|
|
7615
7615
|
/* 0xB7 */
|
|
7616
|
-
|
|
7616
|
+
Pe.bind(void 0, 8),
|
|
7617
7617
|
/* 0xB8 */
|
|
7618
7618
|
Ne.bind(void 0, 1),
|
|
7619
7619
|
/* 0xB9 */
|
|
@@ -8409,7 +8409,7 @@ function Du(t) {
|
|
|
8409
8409
|
}
|
|
8410
8410
|
return !1;
|
|
8411
8411
|
}
|
|
8412
|
-
function
|
|
8412
|
+
function _u(t) {
|
|
8413
8413
|
var e = this, r = "arab", n = this.featuresTags[r], a = this.tokenizer.getRangeTokens(t);
|
|
8414
8414
|
if (a.length !== 1) {
|
|
8415
8415
|
var i = new Fe(
|
|
@@ -8466,7 +8466,7 @@ function oa(t, e) {
|
|
|
8466
8466
|
});
|
|
8467
8467
|
return new Fe(r, 0);
|
|
8468
8468
|
}
|
|
8469
|
-
function
|
|
8469
|
+
function Pu(t) {
|
|
8470
8470
|
var e = this, r = "arab", n = this.tokenizer.getRangeTokens(t), a = oa(n);
|
|
8471
8471
|
a.context.forEach(function(i, s) {
|
|
8472
8472
|
a.setCurrentIndex(s);
|
|
@@ -8591,7 +8591,7 @@ function Vu() {
|
|
|
8591
8591
|
rn.call(this);
|
|
8592
8592
|
var r = this.tokenizer.getContextRanges("arabicWord");
|
|
8593
8593
|
r.forEach(function(n) {
|
|
8594
|
-
|
|
8594
|
+
_u.call(t, n);
|
|
8595
8595
|
});
|
|
8596
8596
|
}
|
|
8597
8597
|
}
|
|
@@ -8603,7 +8603,7 @@ function Xu() {
|
|
|
8603
8603
|
rn.call(this);
|
|
8604
8604
|
var n = this.tokenizer.getContextRanges("arabicWord");
|
|
8605
8605
|
n.forEach(function(a) {
|
|
8606
|
-
|
|
8606
|
+
Pu.call(t, a);
|
|
8607
8607
|
});
|
|
8608
8608
|
}
|
|
8609
8609
|
}
|
|
@@ -8820,7 +8820,7 @@ X.prototype.download = function(t) {
|
|
|
8820
8820
|
} else
|
|
8821
8821
|
console.warn("Font file could not be downloaded. Try using a different browser.");
|
|
8822
8822
|
else {
|
|
8823
|
-
var c = require("fs"), u =
|
|
8823
|
+
var c = require("fs"), u = _o(n);
|
|
8824
8824
|
c.writeFileSync(t, u);
|
|
8825
8825
|
}
|
|
8826
8826
|
};
|
|
@@ -8935,7 +8935,7 @@ function Qu(t, e) {
|
|
|
8935
8935
|
}
|
|
8936
8936
|
function Ju(t, e, r) {
|
|
8937
8937
|
var n = new D.Parser(t, e), a = n.parseULong();
|
|
8938
|
-
|
|
8938
|
+
_.argument(a === 65536, "Unsupported fvar table version.");
|
|
8939
8939
|
var i = n.parseOffset16();
|
|
8940
8940
|
n.skip("uShort", 1);
|
|
8941
8941
|
for (var s = n.parseUShort(), o = n.parseUShort(), c = n.parseUShort(), u = n.parseUShort(), h = [], d = 0; d < s; d++)
|
|
@@ -8951,7 +8951,7 @@ var eh = { make: Qu, parse: Ju }, th = function() {
|
|
|
8951
8951
|
};
|
|
8952
8952
|
}, rh = function() {
|
|
8953
8953
|
var t = this.parseUShort();
|
|
8954
|
-
if (
|
|
8954
|
+
if (_.argument(
|
|
8955
8955
|
t === 1 || t === 2 || t === 3,
|
|
8956
8956
|
"Unsupported CaretValue table version."
|
|
8957
8957
|
), t === 1)
|
|
@@ -8973,7 +8973,7 @@ var eh = { make: Qu, parse: Ju }, th = function() {
|
|
|
8973
8973
|
function sh(t, e) {
|
|
8974
8974
|
e = e || 0;
|
|
8975
8975
|
var r = new C(t, e), n = r.parseVersion(1);
|
|
8976
|
-
|
|
8976
|
+
_.argument(
|
|
8977
8977
|
n === 1 || n === 1.2 || n === 1.3,
|
|
8978
8978
|
"Unsupported GDEF table version."
|
|
8979
8979
|
);
|
|
@@ -9001,11 +9001,11 @@ ke[1] = function() {
|
|
|
9001
9001
|
coverage: this.parsePointer(C.coverage),
|
|
9002
9002
|
values: this.parseValueRecordList()
|
|
9003
9003
|
};
|
|
9004
|
-
|
|
9004
|
+
_.assert(!1, "0x" + e.toString(16) + ": GPOS lookup type 1 format must be 1 or 2.");
|
|
9005
9005
|
};
|
|
9006
9006
|
ke[2] = function() {
|
|
9007
9007
|
var e = this.offset + this.relativeOffset, r = this.parseUShort();
|
|
9008
|
-
|
|
9008
|
+
_.assert(r === 1 || r === 2, "0x" + e.toString(16) + ": GPOS lookup type 2 format must be 1 or 2.");
|
|
9009
9009
|
var n = this.parsePointer(C.coverage), a = this.parseUShort(), i = this.parseUShort();
|
|
9010
9010
|
if (r === 1)
|
|
9011
9011
|
return {
|
|
@@ -9067,7 +9067,7 @@ ke[9] = function() {
|
|
|
9067
9067
|
function ch(t, e) {
|
|
9068
9068
|
e = e || 0;
|
|
9069
9069
|
var r = new C(t, e), n = r.parseVersion(1);
|
|
9070
|
-
return
|
|
9070
|
+
return _.argument(n === 1 || n === 1.1, "Unsupported GPOS table version " + n), n === 1 ? {
|
|
9071
9071
|
version: n,
|
|
9072
9072
|
scripts: r.parseScriptList(),
|
|
9073
9073
|
features: r.parseFeatureList(),
|
|
@@ -9094,7 +9094,7 @@ function fh(t) {
|
|
|
9094
9094
|
var e = {};
|
|
9095
9095
|
t.skip("uShort");
|
|
9096
9096
|
var r = t.parseUShort();
|
|
9097
|
-
|
|
9097
|
+
_.argument(r === 0, "Unsupported kern sub-table version."), t.skip("uShort", 2);
|
|
9098
9098
|
var n = t.parseUShort();
|
|
9099
9099
|
t.skip("uShort", 3);
|
|
9100
9100
|
for (var a = 0; a < n; a += 1) {
|
|
@@ -9447,7 +9447,7 @@ function xh(t, e = 1e-4) {
|
|
|
9447
9447
|
}
|
|
9448
9448
|
return m.setIndex(h), m;
|
|
9449
9449
|
}
|
|
9450
|
-
new
|
|
9450
|
+
new P.Vector2();
|
|
9451
9451
|
class fa extends Ia {
|
|
9452
9452
|
constructor(e, r, n) {
|
|
9453
9453
|
super(), this.isFound = !1, this.char = e, this.fontSize = r, this.font = n, this.width = this.getCharWidth(e, r, n);
|
|
@@ -9464,7 +9464,7 @@ class fa extends Ia {
|
|
|
9464
9464
|
);
|
|
9465
9465
|
if (e == null) {
|
|
9466
9466
|
const r = this.font.generateShapes(this.char, this.fontSize);
|
|
9467
|
-
return e = new
|
|
9467
|
+
return e = new P.ShapeGeometry(r, 4), e.hasAttribute("uv") && e.deleteAttribute("uv"), e.hasAttribute("normal") && e.deleteAttribute("normal"), xh(e, 1e-6);
|
|
9468
9468
|
}
|
|
9469
9469
|
return e;
|
|
9470
9470
|
}
|
|
@@ -10140,7 +10140,7 @@ class Dh {
|
|
|
10140
10140
|
}
|
|
10141
10141
|
}
|
|
10142
10142
|
}
|
|
10143
|
-
class
|
|
10143
|
+
class _h {
|
|
10144
10144
|
parse(e) {
|
|
10145
10145
|
try {
|
|
10146
10146
|
e.readInt16();
|
|
@@ -10177,7 +10177,7 @@ class Ph {
|
|
|
10177
10177
|
try {
|
|
10178
10178
|
const c = this.utf8ArrayToStr(o);
|
|
10179
10179
|
let u = c.pos;
|
|
10180
|
-
u >= 0 && (s.info = c.text, u++, u +
|
|
10180
|
+
u >= 0 && (s.info = c.text, u++, u + 3 < o.length && (o.length - u > 4 ? (s.height = o[u++], u++, s.orientation = o[u++] === 0 ? "horizontal" : "vertical", s.width = o[u++], s.baseUp = s.height, s.baseDown = 0, s.isExtended = !0) : (s.baseUp = o[u++], s.baseDown = o[u++], s.height = s.baseDown + s.baseUp, s.width = s.height, s.orientation = o[u] === 0 ? "horizontal" : "vertical")));
|
|
10181
10181
|
} catch {
|
|
10182
10182
|
console.warn("Failed to parse bigfont info block");
|
|
10183
10183
|
}
|
|
@@ -10199,7 +10199,7 @@ class Ph {
|
|
|
10199
10199
|
utf8ArrayToStr(e) {
|
|
10200
10200
|
let r = "", n = 0;
|
|
10201
10201
|
for (; n < e.length; ) {
|
|
10202
|
-
const a = e[n
|
|
10202
|
+
const a = e[n];
|
|
10203
10203
|
switch (a >> 4) {
|
|
10204
10204
|
case 0:
|
|
10205
10205
|
case 1:
|
|
@@ -10226,11 +10226,12 @@ class Ph {
|
|
|
10226
10226
|
}
|
|
10227
10227
|
}
|
|
10228
10228
|
if (r.charCodeAt(r.length - 1) === 0) break;
|
|
10229
|
+
n++;
|
|
10229
10230
|
}
|
|
10230
10231
|
return { text: r, pos: n };
|
|
10231
10232
|
}
|
|
10232
10233
|
}
|
|
10233
|
-
class
|
|
10234
|
+
class Ph {
|
|
10234
10235
|
parse(e) {
|
|
10235
10236
|
try {
|
|
10236
10237
|
const r = e.readInt32();
|
|
@@ -10290,9 +10291,9 @@ let Nh = class {
|
|
|
10290
10291
|
case fe.SHAPES:
|
|
10291
10292
|
return new Dh();
|
|
10292
10293
|
case fe.BIGFONT:
|
|
10293
|
-
return new Ph();
|
|
10294
|
-
case fe.UNIFONT:
|
|
10295
10294
|
return new _h();
|
|
10295
|
+
case fe.UNIFONT:
|
|
10296
|
+
return new Ph();
|
|
10296
10297
|
default:
|
|
10297
10298
|
throw new Error(`Unsupported font type: ${e}`);
|
|
10298
10299
|
}
|
|
@@ -10952,7 +10953,7 @@ class Hh {
|
|
|
10952
10953
|
i = this.parseShape(o), this.shapeData.set(e, i), this.shapeCache.set(e, i);
|
|
10953
10954
|
}
|
|
10954
10955
|
const s = i.normalizeToOrigin(!0);
|
|
10955
|
-
return this.scaleShapeByHeightAndWidth(s, n, r).offset(a);
|
|
10956
|
+
return this.scaleShapeByHeightAndWidth(s, n, r).offset(a, !1);
|
|
10956
10957
|
}
|
|
10957
10958
|
/**
|
|
10958
10959
|
* Handles drawing an arc segment with the given vector and bulge
|
|
@@ -11341,7 +11342,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11341
11342
|
return f;
|
|
11342
11343
|
case "utf8":
|
|
11343
11344
|
case "utf-8":
|
|
11344
|
-
return
|
|
11345
|
+
return _e(y).length;
|
|
11345
11346
|
case "ucs2":
|
|
11346
11347
|
case "ucs-2":
|
|
11347
11348
|
case "utf16le":
|
|
@@ -11353,7 +11354,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11353
11354
|
return fn(y).length;
|
|
11354
11355
|
default:
|
|
11355
11356
|
if (E)
|
|
11356
|
-
return b ? -1 :
|
|
11357
|
+
return b ? -1 : _e(y).length;
|
|
11357
11358
|
l = ("" + l).toLowerCase(), E = !0;
|
|
11358
11359
|
}
|
|
11359
11360
|
}
|
|
@@ -11506,7 +11507,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11506
11507
|
return A;
|
|
11507
11508
|
}
|
|
11508
11509
|
function H(y, l, f, b) {
|
|
11509
|
-
return Lt(
|
|
11510
|
+
return Lt(_e(l, y.length - f), y, f, b);
|
|
11510
11511
|
}
|
|
11511
11512
|
function q(y, l, f, b) {
|
|
11512
11513
|
return Lt(Di(l), y, f, b);
|
|
@@ -11515,7 +11516,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11515
11516
|
return Lt(fn(l), y, f, b);
|
|
11516
11517
|
}
|
|
11517
11518
|
function ue(y, l, f, b) {
|
|
11518
|
-
return Lt(
|
|
11519
|
+
return Lt(_i(l, y.length - f), y, f, b);
|
|
11519
11520
|
}
|
|
11520
11521
|
o.prototype.write = function(l, f, b, E) {
|
|
11521
11522
|
if (f === void 0)
|
|
@@ -11617,7 +11618,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11617
11618
|
var b = y.length;
|
|
11618
11619
|
(!l || l < 0) && (l = 0), (!f || f < 0 || f > b) && (f = b);
|
|
11619
11620
|
for (var E = "", U = l; U < f; ++U)
|
|
11620
|
-
E +=
|
|
11621
|
+
E += Pi[y[U]];
|
|
11621
11622
|
return E;
|
|
11622
11623
|
}
|
|
11623
11624
|
function oe(y, l, f) {
|
|
@@ -11819,7 +11820,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11819
11820
|
y = y + "=";
|
|
11820
11821
|
return y;
|
|
11821
11822
|
}
|
|
11822
|
-
function
|
|
11823
|
+
function _e(y, l) {
|
|
11823
11824
|
l = l || 1 / 0;
|
|
11824
11825
|
for (var f, b = y.length, E = null, U = [], A = 0; A < b; ++A) {
|
|
11825
11826
|
if (f = y.charCodeAt(A), f > 55295 && f < 57344) {
|
|
@@ -11874,7 +11875,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11874
11875
|
l.push(y.charCodeAt(f) & 255);
|
|
11875
11876
|
return l;
|
|
11876
11877
|
}
|
|
11877
|
-
function
|
|
11878
|
+
function _i(y, l) {
|
|
11878
11879
|
for (var f, b, E, U = [], A = 0; A < y.length && !((l -= 2) < 0); ++A)
|
|
11879
11880
|
f = y.charCodeAt(A), b = f >> 8, E = f % 256, U.push(E), U.push(b);
|
|
11880
11881
|
return U;
|
|
@@ -11893,7 +11894,7 @@ an.write = function(t, e, r, n, a, i) {
|
|
|
11893
11894
|
function tr(y) {
|
|
11894
11895
|
return y !== y;
|
|
11895
11896
|
}
|
|
11896
|
-
var
|
|
11897
|
+
var Pi = function() {
|
|
11897
11898
|
for (var y = "0123456789abcdef", l = new Array(256), f = 0; f < 16; ++f)
|
|
11898
11899
|
for (var b = f * 16, E = 0; E < 16; ++E)
|
|
11899
11900
|
l[b + E] = y[f] + y[E];
|
|
@@ -22129,7 +22130,7 @@ class un extends Ia {
|
|
|
22129
22130
|
if (e == null) {
|
|
22130
22131
|
const r = this.shape.polylines, n = [], a = [];
|
|
22131
22132
|
let i = 0;
|
|
22132
|
-
e = new
|
|
22133
|
+
e = new P.BufferGeometry();
|
|
22133
22134
|
for (let s = 0; s < r.length; s++) {
|
|
22134
22135
|
const o = r[s];
|
|
22135
22136
|
for (let c = 0; c < o.length; c++) {
|
|
@@ -22139,7 +22140,7 @@ class un extends Ia {
|
|
|
22139
22140
|
}
|
|
22140
22141
|
e.setAttribute(
|
|
22141
22142
|
"position",
|
|
22142
|
-
new
|
|
22143
|
+
new P.Float32BufferAttribute(n, 3)
|
|
22143
22144
|
), e.setIndex(a);
|
|
22144
22145
|
}
|
|
22145
22146
|
return e;
|
|
@@ -22268,7 +22269,7 @@ class Le {
|
|
|
22268
22269
|
fontNotFound: new mn(),
|
|
22269
22270
|
/** Event triggered when a font is successfully loaded */
|
|
22270
22271
|
fontLoaded: new mn()
|
|
22271
|
-
}, this.loader = new
|
|
22272
|
+
}, this.loader = new P.FileLoader(), this.loader.setResponseType("arraybuffer"), this.fileNames = [], this.fontLoader = new Cl();
|
|
22272
22273
|
}
|
|
22273
22274
|
/**
|
|
22274
22275
|
* Gets the singleton instance of the FontManager
|
|
@@ -22378,12 +22379,14 @@ class Le {
|
|
|
22378
22379
|
if (this.loadedFontMap.size === 0)
|
|
22379
22380
|
return;
|
|
22380
22381
|
e == null && (e = "");
|
|
22381
|
-
const n =
|
|
22382
|
-
|
|
22382
|
+
const n = e.lastIndexOf(".");
|
|
22383
|
+
(n > 0 && n == e.length - 4 || n == e.length - 5) && (e = e.substring(0, n));
|
|
22384
|
+
const a = this.loadedFontMap.get(e.toLowerCase());
|
|
22385
|
+
if (!a) {
|
|
22383
22386
|
r && this.recordMissedFonts(e);
|
|
22384
22387
|
return;
|
|
22385
22388
|
}
|
|
22386
|
-
return
|
|
22389
|
+
return a;
|
|
22387
22390
|
}
|
|
22388
22391
|
/**
|
|
22389
22392
|
* Gets the first font which contains the specified character.
|
|
@@ -22458,7 +22461,7 @@ class Le {
|
|
|
22458
22461
|
* @param fontInfo - The matadata of the font to be loaded
|
|
22459
22462
|
*/
|
|
22460
22463
|
async loadFont(e) {
|
|
22461
|
-
if (!
|
|
22464
|
+
if (!Pa(e.file))
|
|
22462
22465
|
throw new Error(`Invalid font file name: ${e.file}`);
|
|
22463
22466
|
const n = this.fontInfoToFontData(e), a = n.name;
|
|
22464
22467
|
if (this.isFontLoaded(n.name))
|
|
@@ -23678,7 +23681,7 @@ class Cr {
|
|
|
23678
23681
|
}
|
|
23679
23682
|
}
|
|
23680
23683
|
var wt = /* @__PURE__ */ ((t) => (t[t.LEFT_TO_RIGHT = 1] = "LEFT_TO_RIGHT", t[t.RIGHT_TO_LEFT = 2] = "RIGHT_TO_LEFT", t[t.TOP_TO_BOTTOM = 3] = "TOP_TO_BOTTOM", t[t.BOTTOM_TO_TOP = 4] = "BOTTOM_TO_TOP", t[t.BY_STYLE = 5] = "BY_STYLE", t))(wt || {}), Rl = /* @__PURE__ */ ((t) => (t[t.TopLeft = 1] = "TopLeft", t[t.TopCenter = 2] = "TopCenter", t[t.TopRight = 3] = "TopRight", t[t.MiddleLeft = 4] = "MiddleLeft", t[t.MiddleCenter = 5] = "MiddleCenter", t[t.MiddleRight = 6] = "MiddleRight", t[t.BottomLeft = 7] = "BottomLeft", t[t.BottomCenter = 8] = "BottomCenter", t[t.BottomRight = 9] = "BottomRight", t))(Rl || {});
|
|
23681
|
-
const Ml = /* @__PURE__ */ new
|
|
23684
|
+
const Ml = /* @__PURE__ */ new P.Vector3(), Il = 1.666666;
|
|
23682
23685
|
class ln extends Ut {
|
|
23683
23686
|
/**
|
|
23684
23687
|
* Creates a new RenderContext instance with optional initial values.
|
|
@@ -23956,7 +23959,7 @@ class Dl {
|
|
|
23956
23959
|
* @param item Input texts to render
|
|
23957
23960
|
*/
|
|
23958
23961
|
processText(e) {
|
|
23959
|
-
const r = [], n = [], a = new
|
|
23962
|
+
const r = [], n = [], a = new P.Group();
|
|
23960
23963
|
for (const i of e)
|
|
23961
23964
|
if (i.type === nt.NEW_PARAGRAPH)
|
|
23962
23965
|
this.startNewParagraph(r, n, a);
|
|
@@ -24047,7 +24050,7 @@ class Dl {
|
|
|
24047
24050
|
k
|
|
24048
24051
|
);
|
|
24049
24052
|
if (r.push(...w), n.push(...k), s === "/" || s === "#") {
|
|
24050
|
-
const T = new
|
|
24053
|
+
const T = new P.BufferGeometry(), R = new Float32Array([
|
|
24051
24054
|
o,
|
|
24052
24055
|
c - this.currentFontSize * 0.8,
|
|
24053
24056
|
0,
|
|
@@ -24057,7 +24060,7 @@ class Dl {
|
|
|
24057
24060
|
]);
|
|
24058
24061
|
T.setAttribute(
|
|
24059
24062
|
"position",
|
|
24060
|
-
new
|
|
24063
|
+
new P.BufferAttribute(R, 3)
|
|
24061
24064
|
), T.setIndex(null), n.push(T);
|
|
24062
24065
|
}
|
|
24063
24066
|
this._hOffset = o + x;
|
|
@@ -24080,7 +24083,7 @@ class Dl {
|
|
|
24080
24083
|
i.scale(this.currentWidthFactor, 1, 1);
|
|
24081
24084
|
let s = this._currentContext.oblique;
|
|
24082
24085
|
if (this._currentContext.italic && (s += 15), s) {
|
|
24083
|
-
const x = s * Math.PI / 180, v = new
|
|
24086
|
+
const x = s * Math.PI / 180, v = new P.Matrix4();
|
|
24084
24087
|
v.set(
|
|
24085
24088
|
1,
|
|
24086
24089
|
Math.tan(x),
|
|
@@ -24106,10 +24109,10 @@ class Dl {
|
|
|
24106
24109
|
i.translate(c, u, 0), this.currentHorizontalAlignment == Se.DISTRIBUTED ? this._hOffset += a.width * this.currentWidthFactor : this._hOffset += a.width * this.currentWordSpace * this.currentWidthFactor, r.push(i);
|
|
24107
24110
|
const p = d * 0.05, g = 1e-3;
|
|
24108
24111
|
if (this._currentContext.underline) {
|
|
24109
|
-
const x = new
|
|
24112
|
+
const x = new P.BufferGeometry(), v = u - p;
|
|
24110
24113
|
x.setAttribute(
|
|
24111
24114
|
"position",
|
|
24112
|
-
new
|
|
24115
|
+
new P.BufferAttribute(
|
|
24113
24116
|
new Float32Array([
|
|
24114
24117
|
c,
|
|
24115
24118
|
v,
|
|
@@ -24123,10 +24126,10 @@ class Dl {
|
|
|
24123
24126
|
), x.setIndex(null), n.push(x);
|
|
24124
24127
|
}
|
|
24125
24128
|
if (this._currentContext.overline) {
|
|
24126
|
-
const x = new
|
|
24129
|
+
const x = new P.BufferGeometry(), v = u + d + p;
|
|
24127
24130
|
x.setAttribute(
|
|
24128
24131
|
"position",
|
|
24129
|
-
new
|
|
24132
|
+
new P.BufferAttribute(
|
|
24130
24133
|
new Float32Array([
|
|
24131
24134
|
c,
|
|
24132
24135
|
v,
|
|
@@ -24140,10 +24143,10 @@ class Dl {
|
|
|
24140
24143
|
), x.setIndex(null), n.push(x);
|
|
24141
24144
|
}
|
|
24142
24145
|
if (this._currentContext.strikeThrough) {
|
|
24143
|
-
const x = new
|
|
24146
|
+
const x = new P.BufferGeometry(), v = u + d / 2 - d * 0.2;
|
|
24144
24147
|
x.setAttribute(
|
|
24145
24148
|
"position",
|
|
24146
|
-
new
|
|
24149
|
+
new P.BufferAttribute(
|
|
24147
24150
|
new Float32Array([
|
|
24148
24151
|
c,
|
|
24149
24152
|
v,
|
|
@@ -24271,17 +24274,17 @@ class Dl {
|
|
|
24271
24274
|
* @returns Return three.js object created from the specified text shape geometries
|
|
24272
24275
|
*/
|
|
24273
24276
|
toThreeObject(e, r) {
|
|
24274
|
-
const n = new
|
|
24277
|
+
const n = new P.Group(), a = this._currentContext.getColorAsHex(), i = e.filter((o) => o instanceof P.ShapeGeometry);
|
|
24275
24278
|
if (i.length > 0) {
|
|
24276
|
-
const o = new
|
|
24279
|
+
const o = new P.Mesh();
|
|
24277
24280
|
o.geometry = ha(i), o.material = this.styleManager.getMeshBasicMaterial(a), o.userData.bboxIntersectionCheck = !0, n.add(o);
|
|
24278
24281
|
}
|
|
24279
24282
|
const s = [
|
|
24280
24283
|
...r,
|
|
24281
|
-
...e.filter((o) => !(o instanceof
|
|
24284
|
+
...e.filter((o) => !(o instanceof P.ShapeGeometry))
|
|
24282
24285
|
];
|
|
24283
24286
|
if (s.length > 0) {
|
|
24284
|
-
const o = new
|
|
24287
|
+
const o = new P.LineSegments();
|
|
24285
24288
|
o.geometry = ha(s), o.material = this.styleManager.getLineBasicMaterial(a), o.userData.bboxIntersectionCheck = !0, n.add(o);
|
|
24286
24289
|
}
|
|
24287
24290
|
return n.children.length === 1 ? n.children[0] : n;
|
|
@@ -24293,8 +24296,8 @@ class Dl {
|
|
|
24293
24296
|
this._currentContext.fontSize = e * this._currentContext.fontScaleFactor * this._currentContext.fontSizeScaleFactor, this.calcuateLineParams();
|
|
24294
24297
|
}
|
|
24295
24298
|
}
|
|
24296
|
-
const Ur = /* @__PURE__ */ new
|
|
24297
|
-
class $t extends
|
|
24299
|
+
const Ur = /* @__PURE__ */ new P.Vector3(), je = /* @__PURE__ */ new P.Vector3(), Ar = /* @__PURE__ */ new P.Vector3(), Br = /* @__PURE__ */ new P.Quaternion(), Or = /* @__PURE__ */ new P.Matrix4(), Ba = /* @__PURE__ */ new P.Matrix4(), Oa = /* @__PURE__ */ new P.Vector3(1, 0, 0);
|
|
24300
|
+
class $t extends P.Object3D {
|
|
24298
24301
|
/**
|
|
24299
24302
|
* Extracts all unique font names used in an MText string.
|
|
24300
24303
|
* This function searches for font commands in the format \f{fontname}| or \f{fontname}; and returns a set of unique font names.
|
|
@@ -24328,7 +24331,7 @@ class $t extends _.Object3D {
|
|
|
24328
24331
|
super(), this._style = r, this._styleManager = n, this._fontManager = a, this._colorSettings = {
|
|
24329
24332
|
byLayerColor: i.byLayerColor,
|
|
24330
24333
|
byBlockColor: i.byBlockColor
|
|
24331
|
-
}, this._box = new
|
|
24334
|
+
}, this._box = new P.Box3(), this._boxes = [], this._mtextData = e, this._fontsInStyleLoaded = !1;
|
|
24332
24335
|
}
|
|
24333
24336
|
/**
|
|
24334
24337
|
* Gets the font manager instance associated with this MText object.
|
|
@@ -24349,7 +24352,21 @@ class $t extends _.Object3D {
|
|
|
24349
24352
|
*/
|
|
24350
24353
|
async asyncDraw() {
|
|
24351
24354
|
const e = Array.from($t.getFonts(this._mtextData.text || "", !0));
|
|
24352
|
-
|
|
24355
|
+
if (!this._fontsInStyleLoaded) {
|
|
24356
|
+
if (this._style.font) {
|
|
24357
|
+
const r = this.getFontName(this._style.font);
|
|
24358
|
+
r && e.push(r);
|
|
24359
|
+
}
|
|
24360
|
+
if (this._style.bigFont) {
|
|
24361
|
+
const r = this.getFontName(this._style.bigFont);
|
|
24362
|
+
r && e.push(r);
|
|
24363
|
+
}
|
|
24364
|
+
if (this._style.extendedFont) {
|
|
24365
|
+
const r = this.getFontName(this._style.extendedFont);
|
|
24366
|
+
r && e.push(r);
|
|
24367
|
+
}
|
|
24368
|
+
}
|
|
24369
|
+
e.length > 0 && (await this._fontManager.loadFontsByNames(e), this._fontsInStyleLoaded = !0), this.syncDraw();
|
|
24353
24370
|
}
|
|
24354
24371
|
/**
|
|
24355
24372
|
* Draw the MText object. This method assumes that fonts needed are loaded. If font needed
|
|
@@ -24427,7 +24444,7 @@ class $t extends _.Object3D {
|
|
|
24427
24444
|
});
|
|
24428
24445
|
let o = e.rotation || 0;
|
|
24429
24446
|
if (e.directionVector) {
|
|
24430
|
-
const u = e.directionVector, h = new
|
|
24447
|
+
const u = e.directionVector, h = new P.Vector3(u.x, u.y, u.z), d = h.clone().cross(Oa), p = Oa.angleTo(h);
|
|
24431
24448
|
o = d.z > 0 ? -p : p;
|
|
24432
24449
|
}
|
|
24433
24450
|
n.matrix.compose(je, Br, Ar);
|
|
@@ -24527,10 +24544,10 @@ class $t extends _.Object3D {
|
|
|
24527
24544
|
* @param boxes - Array to store the calculated bounding boxes
|
|
24528
24545
|
*/
|
|
24529
24546
|
getBoxes(e, r) {
|
|
24530
|
-
if (e.updateWorldMatrix(!1, !1), e instanceof
|
|
24547
|
+
if (e.updateWorldMatrix(!1, !1), e instanceof P.Line || e instanceof P.Mesh) {
|
|
24531
24548
|
const a = e.geometry;
|
|
24532
24549
|
a.boundingBox === null && a.computeBoundingBox();
|
|
24533
|
-
const i = new
|
|
24550
|
+
const i = new P.Box3().copy(a.boundingBox);
|
|
24534
24551
|
i.applyMatrix4(e.matrixWorld), r.push(i);
|
|
24535
24552
|
}
|
|
24536
24553
|
const n = e.children;
|
|
@@ -24561,23 +24578,29 @@ class $t extends _.Object3D {
|
|
|
24561
24578
|
}
|
|
24562
24579
|
});
|
|
24563
24580
|
}
|
|
24581
|
+
getFontName(e) {
|
|
24582
|
+
if (e) {
|
|
24583
|
+
const r = e.lastIndexOf(".");
|
|
24584
|
+
return r >= 0 ? e.substring(0, r).toLowerCase() : e.toLowerCase();
|
|
24585
|
+
}
|
|
24586
|
+
}
|
|
24564
24587
|
}
|
|
24565
24588
|
class Ii {
|
|
24566
24589
|
constructor() {
|
|
24567
24590
|
this.lineBasicMaterials = {}, this.meshBasicMaterials = {}, this.unsupportedTextStyles = {};
|
|
24568
24591
|
}
|
|
24569
24592
|
getMeshBasicMaterial(e) {
|
|
24570
|
-
return this.meshBasicMaterials[e] || (this.meshBasicMaterials[e] = new
|
|
24593
|
+
return this.meshBasicMaterials[e] || (this.meshBasicMaterials[e] = new P.MeshBasicMaterial({
|
|
24571
24594
|
color: e
|
|
24572
24595
|
})), this.meshBasicMaterials[e];
|
|
24573
24596
|
}
|
|
24574
24597
|
getLineBasicMaterial(e) {
|
|
24575
|
-
return this.lineBasicMaterials[e] || (this.lineBasicMaterials[e] = new
|
|
24598
|
+
return this.lineBasicMaterials[e] || (this.lineBasicMaterials[e] = new P.LineBasicMaterial({
|
|
24576
24599
|
color: e
|
|
24577
24600
|
})), this.lineBasicMaterials[e];
|
|
24578
24601
|
}
|
|
24579
24602
|
}
|
|
24580
|
-
class
|
|
24603
|
+
class _l {
|
|
24581
24604
|
constructor(e = {}) {
|
|
24582
24605
|
this.workers = [], this.inFlightPerWorker = [], this.pendingRequests = /* @__PURE__ */ new Map(), this.requestId = 0, this.readyPromise = null, this.poolSize = e.poolSize ?? Math.max(
|
|
24583
24606
|
1,
|
|
@@ -24730,15 +24753,15 @@ class Pl {
|
|
|
24730
24753
|
* Reconstruct MText object from JSON serialized data
|
|
24731
24754
|
*/
|
|
24732
24755
|
reconstructMText(e) {
|
|
24733
|
-
const r = new
|
|
24756
|
+
const r = new P.Group();
|
|
24734
24757
|
return e.children.forEach((n) => {
|
|
24735
|
-
const a = new
|
|
24758
|
+
const a = new P.BufferGeometry();
|
|
24736
24759
|
if (Object.keys(n.geometry.attributes).forEach((o) => {
|
|
24737
24760
|
const c = n.geometry.attributes[o], u = new Float32Array(
|
|
24738
24761
|
c.arrayBuffer,
|
|
24739
24762
|
c.byteOffset,
|
|
24740
24763
|
c.length
|
|
24741
|
-
), h = new
|
|
24764
|
+
), h = new P.BufferAttribute(
|
|
24742
24765
|
u,
|
|
24743
24766
|
c.itemSize,
|
|
24744
24767
|
c.normalized
|
|
@@ -24751,14 +24774,14 @@ class Pl {
|
|
|
24751
24774
|
n.geometry.index.byteOffset,
|
|
24752
24775
|
n.geometry.index.length
|
|
24753
24776
|
);
|
|
24754
|
-
a.setIndex(new
|
|
24777
|
+
a.setIndex(new P.Uint32BufferAttribute(c, 1));
|
|
24755
24778
|
} else {
|
|
24756
24779
|
const c = new Uint16Array(
|
|
24757
24780
|
n.geometry.index.arrayBuffer,
|
|
24758
24781
|
n.geometry.index.byteOffset,
|
|
24759
24782
|
n.geometry.index.length
|
|
24760
24783
|
);
|
|
24761
|
-
a.setIndex(new
|
|
24784
|
+
a.setIndex(new P.Uint16BufferAttribute(c, 1));
|
|
24762
24785
|
}
|
|
24763
24786
|
let i;
|
|
24764
24787
|
n.type === "mesh" ? (i = this.styleManager.getMeshBasicMaterial(
|
|
@@ -24767,7 +24790,7 @@ class Pl {
|
|
|
24767
24790
|
n.material.color
|
|
24768
24791
|
), n.material.transparent !== void 0 && (i.transparent = n.material.transparent), n.material.opacity !== void 0 && (i.opacity = n.material.opacity), n.material.linewidth !== void 0 && (i.linewidth = n.material.linewidth));
|
|
24769
24792
|
let s;
|
|
24770
|
-
n.type === "mesh" ? s = new
|
|
24793
|
+
n.type === "mesh" ? s = new P.Mesh(a, i) : s = new P.LineSegments(
|
|
24771
24794
|
a,
|
|
24772
24795
|
i
|
|
24773
24796
|
), a.boundingBox || a.computeBoundingBox(), a.boundingSphere || a.computeBoundingSphere(), s.position.set(
|
|
@@ -24780,13 +24803,13 @@ class Pl {
|
|
|
24780
24803
|
n.rotation.z,
|
|
24781
24804
|
n.rotation.w
|
|
24782
24805
|
), s.scale.set(n.scale.x, n.scale.y, n.scale.z), r.add(s);
|
|
24783
|
-
}), r.box = new
|
|
24784
|
-
new
|
|
24806
|
+
}), r.box = new P.Box3(
|
|
24807
|
+
new P.Vector3(
|
|
24785
24808
|
e.box.min.x,
|
|
24786
24809
|
e.box.min.y,
|
|
24787
24810
|
e.box.min.z
|
|
24788
24811
|
),
|
|
24789
|
-
new
|
|
24812
|
+
new P.Vector3(
|
|
24790
24813
|
e.box.max.x,
|
|
24791
24814
|
e.box.max.y,
|
|
24792
24815
|
e.box.max.z
|
|
@@ -24805,7 +24828,7 @@ class Pl {
|
|
|
24805
24828
|
this.terminate();
|
|
24806
24829
|
}
|
|
24807
24830
|
}
|
|
24808
|
-
class
|
|
24831
|
+
class Pl {
|
|
24809
24832
|
constructor() {
|
|
24810
24833
|
this.fontManager = Le.instance, this.styleManager = new Ii(), this.isInitialized = !1;
|
|
24811
24834
|
}
|
|
@@ -24878,7 +24901,7 @@ class zl {
|
|
|
24878
24901
|
* when render mode is 'worker'.
|
|
24879
24902
|
*/
|
|
24880
24903
|
constructor(e = "main", r = {}) {
|
|
24881
|
-
this.defaultMode = e, this.mainThreadRenderer = new
|
|
24904
|
+
this.defaultMode = e, this.mainThreadRenderer = new Pl(), this.webWorkerRenderer = new _l(r), this.renderer = this.mainThreadRenderer, e === "worker" && (this.renderer = this.webWorkerRenderer);
|
|
24882
24905
|
}
|
|
24883
24906
|
/**
|
|
24884
24907
|
* Sets the default rendering mmode
|
|
@@ -24957,8 +24980,8 @@ export {
|
|
|
24957
24980
|
$t as MText,
|
|
24958
24981
|
Rl as MTextAttachmentPoint,
|
|
24959
24982
|
wt as MTextFlowDirection,
|
|
24960
|
-
|
|
24983
|
+
Pl as MainThreadRenderer,
|
|
24961
24984
|
Ii as StyleManager,
|
|
24962
24985
|
zl as UnifiedRenderer,
|
|
24963
|
-
|
|
24986
|
+
_l as WebWorkerRenderer
|
|
24964
24987
|
};
|