@mlightcad/mtext-renderer 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +200 -142
- package/dist/index.umd.cjs +2 -2
- package/dist/renderer/mtextProcessor.d.ts +11 -1
- package/dist/renderer/types.d.ts +33 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -761,7 +761,7 @@ var kn = new Ve(), Tn = new Ve(), $t = new Uint8Array(30), er = new Uint16Array(
|
|
|
761
761
|
14,
|
|
762
762
|
1,
|
|
763
763
|
15
|
|
764
|
-
]), Sr = new Ve(),
|
|
764
|
+
]), Sr = new Ve(), ce = new Uint8Array(320);
|
|
765
765
|
function wn(t, e, r, n) {
|
|
766
766
|
var a, s;
|
|
767
767
|
for (a = 0; a < r; ++a)
|
|
@@ -805,7 +805,7 @@ function Ha(t) {
|
|
|
805
805
|
var e = t.tag & 1;
|
|
806
806
|
return t.tag >>>= 1, e;
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function he(t, e, r) {
|
|
809
809
|
if (!e)
|
|
810
810
|
return r;
|
|
811
811
|
for (; t.bitcount < 24; )
|
|
@@ -824,34 +824,34 @@ function Wt(t, e) {
|
|
|
824
824
|
}
|
|
825
825
|
function za(t, e, r) {
|
|
826
826
|
var n, a, s, i, u, o;
|
|
827
|
-
for (n =
|
|
828
|
-
|
|
827
|
+
for (n = he(t, 5, 257), a = he(t, 5, 1), s = he(t, 4, 4), i = 0; i < 19; ++i)
|
|
828
|
+
ce[i] = 0;
|
|
829
829
|
for (i = 0; i < s; ++i) {
|
|
830
|
-
var l =
|
|
831
|
-
|
|
830
|
+
var l = he(t, 3, 0);
|
|
831
|
+
ce[Na[i]] = l;
|
|
832
832
|
}
|
|
833
|
-
for (Ft(Sr,
|
|
833
|
+
for (Ft(Sr, ce, 0, 19), u = 0; u < n + a; ) {
|
|
834
834
|
var c = Wt(t, Sr);
|
|
835
835
|
switch (c) {
|
|
836
836
|
case 16:
|
|
837
|
-
var f =
|
|
838
|
-
for (o =
|
|
839
|
-
|
|
837
|
+
var f = ce[u - 1];
|
|
838
|
+
for (o = he(t, 2, 3); o; --o)
|
|
839
|
+
ce[u++] = f;
|
|
840
840
|
break;
|
|
841
841
|
case 17:
|
|
842
|
-
for (o =
|
|
843
|
-
|
|
842
|
+
for (o = he(t, 3, 3); o; --o)
|
|
843
|
+
ce[u++] = 0;
|
|
844
844
|
break;
|
|
845
845
|
case 18:
|
|
846
|
-
for (o =
|
|
847
|
-
|
|
846
|
+
for (o = he(t, 7, 11); o; --o)
|
|
847
|
+
ce[u++] = 0;
|
|
848
848
|
break;
|
|
849
849
|
default:
|
|
850
|
-
|
|
850
|
+
ce[u++] = c;
|
|
851
851
|
break;
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
|
-
Ft(e,
|
|
854
|
+
Ft(e, ce, 0, n), Ft(r, ce, n, a);
|
|
855
855
|
}
|
|
856
856
|
function Tr(t, e, r) {
|
|
857
857
|
for (; ; ) {
|
|
@@ -862,7 +862,7 @@ function Tr(t, e, r) {
|
|
|
862
862
|
t.dest[t.destLen++] = n;
|
|
863
863
|
else {
|
|
864
864
|
var a, s, i, u;
|
|
865
|
-
for (n -= 257, a =
|
|
865
|
+
for (n -= 257, a = he(t, $t[n], er[n]), s = Wt(t, r), i = t.destLen - he(t, Fn[s], Cn[s]), u = i; u < i + a; ++u)
|
|
866
866
|
t.dest[t.destLen++] = t.dest[u];
|
|
867
867
|
}
|
|
868
868
|
}
|
|
@@ -879,7 +879,7 @@ function Wa(t) {
|
|
|
879
879
|
function Va(t, e) {
|
|
880
880
|
var r = new Ga(t, e), n, a, s;
|
|
881
881
|
do {
|
|
882
|
-
switch (n = Ha(r), a =
|
|
882
|
+
switch (n = Ha(r), a = he(r, 2, 0), a) {
|
|
883
883
|
case 0:
|
|
884
884
|
s = Wa(r);
|
|
885
885
|
break;
|
|
@@ -1064,7 +1064,7 @@ function Fr(t, e) {
|
|
|
1064
1064
|
t || En(e);
|
|
1065
1065
|
}
|
|
1066
1066
|
var E = { fail: En, argument: Fr, assert: Fr }, Cr = 32768, wr = 2147483648, Pe = {}, b = {}, U = {};
|
|
1067
|
-
function
|
|
1067
|
+
function ue(t) {
|
|
1068
1068
|
return function() {
|
|
1069
1069
|
return t;
|
|
1070
1070
|
};
|
|
@@ -1072,11 +1072,11 @@ function le(t) {
|
|
|
1072
1072
|
b.BYTE = function(t) {
|
|
1073
1073
|
return E.argument(t >= 0 && t <= 255, "Byte value should be between 0 and 255."), [t];
|
|
1074
1074
|
};
|
|
1075
|
-
U.BYTE =
|
|
1075
|
+
U.BYTE = ue(1);
|
|
1076
1076
|
b.CHAR = function(t) {
|
|
1077
1077
|
return [t.charCodeAt(0)];
|
|
1078
1078
|
};
|
|
1079
|
-
U.CHAR =
|
|
1079
|
+
U.CHAR = ue(1);
|
|
1080
1080
|
b.CHARARRAY = function(t) {
|
|
1081
1081
|
typeof t > "u" && (t = "", console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));
|
|
1082
1082
|
for (var e = [], r = 0; r < t.length; r += 1)
|
|
@@ -1089,23 +1089,23 @@ U.CHARARRAY = function(t) {
|
|
|
1089
1089
|
b.USHORT = function(t) {
|
|
1090
1090
|
return [t >> 8 & 255, t & 255];
|
|
1091
1091
|
};
|
|
1092
|
-
U.USHORT =
|
|
1092
|
+
U.USHORT = ue(2);
|
|
1093
1093
|
b.SHORT = function(t) {
|
|
1094
1094
|
return t >= Cr && (t = -(2 * Cr - t)), [t >> 8 & 255, t & 255];
|
|
1095
1095
|
};
|
|
1096
|
-
U.SHORT =
|
|
1096
|
+
U.SHORT = ue(2);
|
|
1097
1097
|
b.UINT24 = function(t) {
|
|
1098
1098
|
return [t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
1099
1099
|
};
|
|
1100
|
-
U.UINT24 =
|
|
1100
|
+
U.UINT24 = ue(3);
|
|
1101
1101
|
b.ULONG = function(t) {
|
|
1102
1102
|
return [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
1103
1103
|
};
|
|
1104
|
-
U.ULONG =
|
|
1104
|
+
U.ULONG = ue(4);
|
|
1105
1105
|
b.LONG = function(t) {
|
|
1106
1106
|
return t >= wr && (t = -(2 * wr - t)), [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
1107
1107
|
};
|
|
1108
|
-
U.LONG =
|
|
1108
|
+
U.LONG = ue(4);
|
|
1109
1109
|
b.FIXED = b.ULONG;
|
|
1110
1110
|
U.FIXED = U.ULONG;
|
|
1111
1111
|
b.FWORD = b.SHORT;
|
|
@@ -1115,7 +1115,7 @@ U.UFWORD = U.USHORT;
|
|
|
1115
1115
|
b.LONGDATETIME = function(t) {
|
|
1116
1116
|
return [0, 0, 0, 0, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
1117
1117
|
};
|
|
1118
|
-
U.LONGDATETIME =
|
|
1118
|
+
U.LONGDATETIME = ue(8);
|
|
1119
1119
|
b.TAG = function(t) {
|
|
1120
1120
|
return E.argument(t.length === 4, "Tag should be exactly 4 ASCII characters."), [
|
|
1121
1121
|
t.charCodeAt(0),
|
|
@@ -1124,7 +1124,7 @@ b.TAG = function(t) {
|
|
|
1124
1124
|
t.charCodeAt(3)
|
|
1125
1125
|
];
|
|
1126
1126
|
};
|
|
1127
|
-
U.TAG =
|
|
1127
|
+
U.TAG = ue(4);
|
|
1128
1128
|
b.Card8 = b.BYTE;
|
|
1129
1129
|
U.Card8 = U.BYTE;
|
|
1130
1130
|
b.Card16 = b.USHORT;
|
|
@@ -1142,11 +1142,11 @@ U.NUMBER = function(t) {
|
|
|
1142
1142
|
b.NUMBER16 = function(t) {
|
|
1143
1143
|
return [28, t >> 8 & 255, t & 255];
|
|
1144
1144
|
};
|
|
1145
|
-
U.NUMBER16 =
|
|
1145
|
+
U.NUMBER16 = ue(3);
|
|
1146
1146
|
b.NUMBER32 = function(t) {
|
|
1147
1147
|
return [29, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, t & 255];
|
|
1148
1148
|
};
|
|
1149
|
-
U.NUMBER32 =
|
|
1149
|
+
U.NUMBER32 = ue(5);
|
|
1150
1150
|
b.REAL = function(t) {
|
|
1151
1151
|
var e = t.toString(), r = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);
|
|
1152
1152
|
if (r) {
|
|
@@ -5261,8 +5261,8 @@ function oi() {
|
|
|
5261
5261
|
{ name: "maxMemType1", type: "ULONG", value: 0 }
|
|
5262
5262
|
]);
|
|
5263
5263
|
}
|
|
5264
|
-
var Qn = { parse: ii, make: oi },
|
|
5265
|
-
|
|
5264
|
+
var Qn = { parse: ii, make: oi }, se = new Array(9);
|
|
5265
|
+
se[1] = function() {
|
|
5266
5266
|
var e = this.offset + this.relativeOffset, r = this.parseUShort();
|
|
5267
5267
|
if (r === 1)
|
|
5268
5268
|
return {
|
|
@@ -5278,7 +5278,7 @@ ie[1] = function() {
|
|
|
5278
5278
|
};
|
|
5279
5279
|
E.assert(!1, "0x" + e.toString(16) + ": lookup type 1 format must be 1 or 2.");
|
|
5280
5280
|
};
|
|
5281
|
-
|
|
5281
|
+
se[2] = function() {
|
|
5282
5282
|
var e = this.parseUShort();
|
|
5283
5283
|
return E.argument(e === 1, "GSUB Multiple Substitution Subtable identifier-format must be 1"), {
|
|
5284
5284
|
substFormat: e,
|
|
@@ -5286,7 +5286,7 @@ ie[2] = function() {
|
|
|
5286
5286
|
sequences: this.parseListOfLists()
|
|
5287
5287
|
};
|
|
5288
5288
|
};
|
|
5289
|
-
|
|
5289
|
+
se[3] = function() {
|
|
5290
5290
|
var e = this.parseUShort();
|
|
5291
5291
|
return E.argument(e === 1, "GSUB Alternate Substitution Subtable identifier-format must be 1"), {
|
|
5292
5292
|
substFormat: e,
|
|
@@ -5294,7 +5294,7 @@ ie[3] = function() {
|
|
|
5294
5294
|
alternateSets: this.parseListOfLists()
|
|
5295
5295
|
};
|
|
5296
5296
|
};
|
|
5297
|
-
|
|
5297
|
+
se[4] = function() {
|
|
5298
5298
|
var e = this.parseUShort();
|
|
5299
5299
|
return E.argument(e === 1, "GSUB ligature table identifier-format must be 1"), {
|
|
5300
5300
|
substFormat: e,
|
|
@@ -5311,7 +5311,7 @@ var Be = {
|
|
|
5311
5311
|
sequenceIndex: v.uShort,
|
|
5312
5312
|
lookupListIndex: v.uShort
|
|
5313
5313
|
};
|
|
5314
|
-
|
|
5314
|
+
se[5] = function() {
|
|
5315
5315
|
var e = this.offset + this.relativeOffset, r = this.parseUShort();
|
|
5316
5316
|
if (r === 1)
|
|
5317
5317
|
return {
|
|
@@ -5348,7 +5348,7 @@ ie[5] = function() {
|
|
|
5348
5348
|
}
|
|
5349
5349
|
E.assert(!1, "0x" + e.toString(16) + ": lookup type 5 format must be 1, 2 or 3.");
|
|
5350
5350
|
};
|
|
5351
|
-
|
|
5351
|
+
se[6] = function() {
|
|
5352
5352
|
var e = this.offset + this.relativeOffset, r = this.parseUShort();
|
|
5353
5353
|
if (r === 1)
|
|
5354
5354
|
return {
|
|
@@ -5389,17 +5389,17 @@ ie[6] = function() {
|
|
|
5389
5389
|
};
|
|
5390
5390
|
E.assert(!1, "0x" + e.toString(16) + ": lookup type 6 format must be 1, 2 or 3.");
|
|
5391
5391
|
};
|
|
5392
|
-
|
|
5392
|
+
se[7] = function() {
|
|
5393
5393
|
var e = this.parseUShort();
|
|
5394
5394
|
E.argument(e === 1, "GSUB Extension Substitution subtable identifier-format must be 1");
|
|
5395
5395
|
var r = this.parseUShort(), n = new v(this.data, this.offset + this.parseULong());
|
|
5396
5396
|
return {
|
|
5397
5397
|
substFormat: 1,
|
|
5398
5398
|
lookupType: r,
|
|
5399
|
-
extension:
|
|
5399
|
+
extension: se[r].call(n)
|
|
5400
5400
|
};
|
|
5401
5401
|
};
|
|
5402
|
-
|
|
5402
|
+
se[8] = function() {
|
|
5403
5403
|
var e = this.parseUShort();
|
|
5404
5404
|
return E.argument(e === 1, "GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"), {
|
|
5405
5405
|
substFormat: e,
|
|
@@ -5416,12 +5416,12 @@ function ui(t, e) {
|
|
|
5416
5416
|
version: n,
|
|
5417
5417
|
scripts: r.parseScriptList(),
|
|
5418
5418
|
features: r.parseFeatureList(),
|
|
5419
|
-
lookups: r.parseLookupList(
|
|
5419
|
+
lookups: r.parseLookupList(se)
|
|
5420
5420
|
} : {
|
|
5421
5421
|
version: n,
|
|
5422
5422
|
scripts: r.parseScriptList(),
|
|
5423
5423
|
features: r.parseFeatureList(),
|
|
5424
|
-
lookups: r.parseLookupList(
|
|
5424
|
+
lookups: r.parseLookupList(se),
|
|
5425
5425
|
variations: r.parseFeatureVariationsList()
|
|
5426
5426
|
};
|
|
5427
5427
|
}
|
|
@@ -7801,7 +7801,7 @@ function ir(t, e, r) {
|
|
|
7801
7801
|
function Jo(t, e, r) {
|
|
7802
7802
|
this.contextName = t, this.openRange = null, this.ranges = [], this.checkStart = e, this.checkEnd = r;
|
|
7803
7803
|
}
|
|
7804
|
-
function
|
|
7804
|
+
function ie(t, e) {
|
|
7805
7805
|
this.context = t, this.index = e, this.length = t.length, this.current = t[e], this.backtrack = t.slice(0, e), this.lookahead = t.slice(e + 1);
|
|
7806
7806
|
}
|
|
7807
7807
|
function yt(t) {
|
|
@@ -7931,10 +7931,10 @@ yt.prototype.subscribe = function(t) {
|
|
|
7931
7931
|
yt.prototype.unsubscribe = function(t) {
|
|
7932
7932
|
this.subscribers.splice(t, 1);
|
|
7933
7933
|
};
|
|
7934
|
-
|
|
7934
|
+
ie.prototype.setCurrentIndex = function(t) {
|
|
7935
7935
|
this.index = t, this.current = this.context[t], this.backtrack = this.context.slice(0, t), this.lookahead = this.context.slice(t + 1);
|
|
7936
7936
|
};
|
|
7937
|
-
|
|
7937
|
+
ie.prototype.get = function(t) {
|
|
7938
7938
|
switch (!0) {
|
|
7939
7939
|
case t === 0:
|
|
7940
7940
|
return this.current;
|
|
@@ -8014,7 +8014,7 @@ B.prototype.updateContextsRanges = function() {
|
|
|
8014
8014
|
for (var t = this.tokens.map(function(n) {
|
|
8015
8015
|
return n.char;
|
|
8016
8016
|
}), e = 0; e < t.length; e++) {
|
|
8017
|
-
var r = new
|
|
8017
|
+
var r = new ie(t, e);
|
|
8018
8018
|
this.runContextCheck(r);
|
|
8019
8019
|
}
|
|
8020
8020
|
this.dispatch("updateContextsRanges", [this.registeredContexts]);
|
|
@@ -8038,7 +8038,7 @@ B.prototype.tokenize = function(t) {
|
|
|
8038
8038
|
var e = Array.from(t);
|
|
8039
8039
|
this.dispatch("start");
|
|
8040
8040
|
for (var r = 0; r < e.length; r++) {
|
|
8041
|
-
var n = e[r], a = new
|
|
8041
|
+
var n = e[r], a = new ie(e, r);
|
|
8042
8042
|
this.dispatch("next", [a]), this.runContextCheck(a);
|
|
8043
8043
|
var s = new Ge(n);
|
|
8044
8044
|
this.tokens.push(s), this.dispatch("newToken", [s, a]);
|
|
@@ -8118,7 +8118,7 @@ function nu(t, e) {
|
|
|
8118
8118
|
return [];
|
|
8119
8119
|
for (var s = t.lookahead.slice(a); s.length && Te(s[0].char); )
|
|
8120
8120
|
s.shift();
|
|
8121
|
-
var i = new
|
|
8121
|
+
var i = new ie(s, 0), u = Rt(
|
|
8122
8122
|
e.lookaheadCoverage,
|
|
8123
8123
|
i
|
|
8124
8124
|
), o = [].concat(t.backtrack);
|
|
@@ -8126,7 +8126,7 @@ function nu(t, e) {
|
|
|
8126
8126
|
o.shift();
|
|
8127
8127
|
if (o.length < e.backtrackCoverage.length)
|
|
8128
8128
|
return [];
|
|
8129
|
-
var l = new
|
|
8129
|
+
var l = new ie(o, 0), c = Rt(
|
|
8130
8130
|
e.backtrackCoverage,
|
|
8131
8131
|
l
|
|
8132
8132
|
), f = n.length === e.inputCoverage.length && u.length === e.lookaheadCoverage.length && c.length === e.backtrackCoverage.length, h = [];
|
|
@@ -8308,7 +8308,7 @@ te.prototype.lookupFeature = function(t) {
|
|
|
8308
8308
|
}));
|
|
8309
8309
|
break;
|
|
8310
8310
|
}
|
|
8311
|
-
e = new
|
|
8311
|
+
e = new ie(s, r), !(Array.isArray(p) && !p.length) && (p = null);
|
|
8312
8312
|
}
|
|
8313
8313
|
return s.length ? s : null;
|
|
8314
8314
|
};
|
|
@@ -8445,14 +8445,14 @@ function yu(t) {
|
|
|
8445
8445
|
function mu(t) {
|
|
8446
8446
|
var e = this, r = "arab", n = this.featuresTags[r], a = this.tokenizer.getRangeTokens(t);
|
|
8447
8447
|
if (a.length !== 1) {
|
|
8448
|
-
var s = new
|
|
8448
|
+
var s = new ie(
|
|
8449
8449
|
a.map(
|
|
8450
8450
|
function(u) {
|
|
8451
8451
|
return u.getState("glyphIndex");
|
|
8452
8452
|
}
|
|
8453
8453
|
),
|
|
8454
8454
|
0
|
|
8455
|
-
), i = new
|
|
8455
|
+
), i = new ie(
|
|
8456
8456
|
a.map(
|
|
8457
8457
|
function(u) {
|
|
8458
8458
|
return u.char;
|
|
@@ -8497,7 +8497,7 @@ function nn(t, e) {
|
|
|
8497
8497
|
var r = t.map(function(n) {
|
|
8498
8498
|
return n.activeState.value;
|
|
8499
8499
|
});
|
|
8500
|
-
return new
|
|
8500
|
+
return new ie(r, 0);
|
|
8501
8501
|
}
|
|
8502
8502
|
function xu(t) {
|
|
8503
8503
|
var e = this, r = "arab", n = this.tokenizer.getRangeTokens(t), a = nn(n);
|
|
@@ -8539,7 +8539,7 @@ function an(t, e) {
|
|
|
8539
8539
|
var r = t.map(function(n) {
|
|
8540
8540
|
return n.activeState.value;
|
|
8541
8541
|
});
|
|
8542
|
-
return new
|
|
8542
|
+
return new ie(r, 0);
|
|
8543
8543
|
}
|
|
8544
8544
|
function Tu(t) {
|
|
8545
8545
|
var e = this, r = "latn", n = this.tokenizer.getRangeTokens(t), a = an(n);
|
|
@@ -8557,13 +8557,13 @@ function Tu(t) {
|
|
|
8557
8557
|
), a = an(n));
|
|
8558
8558
|
});
|
|
8559
8559
|
}
|
|
8560
|
-
function
|
|
8560
|
+
function le(t) {
|
|
8561
8561
|
this.baseDir = t || "ltr", this.tokenizer = new B(), this.featuresTags = {};
|
|
8562
8562
|
}
|
|
8563
|
-
|
|
8563
|
+
le.prototype.setText = function(t) {
|
|
8564
8564
|
this.text = t;
|
|
8565
8565
|
};
|
|
8566
|
-
|
|
8566
|
+
le.prototype.contextChecks = {
|
|
8567
8567
|
latinWordCheck: ku,
|
|
8568
8568
|
arabicWordCheck: uu,
|
|
8569
8569
|
arabicSentenceCheck: hu
|
|
@@ -8590,7 +8590,7 @@ function Cu() {
|
|
|
8590
8590
|
);
|
|
8591
8591
|
});
|
|
8592
8592
|
}
|
|
8593
|
-
|
|
8593
|
+
le.prototype.registerFeatures = function(t, e) {
|
|
8594
8594
|
var r = this, n = e.filter(
|
|
8595
8595
|
function(a) {
|
|
8596
8596
|
return r.query.supports({ script: t, tag: a });
|
|
@@ -8598,7 +8598,7 @@ ce.prototype.registerFeatures = function(t, e) {
|
|
|
8598
8598
|
);
|
|
8599
8599
|
this.featuresTags.hasOwnProperty(t) ? this.featuresTags[t] = this.featuresTags[t].concat(n) : this.featuresTags[t] = n;
|
|
8600
8600
|
};
|
|
8601
|
-
|
|
8601
|
+
le.prototype.applyFeatures = function(t, e) {
|
|
8602
8602
|
if (!t)
|
|
8603
8603
|
throw new Error(
|
|
8604
8604
|
"No valid font was provided to apply features"
|
|
@@ -8609,7 +8609,7 @@ ce.prototype.applyFeatures = function(t, e) {
|
|
|
8609
8609
|
this.query.supports({ script: n.script }) && this.registerFeatures(n.script, n.tags);
|
|
8610
8610
|
}
|
|
8611
8611
|
};
|
|
8612
|
-
|
|
8612
|
+
le.prototype.registerModifier = function(t, e, r) {
|
|
8613
8613
|
this.tokenizer.registerModifier(t, e, r);
|
|
8614
8614
|
};
|
|
8615
8615
|
function ur() {
|
|
@@ -8654,19 +8654,19 @@ function Ou() {
|
|
|
8654
8654
|
}
|
|
8655
8655
|
}
|
|
8656
8656
|
}
|
|
8657
|
-
|
|
8657
|
+
le.prototype.checkContextReady = function(t) {
|
|
8658
8658
|
return !!this.tokenizer.getContext(t);
|
|
8659
8659
|
};
|
|
8660
|
-
|
|
8660
|
+
le.prototype.applyFeaturesToContexts = function() {
|
|
8661
8661
|
this.checkContextReady("arabicWord") && (wu.call(this), Eu.call(this)), this.checkContextReady("latinWord") && Ou.call(this), this.checkContextReady("arabicSentence") && Cu.call(this);
|
|
8662
8662
|
};
|
|
8663
|
-
|
|
8663
|
+
le.prototype.processText = function(t) {
|
|
8664
8664
|
(!this.text || this.text !== t) && (this.setText(t), Fu.call(this), this.applyFeaturesToContexts());
|
|
8665
8665
|
};
|
|
8666
|
-
|
|
8666
|
+
le.prototype.getBidiText = function(t) {
|
|
8667
8667
|
return this.processText(t), this.tokenizer.getText();
|
|
8668
8668
|
};
|
|
8669
|
-
|
|
8669
|
+
le.prototype.getTextGlyphs = function(t) {
|
|
8670
8670
|
this.processText(t);
|
|
8671
8671
|
for (var e = [], r = 0; r < this.tokenizer.tokens.length; r++) {
|
|
8672
8672
|
var n = this.tokenizer.tokens[r];
|
|
@@ -8730,7 +8730,7 @@ A.prototype.updateFeatures = function(t) {
|
|
|
8730
8730
|
});
|
|
8731
8731
|
};
|
|
8732
8732
|
A.prototype.stringToGlyphs = function(t, e) {
|
|
8733
|
-
var r = this, n = new
|
|
8733
|
+
var r = this, n = new le(), a = function(f) {
|
|
8734
8734
|
return r.charToGlyphIndex(f.char);
|
|
8735
8735
|
};
|
|
8736
8736
|
n.registerModifier("glyphIndex", null, a);
|
|
@@ -9019,8 +9019,8 @@ function Hu(t, e) {
|
|
|
9019
9019
|
};
|
|
9020
9020
|
return n >= 1.2 && (a.markGlyphSets = r.parsePointer(_u)), a;
|
|
9021
9021
|
}
|
|
9022
|
-
var zu = { parse: Hu },
|
|
9023
|
-
|
|
9022
|
+
var zu = { parse: Hu }, oe = new Array(10);
|
|
9023
|
+
oe[1] = function() {
|
|
9024
9024
|
var e = this.offset + this.relativeOffset, r = this.parseUShort();
|
|
9025
9025
|
if (r === 1)
|
|
9026
9026
|
return {
|
|
@@ -9036,7 +9036,7 @@ ue[1] = function() {
|
|
|
9036
9036
|
};
|
|
9037
9037
|
E.assert(!1, "0x" + e.toString(16) + ": GPOS lookup type 1 format must be 1 or 2.");
|
|
9038
9038
|
};
|
|
9039
|
-
|
|
9039
|
+
oe[2] = function() {
|
|
9040
9040
|
var e = this.offset + this.relativeOffset, r = this.parseUShort();
|
|
9041
9041
|
E.assert(r === 1 || r === 2, "0x" + e.toString(16) + ": GPOS lookup type 2 format must be 1 or 2.");
|
|
9042
9042
|
var n = this.parsePointer(v.coverage), a = this.parseUShort(), s = this.parseUShort();
|
|
@@ -9076,25 +9076,25 @@ ue[2] = function() {
|
|
|
9076
9076
|
};
|
|
9077
9077
|
}
|
|
9078
9078
|
};
|
|
9079
|
-
|
|
9079
|
+
oe[3] = function() {
|
|
9080
9080
|
return { error: "GPOS Lookup 3 not supported" };
|
|
9081
9081
|
};
|
|
9082
|
-
|
|
9082
|
+
oe[4] = function() {
|
|
9083
9083
|
return { error: "GPOS Lookup 4 not supported" };
|
|
9084
9084
|
};
|
|
9085
|
-
|
|
9085
|
+
oe[5] = function() {
|
|
9086
9086
|
return { error: "GPOS Lookup 5 not supported" };
|
|
9087
9087
|
};
|
|
9088
|
-
|
|
9088
|
+
oe[6] = function() {
|
|
9089
9089
|
return { error: "GPOS Lookup 6 not supported" };
|
|
9090
9090
|
};
|
|
9091
|
-
|
|
9091
|
+
oe[7] = function() {
|
|
9092
9092
|
return { error: "GPOS Lookup 7 not supported" };
|
|
9093
9093
|
};
|
|
9094
|
-
|
|
9094
|
+
oe[8] = function() {
|
|
9095
9095
|
return { error: "GPOS Lookup 8 not supported" };
|
|
9096
9096
|
};
|
|
9097
|
-
|
|
9097
|
+
oe[9] = function() {
|
|
9098
9098
|
return { error: "GPOS Lookup 9 not supported" };
|
|
9099
9099
|
};
|
|
9100
9100
|
function Wu(t, e) {
|
|
@@ -9104,12 +9104,12 @@ function Wu(t, e) {
|
|
|
9104
9104
|
version: n,
|
|
9105
9105
|
scripts: r.parseScriptList(),
|
|
9106
9106
|
features: r.parseFeatureList(),
|
|
9107
|
-
lookups: r.parseLookupList(
|
|
9107
|
+
lookups: r.parseLookupList(oe)
|
|
9108
9108
|
} : {
|
|
9109
9109
|
version: n,
|
|
9110
9110
|
scripts: r.parseScriptList(),
|
|
9111
9111
|
features: r.parseFeatureList(),
|
|
9112
|
-
lookups: r.parseLookupList(
|
|
9112
|
+
lookups: r.parseLookupList(oe),
|
|
9113
9113
|
variations: r.parseFeatureVariationsList()
|
|
9114
9114
|
};
|
|
9115
9115
|
}
|
|
@@ -9565,7 +9565,7 @@ let Q = class {
|
|
|
9565
9565
|
}
|
|
9566
9566
|
};
|
|
9567
9567
|
var $ = /* @__PURE__ */ ((t) => (t.SHAPES = "shapes", t.BIGFONT = "bigfont", t.UNIFONT = "unifont", t))($ || {});
|
|
9568
|
-
|
|
9568
|
+
let rl = class {
|
|
9569
9569
|
parse(e) {
|
|
9570
9570
|
const r = this.parseHeader(e).split(" "), n = r[1].toLocaleLowerCase();
|
|
9571
9571
|
if (!Object.values($).includes(n))
|
|
@@ -9591,7 +9591,7 @@ class rl {
|
|
|
9591
9591
|
}
|
|
9592
9592
|
return r.trim();
|
|
9593
9593
|
}
|
|
9594
|
-
}
|
|
9594
|
+
};
|
|
9595
9595
|
class nl {
|
|
9596
9596
|
parse(e) {
|
|
9597
9597
|
try {
|
|
@@ -10769,7 +10769,7 @@ class Ue {
|
|
|
10769
10769
|
this.fontMap.clear();
|
|
10770
10770
|
}
|
|
10771
10771
|
}
|
|
10772
|
-
class
|
|
10772
|
+
class Tl {
|
|
10773
10773
|
/**
|
|
10774
10774
|
* Creates a new instance of DefaultFontLoader
|
|
10775
10775
|
*/
|
|
@@ -10842,7 +10842,7 @@ class Sl {
|
|
|
10842
10842
|
});
|
|
10843
10843
|
}
|
|
10844
10844
|
}
|
|
10845
|
-
var je = /* @__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))(je || {}), cl = /* @__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))(cl || {}), Me = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.WORD = 1] = "WORD", t[t.STACK = 2] = "STACK", t[t.SPACE = 3] = "SPACE", t[t.NBSP = 4] = "NBSP", t[t.TABULATOR = 5] = "TABULATOR", t[t.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", t[t.NEW_COLUMN = 7] = "NEW_COLUMN", t[t.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", t[t.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", t))(Me || {}), _e = /* @__PURE__ */ ((t) => (t[t.BOTTOM = 0] = "BOTTOM", t[t.MIDDLE = 1] = "MIDDLE", t[t.TOP = 2] = "TOP", t))(_e || {}),
|
|
10845
|
+
var je = /* @__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))(je || {}), cl = /* @__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))(cl || {}), Me = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.WORD = 1] = "WORD", t[t.STACK = 2] = "STACK", t[t.SPACE = 3] = "SPACE", t[t.NBSP = 4] = "NBSP", t[t.TABULATOR = 5] = "TABULATOR", t[t.NEW_PARAGRAPH = 6] = "NEW_PARAGRAPH", t[t.NEW_COLUMN = 7] = "NEW_COLUMN", t[t.WRAP_AT_DIMLINE = 8] = "WRAP_AT_DIMLINE", t[t.PROPERTIES_CHANGED = 9] = "PROPERTIES_CHANGED", t))(Me || {}), _e = /* @__PURE__ */ ((t) => (t[t.BOTTOM = 0] = "BOTTOM", t[t.MIDDLE = 1] = "MIDDLE", t[t.TOP = 2] = "TOP", t))(_e || {}), fe = /* @__PURE__ */ ((t) => (t[t.DEFAULT = 0] = "DEFAULT", t[t.LEFT = 1] = "LEFT", t[t.RIGHT = 2] = "RIGHT", t[t.CENTER = 3] = "CENTER", t[t.JUSTIFIED = 4] = "JUSTIFIED", t[t.DISTRIBUTED = 5] = "DISTRIBUTED", t))(fe || {});
|
|
10846
10846
|
const hl = {
|
|
10847
10847
|
c: "Ø",
|
|
10848
10848
|
d: "°",
|
|
@@ -10863,6 +10863,58 @@ function pl(t, e = !1) {
|
|
|
10863
10863
|
}), r;
|
|
10864
10864
|
}
|
|
10865
10865
|
class dl {
|
|
10866
|
+
/**
|
|
10867
|
+
* Creates a new ContextStack with an initial context.
|
|
10868
|
+
* @param initial The initial MTextContext to use as the base of the stack.
|
|
10869
|
+
*/
|
|
10870
|
+
constructor(e) {
|
|
10871
|
+
this.stack = [], this.stack.push(e);
|
|
10872
|
+
}
|
|
10873
|
+
/**
|
|
10874
|
+
* Pushes a copy of the given context onto the stack.
|
|
10875
|
+
* @param ctx The MTextContext to push (copied).
|
|
10876
|
+
*/
|
|
10877
|
+
push(e) {
|
|
10878
|
+
this.stack.push(e);
|
|
10879
|
+
}
|
|
10880
|
+
/**
|
|
10881
|
+
* Pops the top context from the stack and merges its paragraph properties into the new top context.
|
|
10882
|
+
* If only one context remains, nothing is popped.
|
|
10883
|
+
* @returns The popped MTextContext, or undefined if the stack has only one context.
|
|
10884
|
+
*/
|
|
10885
|
+
pop() {
|
|
10886
|
+
if (this.stack.length <= 1) return;
|
|
10887
|
+
const e = this.stack.pop(), r = this.stack[this.stack.length - 1];
|
|
10888
|
+
return JSON.stringify(r.paragraph) !== JSON.stringify(e.paragraph) && (r.paragraph = { ...e.paragraph }), e;
|
|
10889
|
+
}
|
|
10890
|
+
/**
|
|
10891
|
+
* Returns the current (top) context on the stack.
|
|
10892
|
+
*/
|
|
10893
|
+
get current() {
|
|
10894
|
+
return this.stack[this.stack.length - 1];
|
|
10895
|
+
}
|
|
10896
|
+
/**
|
|
10897
|
+
* Returns the current stack depth (number of nested blocks), not counting the root context.
|
|
10898
|
+
*/
|
|
10899
|
+
get depth() {
|
|
10900
|
+
return this.stack.length - 1;
|
|
10901
|
+
}
|
|
10902
|
+
/**
|
|
10903
|
+
* Returns the root (bottom) context, which represents the global formatting state.
|
|
10904
|
+
* Used for paragraph property application.
|
|
10905
|
+
*/
|
|
10906
|
+
get root() {
|
|
10907
|
+
return this.stack[0];
|
|
10908
|
+
}
|
|
10909
|
+
/**
|
|
10910
|
+
* Replaces the current (top) context with the given context.
|
|
10911
|
+
* @param ctx The new context to set as the current context.
|
|
10912
|
+
*/
|
|
10913
|
+
setCurrent(e) {
|
|
10914
|
+
this.stack[this.stack.length - 1] = e;
|
|
10915
|
+
}
|
|
10916
|
+
}
|
|
10917
|
+
class vl {
|
|
10866
10918
|
/**
|
|
10867
10919
|
* Creates a new MTextParser instance
|
|
10868
10920
|
* @param content - The MText content to parse
|
|
@@ -10870,7 +10922,9 @@ class dl {
|
|
|
10870
10922
|
* @param yieldPropertyCommands - Whether to yield property change commands
|
|
10871
10923
|
*/
|
|
10872
10924
|
constructor(e, r, n = !1) {
|
|
10873
|
-
this.
|
|
10925
|
+
this.continueStroke = !1, this.inStackContext = !1, this.scanner = new Dt(e);
|
|
10926
|
+
const a = r ?? new mt();
|
|
10927
|
+
this.ctxStack = new dl(a), this.yieldPropertyCommands = n;
|
|
10874
10928
|
}
|
|
10875
10929
|
/**
|
|
10876
10930
|
* Decode multi-byte character from hex code
|
|
@@ -10895,13 +10949,13 @@ class dl {
|
|
|
10895
10949
|
* Push current context onto the stack
|
|
10896
10950
|
*/
|
|
10897
10951
|
pushCtx() {
|
|
10898
|
-
this.ctxStack.push(this.
|
|
10952
|
+
this.ctxStack.push(this.ctxStack.current);
|
|
10899
10953
|
}
|
|
10900
10954
|
/**
|
|
10901
10955
|
* Pop context from the stack
|
|
10902
10956
|
*/
|
|
10903
10957
|
popCtx() {
|
|
10904
|
-
this.ctxStack.
|
|
10958
|
+
this.ctxStack.pop();
|
|
10905
10959
|
}
|
|
10906
10960
|
/**
|
|
10907
10961
|
* Parse stacking expression (numerator/denominator)
|
|
@@ -10942,63 +10996,64 @@ class dl {
|
|
|
10942
10996
|
* @returns Property changes if yieldPropertyCommands is true and changes occurred
|
|
10943
10997
|
*/
|
|
10944
10998
|
parseProperties(e) {
|
|
10945
|
-
const r = this.
|
|
10999
|
+
const r = this.ctxStack.current.copy(), n = this.ctxStack.current.copy();
|
|
10946
11000
|
switch (e) {
|
|
10947
11001
|
case "L":
|
|
10948
|
-
|
|
11002
|
+
n.underline = !0, this.continueStroke = !0;
|
|
10949
11003
|
break;
|
|
10950
11004
|
case "l":
|
|
10951
|
-
|
|
11005
|
+
n.underline = !1, n.hasAnyStroke || (this.continueStroke = !1);
|
|
10952
11006
|
break;
|
|
10953
11007
|
case "O":
|
|
10954
|
-
|
|
11008
|
+
n.overline = !0, this.continueStroke = !0;
|
|
10955
11009
|
break;
|
|
10956
11010
|
case "o":
|
|
10957
|
-
|
|
11011
|
+
n.overline = !1, n.hasAnyStroke || (this.continueStroke = !1);
|
|
10958
11012
|
break;
|
|
10959
11013
|
case "K":
|
|
10960
|
-
|
|
11014
|
+
n.strikeThrough = !0, this.continueStroke = !0;
|
|
10961
11015
|
break;
|
|
10962
11016
|
case "k":
|
|
10963
|
-
|
|
11017
|
+
n.strikeThrough = !1, n.hasAnyStroke || (this.continueStroke = !1);
|
|
10964
11018
|
break;
|
|
10965
11019
|
case "A":
|
|
10966
|
-
this.parseAlign(
|
|
11020
|
+
this.parseAlign(n);
|
|
10967
11021
|
break;
|
|
10968
11022
|
case "C":
|
|
10969
|
-
this.parseAciColor(
|
|
11023
|
+
this.parseAciColor(n);
|
|
10970
11024
|
break;
|
|
10971
11025
|
case "c":
|
|
10972
|
-
this.parseRgbColor(
|
|
11026
|
+
this.parseRgbColor(n);
|
|
10973
11027
|
break;
|
|
10974
11028
|
case "H":
|
|
10975
|
-
this.parseHeight(
|
|
11029
|
+
this.parseHeight(n);
|
|
10976
11030
|
break;
|
|
10977
11031
|
case "W":
|
|
10978
|
-
this.parseWidth(
|
|
11032
|
+
this.parseWidth(n);
|
|
10979
11033
|
break;
|
|
10980
11034
|
case "Q":
|
|
10981
|
-
this.parseOblique(
|
|
11035
|
+
this.parseOblique(n);
|
|
10982
11036
|
break;
|
|
10983
11037
|
case "T":
|
|
10984
|
-
this.parseCharTracking(
|
|
11038
|
+
this.parseCharTracking(n);
|
|
10985
11039
|
break;
|
|
10986
11040
|
case "p":
|
|
10987
|
-
this.parseParagraphProperties(
|
|
11041
|
+
this.parseParagraphProperties(n);
|
|
10988
11042
|
break;
|
|
10989
11043
|
case "f":
|
|
10990
11044
|
case "F":
|
|
10991
|
-
this.parseFontProperties(
|
|
11045
|
+
this.parseFontProperties(n);
|
|
10992
11046
|
break;
|
|
10993
11047
|
default:
|
|
10994
11048
|
throw new Error(`Unknown command: ${e}`);
|
|
10995
11049
|
}
|
|
10996
|
-
if (this.continueStroke =
|
|
10997
|
-
const
|
|
10998
|
-
if (Object.keys(
|
|
10999
|
-
return
|
|
11050
|
+
if (this.continueStroke = n.hasAnyStroke, n.continueStroke = this.continueStroke, this.ctxStack.setCurrent(n), this.yieldPropertyCommands) {
|
|
11051
|
+
const a = this.getPropertyChanges(r, n);
|
|
11052
|
+
if (Object.keys(a).length > 0)
|
|
11053
|
+
return {
|
|
11000
11054
|
command: e,
|
|
11001
|
-
changes:
|
|
11055
|
+
changes: a,
|
|
11056
|
+
depth: this.ctxStack.depth
|
|
11002
11057
|
};
|
|
11003
11058
|
}
|
|
11004
11059
|
}
|
|
@@ -11317,7 +11372,7 @@ class dl {
|
|
|
11317
11372
|
try {
|
|
11318
11373
|
const l = this.parseProperties(o);
|
|
11319
11374
|
if (this.yieldPropertyCommands && l)
|
|
11320
|
-
return
|
|
11375
|
+
return [9, l];
|
|
11321
11376
|
continue;
|
|
11322
11377
|
} catch {
|
|
11323
11378
|
const l = this.scanner.tail.slice(
|
|
@@ -11351,10 +11406,14 @@ class dl {
|
|
|
11351
11406
|
if (a)
|
|
11352
11407
|
return [1, a];
|
|
11353
11408
|
if (this.scanner.consume(1), this.yieldPropertyCommands) {
|
|
11409
|
+
const o = this.ctxStack.current;
|
|
11354
11410
|
this.popCtx();
|
|
11355
|
-
const
|
|
11356
|
-
if (Object.keys(
|
|
11357
|
-
return
|
|
11411
|
+
const l = this.getPropertyChanges(o, this.ctxStack.current);
|
|
11412
|
+
if (Object.keys(l).length > 0)
|
|
11413
|
+
return [
|
|
11414
|
+
9,
|
|
11415
|
+
{ command: void 0, changes: l, depth: this.ctxStack.depth }
|
|
11416
|
+
];
|
|
11358
11417
|
} else
|
|
11359
11418
|
this.popCtx();
|
|
11360
11419
|
continue;
|
|
@@ -11385,7 +11444,7 @@ class dl {
|
|
|
11385
11444
|
for (; ; ) {
|
|
11386
11445
|
const [n, a] = r();
|
|
11387
11446
|
if (n)
|
|
11388
|
-
yield new hn(n, this.
|
|
11447
|
+
yield new hn(n, this.ctxStack.current.copy(), a), e && (yield new hn(e, this.ctxStack.current.copy(), null), e = null);
|
|
11389
11448
|
else
|
|
11390
11449
|
break;
|
|
11391
11450
|
}
|
|
@@ -11840,14 +11899,14 @@ function pn(t) {
|
|
|
11840
11899
|
}
|
|
11841
11900
|
return a !== void 0 && (u.gpuType = a), u;
|
|
11842
11901
|
}
|
|
11843
|
-
const
|
|
11902
|
+
const gl = /* @__PURE__ */ new R.Vector3(), yl = 1.666666;
|
|
11844
11903
|
class hr {
|
|
11845
11904
|
/**
|
|
11846
11905
|
* Creates a new Context instance with optional initial values.
|
|
11847
11906
|
* @param init - Partial object containing initial values for context properties
|
|
11848
11907
|
*/
|
|
11849
11908
|
constructor(e) {
|
|
11850
|
-
this.font = "", this.fontScaleFactor = 1, this.fontSize = 1, this.fontSizeScaleFactor = 1, this.color = 16777215, this.underline = !1, this.overline = !1, this.strikeThrough = !1, this.obliqueAngle = 0, this.italic = !1, this.bold = !1, this.widthFactor = 1, this.wordSpace = 1, this.blankWidth = 0,
|
|
11909
|
+
this.font = "", this.fontScaleFactor = 1, this.fontSize = 1, this.fontSizeScaleFactor = 1, this.color = 16777215, this.underline = !1, this.overline = !1, this.strikeThrough = !1, this.obliqueAngle = 0, this.italic = !1, this.bold = !1, this.widthFactor = 1, this.wordSpace = 1, this.blankWidth = 0, Object.assign(this, e);
|
|
11851
11910
|
}
|
|
11852
11911
|
/**
|
|
11853
11912
|
* Creates a deep copy of the current context.
|
|
@@ -11858,7 +11917,7 @@ class hr {
|
|
|
11858
11917
|
return new hr({ ...this });
|
|
11859
11918
|
}
|
|
11860
11919
|
}
|
|
11861
|
-
class
|
|
11920
|
+
class ml {
|
|
11862
11921
|
/**
|
|
11863
11922
|
* Construct one instance of this class and initialize some properties with default values.
|
|
11864
11923
|
* @param style Input text style
|
|
@@ -11884,9 +11943,8 @@ class yl {
|
|
|
11884
11943
|
blankWidth: this.calculateBlankWidthForFont(
|
|
11885
11944
|
this.textStyle.font.toLowerCase(),
|
|
11886
11945
|
a.fontSize
|
|
11887
|
-
)
|
|
11888
|
-
|
|
11889
|
-
}), this._maxFontSize = 0, this.initLineParams();
|
|
11946
|
+
)
|
|
11947
|
+
}), this._maxFontSize = 0, this._currentHorizontalAlignment = a.horizontalAlignment, this.initLineParams();
|
|
11890
11948
|
}
|
|
11891
11949
|
get fontManager() {
|
|
11892
11950
|
return this._fontManager;
|
|
@@ -11949,7 +12007,7 @@ class yl {
|
|
|
11949
12007
|
* The current horizontal alignment of one text line
|
|
11950
12008
|
*/
|
|
11951
12009
|
get currentHorizontalAlignment() {
|
|
11952
|
-
return this.
|
|
12010
|
+
return this._currentHorizontalAlignment;
|
|
11953
12011
|
}
|
|
11954
12012
|
/**
|
|
11955
12013
|
* Scale factor of current font height. The scale factor isn't set by users in text editor.
|
|
@@ -11975,7 +12033,7 @@ class yl {
|
|
|
11975
12033
|
* The height of current line of texts
|
|
11976
12034
|
*/
|
|
11977
12035
|
get currentLineHeight() {
|
|
11978
|
-
return this.defaultLineSpaceFactor * this.currentFontSize *
|
|
12036
|
+
return this.defaultLineSpaceFactor * this.currentFontSize * yl + this.currentMaxFontSize;
|
|
11979
12037
|
}
|
|
11980
12038
|
/**
|
|
11981
12039
|
* The maximum font size in current line. Characters in one line may have different font and font
|
|
@@ -12061,8 +12119,8 @@ class yl {
|
|
|
12061
12119
|
case "T":
|
|
12062
12120
|
e.changes.charTrackingFactor && (e.changes.charTrackingFactor.isRelative ? this._currentContext.wordSpace = e.changes.charTrackingFactor.value + 1 : this._currentContext.wordSpace = e.changes.charTrackingFactor.value);
|
|
12063
12121
|
break;
|
|
12064
|
-
case "
|
|
12065
|
-
e.changes.paragraph && e.changes.paragraph.align && (this.
|
|
12122
|
+
case "p":
|
|
12123
|
+
e.changes.paragraph && e.changes.paragraph.align && (this._currentHorizontalAlignment = e.changes.paragraph.align);
|
|
12066
12124
|
break;
|
|
12067
12125
|
case "L":
|
|
12068
12126
|
this._currentContext.underline = !0;
|
|
@@ -12103,14 +12161,14 @@ class yl {
|
|
|
12103
12161
|
this.processBlank();
|
|
12104
12162
|
else if (s.type === Me.PROPERTIES_CHANGED) {
|
|
12105
12163
|
const i = s.data;
|
|
12106
|
-
i.command === void 0 ? this._contextStack.length > 0 && (this._currentContext = this._contextStack.pop()) : (
|
|
12164
|
+
i.command === void 0 ? this._contextStack.length > 0 && (this._currentContext = this._contextStack.pop()) : (i.depth > 0 && this._contextStack.push(this._currentContext.clone()), this.processFormat(i)), this.processGeometries(r, n, a);
|
|
12107
12165
|
} else s.type === Me.STACK && (this.processStack(s.data, r, n), this.processGeometries(r, n, a));
|
|
12108
|
-
return (r.length > 0 || n.length > 0) && this.processGeometries(r, n, a), a;
|
|
12166
|
+
return (r.length > 0 || n.length > 0) && this.processGeometries(r, n, a), this.processLastLine(), a;
|
|
12109
12167
|
}
|
|
12110
12168
|
processGeometries(e, r, n) {
|
|
12111
12169
|
if (e.length > 0 || r.length > 0) {
|
|
12112
12170
|
const a = this.toThreeObject(e, r);
|
|
12113
|
-
n.add(a), e.length = 0, r.length = 0;
|
|
12171
|
+
n.add(a), this._currentLineObjects.push(a), e.length = 0, r.length = 0;
|
|
12114
12172
|
}
|
|
12115
12173
|
}
|
|
12116
12174
|
processWord(e, r, n) {
|
|
@@ -12191,7 +12249,7 @@ class yl {
|
|
|
12191
12249
|
const u = this.fontManager.getFontType(this.currentFont);
|
|
12192
12250
|
this._currentContext.bold && u === "mesh" && s.scale(1.06, 1.06, 1), this.hOffset > (this.maxWidth || 1 / 0) && this.startNewLine();
|
|
12193
12251
|
let o = this.hOffset, l = this.flowDirection == je.BOTTOM_TO_TOP ? this.vOffset : this.vOffset - this.currentFontSize, c = a.width * this.currentWidthFactor, f = this.currentFontSize;
|
|
12194
|
-
s.translate(o, l, 0), this.currentHorizontalAlignment ==
|
|
12252
|
+
s.translate(o, l, 0), this.currentHorizontalAlignment == fe.DISTRIBUTED ? this._hOffset += a.width * this.currentWidthFactor : this._hOffset += a.width * this.currentWordSpace * this.currentWidthFactor, r.push(s);
|
|
12195
12253
|
const h = f * 0.05, p = 1e-3;
|
|
12196
12254
|
if (this._currentContext.underline) {
|
|
12197
12255
|
const d = new R.BufferGeometry(), g = l - h;
|
|
@@ -12271,17 +12329,17 @@ class yl {
|
|
|
12271
12329
|
if (e.forEach((n, a) => {
|
|
12272
12330
|
n.boundingBox || n.computeBoundingBox(), a === 0 ? r = n.boundingBox : r.union(n.boundingBox);
|
|
12273
12331
|
}), r) {
|
|
12274
|
-
const n = r.getSize(
|
|
12332
|
+
const n = r.getSize(gl);
|
|
12275
12333
|
switch (this.currentHorizontalAlignment) {
|
|
12276
|
-
case
|
|
12334
|
+
case fe.LEFT:
|
|
12277
12335
|
break;
|
|
12278
|
-
case
|
|
12336
|
+
case fe.CENTER:
|
|
12279
12337
|
e.forEach((a) => a.translate((this.maxWidth - n.x) / 2, 0, 0));
|
|
12280
12338
|
break;
|
|
12281
|
-
case
|
|
12339
|
+
case fe.RIGHT:
|
|
12282
12340
|
e.forEach((a) => a.translate(this.maxWidth - n.x, 0, 0));
|
|
12283
12341
|
break;
|
|
12284
|
-
case
|
|
12342
|
+
case fe.DISTRIBUTED:
|
|
12285
12343
|
if (e.length > 1) {
|
|
12286
12344
|
const a = (this.maxWidth - n.x) / (e.length - 1);
|
|
12287
12345
|
for (let s = 1; s < e.length; s++)
|
|
@@ -12333,7 +12391,7 @@ class yl {
|
|
|
12333
12391
|
}
|
|
12334
12392
|
}
|
|
12335
12393
|
const Mt = /* @__PURE__ */ new R.Vector3(), we = /* @__PURE__ */ new R.Vector3(), Bt = /* @__PURE__ */ new R.Vector3(), Pt = /* @__PURE__ */ new R.Quaternion(), It = /* @__PURE__ */ new R.Matrix4(), dn = /* @__PURE__ */ new R.Matrix4(), vn = /* @__PURE__ */ new R.Vector3(1, 0, 0);
|
|
12336
|
-
class
|
|
12394
|
+
class Fl extends R.Object3D {
|
|
12337
12395
|
/**
|
|
12338
12396
|
* Extracts all unique font names used in an MText string.
|
|
12339
12397
|
* This function searches for font commands in the format \f{fontname}| or \f{fontname}; and returns a set of unique font names.
|
|
@@ -12462,8 +12520,8 @@ class kl extends R.Object3D {
|
|
|
12462
12520
|
this.styleManager.unsupportedTextStyles[g] || (this.styleManager.unsupportedTextStyles[g] = 0), this.styleManager.unsupportedTextStyles[g]++;
|
|
12463
12521
|
}
|
|
12464
12522
|
const n = e.width || 0;
|
|
12465
|
-
let a =
|
|
12466
|
-
e.width && e.attachmentPoint && ([1, 4, 7].includes(e.attachmentPoint) ? a =
|
|
12523
|
+
let a = fe.LEFT;
|
|
12524
|
+
e.width && e.attachmentPoint && ([1, 4, 7].includes(e.attachmentPoint) ? a = fe.LEFT : [2, 5, 8].includes(e.attachmentPoint) ? a = fe.CENTER : [3, 6, 9].includes(e.attachmentPoint) && (a = fe.RIGHT));
|
|
12467
12525
|
let s = _e.BOTTOM;
|
|
12468
12526
|
e.attachmentPoint && ([1, 2, 3].includes(e.attachmentPoint) ? s = _e.TOP : [4, 5, 6].includes(e.attachmentPoint) ? s = _e.MIDDLE : [7, 8, 9].includes(e.attachmentPoint) && (s = _e.BOTTOM));
|
|
12469
12527
|
const i = e.height || 0, u = e.lineSpaceFactor || 0.3, o = e.drawingDirection ?? je.LEFT_TO_RIGHT, l = {
|
|
@@ -12478,15 +12536,15 @@ class kl extends R.Object3D {
|
|
|
12478
12536
|
removeFontExtension: !0
|
|
12479
12537
|
}, c = new mt();
|
|
12480
12538
|
c.fontFace.family = r.font, c.capHeight = { value: e.height || 1, isRelative: !0 }, c.widthFactor = { value: e.widthFactor ?? 1, isRelative: !0 }, c.align = s, c.paragraph.align = a;
|
|
12481
|
-
const
|
|
12539
|
+
const f = new ml(
|
|
12482
12540
|
r,
|
|
12483
12541
|
this.styleManager,
|
|
12484
12542
|
this.fontManager,
|
|
12485
12543
|
l
|
|
12486
|
-
),
|
|
12487
|
-
return
|
|
12488
|
-
object:
|
|
12489
|
-
height:
|
|
12544
|
+
), p = new vl(e.text, c, !0).parse();
|
|
12545
|
+
return {
|
|
12546
|
+
object: f.processText(p),
|
|
12547
|
+
height: f.totalHeight
|
|
12490
12548
|
};
|
|
12491
12549
|
}
|
|
12492
12550
|
/**
|
|
@@ -12548,7 +12606,7 @@ class kl extends R.Object3D {
|
|
|
12548
12606
|
this.getBoxes(n[a], r);
|
|
12549
12607
|
}
|
|
12550
12608
|
}
|
|
12551
|
-
class
|
|
12609
|
+
class Cl {
|
|
12552
12610
|
constructor() {
|
|
12553
12611
|
this.lineBasicMaterials = {}, this.meshBasicMaterials = {}, this.unsupportedTextStyles = {};
|
|
12554
12612
|
}
|
|
@@ -12566,12 +12624,12 @@ class Tl {
|
|
|
12566
12624
|
export {
|
|
12567
12625
|
gn as BaseFont,
|
|
12568
12626
|
yn as BaseTextShape,
|
|
12569
|
-
|
|
12627
|
+
Tl as DefaultFontLoader,
|
|
12570
12628
|
pr as EventManager,
|
|
12571
12629
|
Se as FontFactory,
|
|
12572
12630
|
Ue as FontManager,
|
|
12573
|
-
|
|
12631
|
+
Fl as MText,
|
|
12574
12632
|
cl as MTextAttachmentPoint,
|
|
12575
12633
|
je as MTextFlowDirection,
|
|
12576
|
-
|
|
12634
|
+
Cl as StyleManager
|
|
12577
12635
|
};
|