@unmade/text-renderer 0.1.3 → 0.1.4
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.cjs +1 -1
- package/dist/index.js +95 -89
- package/dist/node/index.cjs +3 -3
- package/dist/node/index.js +8 -2
- package/dist/worker/index.cjs +2 -2
- package/dist/worker/index.js +14 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2945,9 +2945,9 @@ function st(e, r, t) {
|
|
|
2945
2945
|
T = i.length % 2 !== 0, T && !f && (L = i.shift() + y), l += i.length >> 1, i.length = 0, f = !0;
|
|
2946
2946
|
}
|
|
2947
2947
|
function C(T) {
|
|
2948
|
-
for (var R, q, A, X, Q, P, H, Y, W, I, z, $,
|
|
2949
|
-
var _ = T[
|
|
2950
|
-
switch (
|
|
2948
|
+
for (var R, q, A, X, Q, P, H, Y, W, I, z, $, B = 0; B < T.length; ) {
|
|
2949
|
+
var _ = T[B];
|
|
2950
|
+
switch (B += 1, _) {
|
|
2951
2951
|
case 1:
|
|
2952
2952
|
D();
|
|
2953
2953
|
break;
|
|
@@ -2979,7 +2979,7 @@ function st(e, r, t) {
|
|
|
2979
2979
|
case 11:
|
|
2980
2980
|
return;
|
|
2981
2981
|
case 12:
|
|
2982
|
-
switch (_ = T[
|
|
2982
|
+
switch (_ = T[B], B += 1, _) {
|
|
2983
2983
|
case 35:
|
|
2984
2984
|
n = p + i.shift(), a = h + i.shift(), s = n + i.shift(), o = a + i.shift(), H = s + i.shift(), Y = o + i.shift(), W = H + i.shift(), I = Y + i.shift(), z = W + i.shift(), $ = I + i.shift(), p = z + i.shift(), h = $ + i.shift(), i.shift(), u.curveTo(n, a, s, o, H, Y), u.curveTo(W, I, z, $, p, h);
|
|
2985
2985
|
break;
|
|
@@ -3005,7 +3005,7 @@ function st(e, r, t) {
|
|
|
3005
3005
|
case 19:
|
|
3006
3006
|
// hintmask
|
|
3007
3007
|
case 20:
|
|
3008
|
-
D(),
|
|
3008
|
+
D(), B += l + 7 >> 3;
|
|
3009
3009
|
break;
|
|
3010
3010
|
case 21:
|
|
3011
3011
|
i.length > 2 && !f && (L = i.shift() + y, f = !0), h += i.pop(), p += i.pop(), w(p, h);
|
|
@@ -3035,7 +3035,7 @@ function st(e, r, t) {
|
|
|
3035
3035
|
n = p + i.shift(), a = h, s = n + i.shift(), o = a + i.shift(), p = s + i.shift(), h = o, u.curveTo(n, a, s, o, p, h);
|
|
3036
3036
|
break;
|
|
3037
3037
|
case 28:
|
|
3038
|
-
R = T[
|
|
3038
|
+
R = T[B], q = T[B + 1], i.push((R << 24 | q << 16) >> 16), B += 2;
|
|
3039
3039
|
break;
|
|
3040
3040
|
case 29:
|
|
3041
3041
|
Q = i.pop() + e.gsubrsBias, P = e.gsubrs[Q], P && C(P);
|
|
@@ -3049,7 +3049,7 @@ function st(e, r, t) {
|
|
|
3049
3049
|
n = p, a = h + i.shift(), s = n + i.shift(), o = a + i.shift(), p = s + i.shift(), h = o + (i.length === 1 ? i.shift() : 0), u.curveTo(n, a, s, o, p, h);
|
|
3050
3050
|
break;
|
|
3051
3051
|
default:
|
|
3052
|
-
_ < 32 ? console.log("Glyph " + r.index + ": unknown operator " + _) : _ < 247 ? i.push(_ - 139) : _ < 251 ? (R = T[
|
|
3052
|
+
_ < 32 ? console.log("Glyph " + r.index + ": unknown operator " + _) : _ < 247 ? i.push(_ - 139) : _ < 251 ? (R = T[B], B += 1, i.push((_ - 247) * 256 + R + 108)) : _ < 255 ? (R = T[B], B += 1, i.push(-(_ - 251) * 256 - R - 108)) : (R = T[B], q = T[B + 1], A = T[B + 2], X = T[B + 3], B += 4, i.push((R << 24 | q << 16 | A << 8 | X) / 65536));
|
|
3053
3053
|
}
|
|
3054
3054
|
}
|
|
3055
3055
|
}
|
|
@@ -3130,7 +3130,7 @@ function Aa() {
|
|
|
3130
3130
|
{ name: "major", type: "Card8", value: 1 }
|
|
3131
3131
|
]);
|
|
3132
3132
|
}
|
|
3133
|
-
function
|
|
3133
|
+
function Ba(e) {
|
|
3134
3134
|
var r = new S.Record("Name INDEX", [
|
|
3135
3135
|
{ name: "names", type: "INDEX", value: [] }
|
|
3136
3136
|
]);
|
|
@@ -3158,7 +3158,7 @@ function it(e) {
|
|
|
3158
3158
|
]);
|
|
3159
3159
|
return r.topDicts = [{ name: "topDict_0", type: "TABLE", value: e }], r;
|
|
3160
3160
|
}
|
|
3161
|
-
function
|
|
3161
|
+
function Ma(e) {
|
|
3162
3162
|
var r = new S.Record("String INDEX", [
|
|
3163
3163
|
{ name: "strings", type: "INDEX", value: [] }
|
|
3164
3164
|
]);
|
|
@@ -3248,9 +3248,9 @@ function Wa(e, r) {
|
|
|
3248
3248
|
}, s = {}, o = [], u, i = 1; i < e.length; i += 1)
|
|
3249
3249
|
u = e.get(i), o.push(u.name);
|
|
3250
3250
|
var l = [];
|
|
3251
|
-
t.header = Aa(), t.nameIndex =
|
|
3251
|
+
t.header = Aa(), t.nameIndex = Ba([r.postScriptName]);
|
|
3252
3252
|
var f = ot(a, l);
|
|
3253
|
-
t.topDictIndex = it(f), t.globalSubrIndex = Ia(), t.charsets = Pa(o, l), t.charStringsIndex = Na(e), t.privateDict = Ha(s, l), t.stringIndex =
|
|
3253
|
+
t.topDictIndex = it(f), t.globalSubrIndex = Ia(), t.charsets = Pa(o, l), t.charStringsIndex = Na(e), t.privateDict = Ha(s, l), t.stringIndex = Ma(l);
|
|
3254
3254
|
var c = t.header.sizeOf() + t.nameIndex.sizeOf() + t.topDictIndex.sizeOf() + t.stringIndex.sizeOf() + t.globalSubrIndex.sizeOf();
|
|
3255
3255
|
return a.charset = c, a.encoding = 0, a.charStrings = a.charset + t.charsets.sizeOf(), a.private[1] = a.charStrings + t.charStringsIndex.sizeOf(), f = ot(a, l), t.topDictIndex = it(f), t;
|
|
3256
3256
|
}
|
|
@@ -4971,14 +4971,14 @@ function ms(e) {
|
|
|
4971
4971
|
postScriptName: Q,
|
|
4972
4972
|
unitsPerEm: e.unitsPerEm,
|
|
4973
4973
|
fontBBox: [0, x.yMin, x.ascender, x.advanceWidthMax]
|
|
4974
|
-
}),
|
|
4975
|
-
I && _.push(I), e.tables.gsub && _.push(mn.make(e.tables.gsub)),
|
|
4976
|
-
for (var De = xn(_), pr = De.encode(), Ae = _r(pr),
|
|
4977
|
-
if (
|
|
4978
|
-
|
|
4974
|
+
}), B = e.metas && Object.keys(e.metas).length > 0 ? yn.make(e.metas) : void 0, _ = [L, w, D, C, W, R, z, $, T];
|
|
4975
|
+
I && _.push(I), e.tables.gsub && _.push(mn.make(e.tables.gsub)), B && _.push(B);
|
|
4976
|
+
for (var De = xn(_), pr = De.encode(), Ae = _r(pr), Be = De.fields, Me = !1, Ce = 0; Ce < Be.length; Ce += 1)
|
|
4977
|
+
if (Be[Ce].name === "head table") {
|
|
4978
|
+
Be[Ce].value.checkSumAdjustment = 2981146554 - Ae, Me = !0;
|
|
4979
4979
|
break;
|
|
4980
4980
|
}
|
|
4981
|
-
if (!
|
|
4981
|
+
if (!Me)
|
|
4982
4982
|
throw new Error("Could not find head table with checkSum to adjust.");
|
|
4983
4983
|
return De;
|
|
4984
4984
|
}
|
|
@@ -5594,7 +5594,7 @@ function Fs(e, r, t, n) {
|
|
|
5594
5594
|
function Us(e, r, t, n, a) {
|
|
5595
5595
|
return a.lowMemory ? Fs(e, r, t, n) : ks(e, r, t, n);
|
|
5596
5596
|
}
|
|
5597
|
-
var Fn = { getPath: Tn, parse: Us }, Un, Ue, Cn,
|
|
5597
|
+
var Fn = { getPath: Tn, parse: Us }, Un, Ue, Cn, Br;
|
|
5598
5598
|
function wn(e) {
|
|
5599
5599
|
this.font = e, this.getCommands = function(r) {
|
|
5600
5600
|
return Fn.getPath(r).commands;
|
|
@@ -5853,13 +5853,13 @@ wn.prototype.exec = function(e, r) {
|
|
|
5853
5853
|
Cn = function(e, r) {
|
|
5854
5854
|
var t = r.ppem / r.font.unitsPerEm, n = t, a = e.components, s, o, u;
|
|
5855
5855
|
if (xe.prototype = r, !a)
|
|
5856
|
-
u = new xe("glyf", e.instructions), exports.DEBUG && (console.log("---EXEC GLYPH---"), u.step = -1),
|
|
5856
|
+
u = new xe("glyf", e.instructions), exports.DEBUG && (console.log("---EXEC GLYPH---"), u.step = -1), Br(e, u, t, n), o = u.gZone;
|
|
5857
5857
|
else {
|
|
5858
5858
|
var i = r.font;
|
|
5859
5859
|
o = [], s = [];
|
|
5860
5860
|
for (var l = 0; l < a.length; l++) {
|
|
5861
5861
|
var f = a[l], c = i.glyphs.get(f.glyphIndex);
|
|
5862
|
-
u = new xe("glyf", c.instructions), exports.DEBUG && (console.log("---EXEC COMP " + l + "---"), u.step = -1),
|
|
5862
|
+
u = new xe("glyf", c.instructions), exports.DEBUG && (console.log("---EXEC COMP " + l + "---"), u.step = -1), Br(c, u, t, n);
|
|
5863
5863
|
for (var p = Math.round(f.dx * t), h = Math.round(f.dy * n), d = u.gZone, g = u.contours, m = 0; m < d.length; m++) {
|
|
5864
5864
|
var y = d[m];
|
|
5865
5865
|
y.xTouched = y.yTouched = !1, y.xo = y.x = y.x + p, y.yo = y.y = y.y + h;
|
|
@@ -5876,7 +5876,7 @@ Cn = function(e, r) {
|
|
|
5876
5876
|
}
|
|
5877
5877
|
return o;
|
|
5878
5878
|
};
|
|
5879
|
-
|
|
5879
|
+
Br = function(e, r, t, n) {
|
|
5880
5880
|
for (var a = e.points || [], s = a.length, o = r.gZone = r.z0 = r.z1 = r.z2 = [], u = r.contours = [], i, l = 0; l < s; l++)
|
|
5881
5881
|
i = a[l], o[l] = new ce(
|
|
5882
5882
|
i.x * t,
|
|
@@ -5968,11 +5968,11 @@ function As(e) {
|
|
|
5968
5968
|
var r = e.stack, t = r.pop(), n = r.pop();
|
|
5969
5969
|
exports.DEBUG && console.log(e.step, "SPVFS[]", t, n), e.fv = Xe(n, t);
|
|
5970
5970
|
}
|
|
5971
|
-
function
|
|
5971
|
+
function Bs(e) {
|
|
5972
5972
|
var r = e.stack, t = e.pv;
|
|
5973
5973
|
exports.DEBUG && console.log(e.step, "GPV[]"), r.push(t.x * 16384), r.push(t.y * 16384);
|
|
5974
5974
|
}
|
|
5975
|
-
function
|
|
5975
|
+
function Ms(e) {
|
|
5976
5976
|
var r = e.stack, t = e.fv;
|
|
5977
5977
|
exports.DEBUG && console.log(e.step, "GFV[]"), r.push(t.x * 16384), r.push(t.y * 16384);
|
|
5978
5978
|
}
|
|
@@ -6347,11 +6347,11 @@ function Ao(e) {
|
|
|
6347
6347
|
var r = e.stack, t = r.pop();
|
|
6348
6348
|
exports.DEBUG && console.log(e.step, "SDB[]", t), e.deltaBase = t;
|
|
6349
6349
|
}
|
|
6350
|
-
function
|
|
6350
|
+
function Bo(e) {
|
|
6351
6351
|
var r = e.stack, t = r.pop();
|
|
6352
6352
|
exports.DEBUG && console.log(e.step, "SDS[]", t), e.deltaShift = Math.pow(0.5, t);
|
|
6353
6353
|
}
|
|
6354
|
-
function
|
|
6354
|
+
function Mo(e) {
|
|
6355
6355
|
var r = e.stack, t = r.pop(), n = r.pop();
|
|
6356
6356
|
exports.DEBUG && console.log(e.step, "ADD[]", t, n), r.push(n + t);
|
|
6357
6357
|
}
|
|
@@ -6582,9 +6582,9 @@ Un = [
|
|
|
6582
6582
|
/* 0x0B */
|
|
6583
6583
|
As,
|
|
6584
6584
|
/* 0x0C */
|
|
6585
|
-
Ms,
|
|
6586
|
-
/* 0x0D */
|
|
6587
6585
|
Bs,
|
|
6586
|
+
/* 0x0D */
|
|
6587
|
+
Ms,
|
|
6588
6588
|
/* 0x0E */
|
|
6589
6589
|
Is,
|
|
6590
6590
|
/* 0x0F */
|
|
@@ -6757,9 +6757,9 @@ Un = [
|
|
|
6757
6757
|
/* 0x5E */
|
|
6758
6758
|
Ao,
|
|
6759
6759
|
/* 0x5F */
|
|
6760
|
-
Mo,
|
|
6761
|
-
/* 0x60 */
|
|
6762
6760
|
Bo,
|
|
6761
|
+
/* 0x60 */
|
|
6762
|
+
Mo,
|
|
6763
6763
|
/* 0x61 */
|
|
6764
6764
|
Io,
|
|
6765
6765
|
/* 0x62 */
|
|
@@ -7976,7 +7976,7 @@ ae.prototype.getTextGlyphs = function(e) {
|
|
|
7976
7976
|
}
|
|
7977
7977
|
return r;
|
|
7978
7978
|
};
|
|
7979
|
-
function
|
|
7979
|
+
function M(e) {
|
|
7980
7980
|
e = e || {}, e.tables = e.tables || {}, e.empty || (Pe(e.familyName, "When creating a new Font object, familyName is required."), Pe(e.styleName, "When creating a new Font object, styleName is required."), Pe(e.unitsPerEm, "When creating a new Font object, unitsPerEm is required."), Pe(e.ascender, "When creating a new Font object, ascender is required."), Pe(e.descender <= 0, "When creating a new Font object, negative descender value is required."), this.names = {
|
|
7981
7981
|
fontFamily: { en: e.familyName || " " },
|
|
7982
7982
|
fontSubfamily: { en: e.styleName || " " },
|
|
@@ -8008,17 +8008,17 @@ function B(e) {
|
|
|
8008
8008
|
}
|
|
8009
8009
|
});
|
|
8010
8010
|
}
|
|
8011
|
-
|
|
8011
|
+
M.prototype.hasChar = function(e) {
|
|
8012
8012
|
return this.encoding.charToGlyphIndex(e) !== null;
|
|
8013
8013
|
};
|
|
8014
|
-
|
|
8014
|
+
M.prototype.charToGlyphIndex = function(e) {
|
|
8015
8015
|
return this.encoding.charToGlyphIndex(e);
|
|
8016
8016
|
};
|
|
8017
|
-
|
|
8017
|
+
M.prototype.charToGlyph = function(e) {
|
|
8018
8018
|
var r = this.charToGlyphIndex(e), t = this.glyphs.get(r);
|
|
8019
8019
|
return t || (t = this.glyphs.get(0)), t;
|
|
8020
8020
|
};
|
|
8021
|
-
|
|
8021
|
+
M.prototype.updateFeatures = function(e) {
|
|
8022
8022
|
return this.defaultRenderOptions.features.map(function(r) {
|
|
8023
8023
|
return r.script === "latn" ? {
|
|
8024
8024
|
script: "latn",
|
|
@@ -8028,7 +8028,7 @@ B.prototype.updateFeatures = function(e) {
|
|
|
8028
8028
|
} : r;
|
|
8029
8029
|
});
|
|
8030
8030
|
};
|
|
8031
|
-
|
|
8031
|
+
M.prototype.stringToGlyphs = function(e, r) {
|
|
8032
8032
|
var t = this, n = new ae(), a = function(c) {
|
|
8033
8033
|
return t.charToGlyphIndex(c.char);
|
|
8034
8034
|
};
|
|
@@ -8039,22 +8039,22 @@ B.prototype.stringToGlyphs = function(e, r) {
|
|
|
8039
8039
|
i[f] = this.glyphs.get(o[f]) || l;
|
|
8040
8040
|
return i;
|
|
8041
8041
|
};
|
|
8042
|
-
|
|
8042
|
+
M.prototype.nameToGlyphIndex = function(e) {
|
|
8043
8043
|
return this.glyphNames.nameToGlyphIndex(e);
|
|
8044
8044
|
};
|
|
8045
|
-
|
|
8045
|
+
M.prototype.nameToGlyph = function(e) {
|
|
8046
8046
|
var r = this.nameToGlyphIndex(e), t = this.glyphs.get(r);
|
|
8047
8047
|
return t || (t = this.glyphs.get(0)), t;
|
|
8048
8048
|
};
|
|
8049
|
-
|
|
8049
|
+
M.prototype.glyphIndexToName = function(e) {
|
|
8050
8050
|
return this.glyphNames.glyphIndexToName ? this.glyphNames.glyphIndexToName(e) : "";
|
|
8051
8051
|
};
|
|
8052
|
-
|
|
8052
|
+
M.prototype.getKerningValue = function(e, r) {
|
|
8053
8053
|
e = e.index || e, r = r.index || r;
|
|
8054
8054
|
var t = this.position.defaultKerningTables;
|
|
8055
8055
|
return t ? this.position.getKerningValue(t, e, r) : this.kerningPairs[e + "," + r] || 0;
|
|
8056
8056
|
};
|
|
8057
|
-
|
|
8057
|
+
M.prototype.defaultRenderOptions = {
|
|
8058
8058
|
kerning: !0,
|
|
8059
8059
|
features: [
|
|
8060
8060
|
/**
|
|
@@ -8065,7 +8065,7 @@ B.prototype.defaultRenderOptions = {
|
|
|
8065
8065
|
{ script: "latn", tags: ["liga", "rlig"] }
|
|
8066
8066
|
]
|
|
8067
8067
|
};
|
|
8068
|
-
|
|
8068
|
+
M.prototype.forEachGlyph = function(e, r, t, n, a, s) {
|
|
8069
8069
|
r = r !== void 0 ? r : 0, t = t !== void 0 ? t : 0, n = n !== void 0 ? n : 72, a = Object.assign({}, this.defaultRenderOptions, a);
|
|
8070
8070
|
var o = 1 / this.unitsPerEm * n, u = this.stringToGlyphs(e, a), i;
|
|
8071
8071
|
if (a.kerning) {
|
|
@@ -8082,43 +8082,43 @@ B.prototype.forEachGlyph = function(e, r, t, n, a, s) {
|
|
|
8082
8082
|
}
|
|
8083
8083
|
return r;
|
|
8084
8084
|
};
|
|
8085
|
-
|
|
8085
|
+
M.prototype.getPath = function(e, r, t, n, a) {
|
|
8086
8086
|
var s = new V();
|
|
8087
8087
|
return this.forEachGlyph(e, r, t, n, a, function(o, u, i, l) {
|
|
8088
8088
|
var f = o.getPath(u, i, l, a, this);
|
|
8089
8089
|
s.extend(f);
|
|
8090
8090
|
}), s;
|
|
8091
8091
|
};
|
|
8092
|
-
|
|
8092
|
+
M.prototype.getPaths = function(e, r, t, n, a) {
|
|
8093
8093
|
var s = [];
|
|
8094
8094
|
return this.forEachGlyph(e, r, t, n, a, function(o, u, i, l) {
|
|
8095
8095
|
var f = o.getPath(u, i, l, a, this);
|
|
8096
8096
|
s.push(f);
|
|
8097
8097
|
}), s;
|
|
8098
8098
|
};
|
|
8099
|
-
|
|
8099
|
+
M.prototype.getAdvanceWidth = function(e, r, t) {
|
|
8100
8100
|
return this.forEachGlyph(e, 0, 0, r, t, function() {
|
|
8101
8101
|
});
|
|
8102
8102
|
};
|
|
8103
|
-
|
|
8103
|
+
M.prototype.draw = function(e, r, t, n, a, s) {
|
|
8104
8104
|
this.getPath(r, t, n, a, s).draw(e);
|
|
8105
8105
|
};
|
|
8106
|
-
|
|
8106
|
+
M.prototype.drawPoints = function(e, r, t, n, a, s) {
|
|
8107
8107
|
this.forEachGlyph(r, t, n, a, s, function(o, u, i, l) {
|
|
8108
8108
|
o.drawPoints(e, u, i, l);
|
|
8109
8109
|
});
|
|
8110
8110
|
};
|
|
8111
|
-
|
|
8111
|
+
M.prototype.drawMetrics = function(e, r, t, n, a, s) {
|
|
8112
8112
|
this.forEachGlyph(r, t, n, a, s, function(o, u, i, l) {
|
|
8113
8113
|
o.drawMetrics(e, u, i, l);
|
|
8114
8114
|
});
|
|
8115
8115
|
};
|
|
8116
|
-
|
|
8116
|
+
M.prototype.getEnglishName = function(e) {
|
|
8117
8117
|
var r = this.names[e];
|
|
8118
8118
|
if (r)
|
|
8119
8119
|
return r.en;
|
|
8120
8120
|
};
|
|
8121
|
-
|
|
8121
|
+
M.prototype.validate = function() {
|
|
8122
8122
|
var e = this;
|
|
8123
8123
|
function r(n, a) {
|
|
8124
8124
|
}
|
|
@@ -8128,18 +8128,18 @@ B.prototype.validate = function() {
|
|
|
8128
8128
|
}
|
|
8129
8129
|
t("fontFamily"), t("weightName"), t("manufacturer"), t("copyright"), t("version"), this.unitsPerEm > 0;
|
|
8130
8130
|
};
|
|
8131
|
-
|
|
8131
|
+
M.prototype.toTables = function() {
|
|
8132
8132
|
return ys.fontToTable(this);
|
|
8133
8133
|
};
|
|
8134
|
-
|
|
8134
|
+
M.prototype.toBuffer = function() {
|
|
8135
8135
|
return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."), this.toArrayBuffer();
|
|
8136
8136
|
};
|
|
8137
|
-
|
|
8137
|
+
M.prototype.toArrayBuffer = function() {
|
|
8138
8138
|
for (var e = this.toTables(), r = e.encode(), t = new ArrayBuffer(r.length), n = new Uint8Array(t), a = 0; a < r.length; a++)
|
|
8139
8139
|
n[a] = r[a];
|
|
8140
8140
|
return t;
|
|
8141
8141
|
};
|
|
8142
|
-
|
|
8142
|
+
M.prototype.download = function(e) {
|
|
8143
8143
|
var r = this.getEnglishName("fontFamily"), t = this.getEnglishName("fontSubfamily");
|
|
8144
8144
|
e = e || r.replace(/\s/g, "") + "-" + t + ".otf";
|
|
8145
8145
|
var n = this.toArrayBuffer();
|
|
@@ -8156,7 +8156,7 @@ B.prototype.download = function(e) {
|
|
|
8156
8156
|
i.writeFileSync(e, l);
|
|
8157
8157
|
}
|
|
8158
8158
|
};
|
|
8159
|
-
|
|
8159
|
+
M.prototype.fsSelectionValues = {
|
|
8160
8160
|
ITALIC: 1,
|
|
8161
8161
|
//1
|
|
8162
8162
|
UNDERSCORE: 2,
|
|
@@ -8178,7 +8178,7 @@ B.prototype.fsSelectionValues = {
|
|
|
8178
8178
|
OBLIQUE: 512
|
|
8179
8179
|
//512
|
|
8180
8180
|
};
|
|
8181
|
-
|
|
8181
|
+
M.prototype.usWidthClasses = {
|
|
8182
8182
|
ULTRA_CONDENSED: 1,
|
|
8183
8183
|
EXTRA_CONDENSED: 2,
|
|
8184
8184
|
CONDENSED: 3,
|
|
@@ -8189,7 +8189,7 @@ B.prototype.usWidthClasses = {
|
|
|
8189
8189
|
EXTRA_EXPANDED: 8,
|
|
8190
8190
|
ULTRA_EXPANDED: 9
|
|
8191
8191
|
};
|
|
8192
|
-
|
|
8192
|
+
M.prototype.usWeightClasses = {
|
|
8193
8193
|
THIN: 100,
|
|
8194
8194
|
EXTRA_LIGHT: 200,
|
|
8195
8195
|
LIGHT: 300,
|
|
@@ -8223,11 +8223,11 @@ function Ai(e, r, t) {
|
|
|
8223
8223
|
{ name: "nameID_" + e, type: "USHORT", value: n }
|
|
8224
8224
|
];
|
|
8225
8225
|
}
|
|
8226
|
-
function
|
|
8226
|
+
function Bi(e, r, t) {
|
|
8227
8227
|
var n = {}, a = new F.Parser(e, r);
|
|
8228
8228
|
return n.tag = a.parseTag(), n.minValue = a.parseFixed(), n.defaultValue = a.parseFixed(), n.maxValue = a.parseFixed(), a.skip("uShort", 1), n.name = t[a.parseUShort()] || {}, n;
|
|
8229
8229
|
}
|
|
8230
|
-
function
|
|
8230
|
+
function Mi(e, r, t, n) {
|
|
8231
8231
|
for (var a = Dn(r.name, n), s = [
|
|
8232
8232
|
{ name: "nameID_" + e, type: "USHORT", value: a },
|
|
8233
8233
|
{ name: "flags_" + e, type: "USHORT", value: 0 }
|
|
@@ -8262,7 +8262,7 @@ function Pi(e, r) {
|
|
|
8262
8262
|
for (var n = 0; n < e.axes.length; n++)
|
|
8263
8263
|
t.fields = t.fields.concat(Ai(n, e.axes[n], r));
|
|
8264
8264
|
for (var a = 0; a < e.instances.length; a++)
|
|
8265
|
-
t.fields = t.fields.concat(
|
|
8265
|
+
t.fields = t.fields.concat(Mi(a, e.instances[a], e.axes, r));
|
|
8266
8266
|
return t;
|
|
8267
8267
|
}
|
|
8268
8268
|
function Gi(e, r, t) {
|
|
@@ -8271,7 +8271,7 @@ function Gi(e, r, t) {
|
|
|
8271
8271
|
var s = n.parseOffset16();
|
|
8272
8272
|
n.skip("uShort", 1);
|
|
8273
8273
|
for (var o = n.parseUShort(), u = n.parseUShort(), i = n.parseUShort(), l = n.parseUShort(), f = [], c = 0; c < o; c++)
|
|
8274
|
-
f.push(
|
|
8274
|
+
f.push(Bi(e, r + s + c * u, t));
|
|
8275
8275
|
for (var p = [], h = r + s + o * u, d = 0; d < i; d++)
|
|
8276
8276
|
p.push(Ii(e, h + d * l, f, t));
|
|
8277
8277
|
return { axes: f, instances: p };
|
|
@@ -8484,7 +8484,7 @@ function au(e, r) {
|
|
|
8484
8484
|
r("Font could not be loaded");
|
|
8485
8485
|
}, t.send();
|
|
8486
8486
|
}
|
|
8487
|
-
function
|
|
8487
|
+
function Bt(e, r) {
|
|
8488
8488
|
for (var t = [], n = 12, a = 0; a < r; a += 1) {
|
|
8489
8489
|
var s = F.getTag(e, n), o = F.getULong(e, n + 4), u = F.getULong(e, n + 8), i = F.getULong(e, n + 12);
|
|
8490
8490
|
t.push({ tag: s, checksum: o, offset: u, length: i, compression: !1 }), n += 16;
|
|
@@ -8516,11 +8516,11 @@ function N(e, r) {
|
|
|
8516
8516
|
}
|
|
8517
8517
|
function $r(e, r) {
|
|
8518
8518
|
r = r ?? {};
|
|
8519
|
-
var t, n, a = new
|
|
8519
|
+
var t, n, a = new M({ empty: !0 }), s = new DataView(e, 0), o, u = [], i = F.getTag(s, 0);
|
|
8520
8520
|
if (i === "\0\0\0" || i === "true" || i === "typ1")
|
|
8521
|
-
a.outlinesFormat = "truetype", o = F.getUShort(s, 4), u =
|
|
8521
|
+
a.outlinesFormat = "truetype", o = F.getUShort(s, 4), u = Bt(s, o);
|
|
8522
8522
|
else if (i === "OTTO")
|
|
8523
|
-
a.outlinesFormat = "cff", o = F.getUShort(s, 4), u =
|
|
8523
|
+
a.outlinesFormat = "cff", o = F.getUShort(s, 4), u = Bt(s, o);
|
|
8524
8524
|
else if (i === "wOFF") {
|
|
8525
8525
|
var l = F.getTag(s, 4);
|
|
8526
8526
|
if (l === "\0\0\0")
|
|
@@ -8632,8 +8632,8 @@ function $r(e, r) {
|
|
|
8632
8632
|
a.tables.fvar = Ni.parse($.data, $.offset, a.names);
|
|
8633
8633
|
}
|
|
8634
8634
|
if (L) {
|
|
8635
|
-
var
|
|
8636
|
-
a.tables.meta = yn.parse(
|
|
8635
|
+
var B = N(s, L);
|
|
8636
|
+
a.tables.meta = yn.parse(B.data, B.offset), a.metas = a.tables.meta;
|
|
8637
8637
|
}
|
|
8638
8638
|
return a;
|
|
8639
8639
|
}
|
|
@@ -8667,7 +8667,7 @@ function iu(e, r) {
|
|
|
8667
8667
|
}
|
|
8668
8668
|
var uu = /* @__PURE__ */ Object.freeze({
|
|
8669
8669
|
__proto__: null,
|
|
8670
|
-
Font:
|
|
8670
|
+
Font: M,
|
|
8671
8671
|
Glyph: K,
|
|
8672
8672
|
Path: V,
|
|
8673
8673
|
BoundingBox: he,
|
|
@@ -8693,8 +8693,8 @@ function lu(e, r) {
|
|
|
8693
8693
|
}
|
|
8694
8694
|
});
|
|
8695
8695
|
}
|
|
8696
|
-
const
|
|
8697
|
-
const t =
|
|
8696
|
+
const Mr = /* @__PURE__ */ new Map(), _u = () => Mr, fu = async (e, r = !1) => {
|
|
8697
|
+
const t = Mr.get(e);
|
|
8698
8698
|
if (t) {
|
|
8699
8699
|
if (r && !t.svgGlyphs) {
|
|
8700
8700
|
const i = await fetch(e);
|
|
@@ -8719,7 +8719,7 @@ const Br = /* @__PURE__ */ new Map(), _u = () => Br, fu = async (e, r = !1) => {
|
|
|
8719
8719
|
o = await i(a);
|
|
8720
8720
|
}
|
|
8721
8721
|
const u = lu(s, o);
|
|
8722
|
-
return
|
|
8722
|
+
return Mr.set(e, u), u;
|
|
8723
8723
|
}, pu = 0.03125, An = 1.1, cu = 0.2, $e = {
|
|
8724
8724
|
outlineWidth: pu,
|
|
8725
8725
|
letterSpacing: 0,
|
|
@@ -8771,7 +8771,7 @@ const vu = (e) => e === void 0 || e === "flat" ? { type: "flat" } : e === "curve
|
|
|
8771
8771
|
}
|
|
8772
8772
|
}
|
|
8773
8773
|
return l += s * (n * An), `M 0 ${l} L ${o} ${l}`;
|
|
8774
|
-
},
|
|
8774
|
+
}, Bn = ({
|
|
8775
8775
|
boxDimensions: e,
|
|
8776
8776
|
baseline: r,
|
|
8777
8777
|
textHeight: t,
|
|
@@ -8779,7 +8779,7 @@ const vu = (e) => e === void 0 || e === "flat" ? { type: "flat" } : e === "curve
|
|
|
8779
8779
|
}) => {
|
|
8780
8780
|
const { width: a, height: s } = e, o = t * cu, u = t + o, i = n === "top" ? 0 : s / 2 - u / 2, l = r + i, f = l + o;
|
|
8781
8781
|
if (n !== "top" && (f > s || l - t < 0))
|
|
8782
|
-
return
|
|
8782
|
+
return Bn({
|
|
8783
8783
|
boxDimensions: e,
|
|
8784
8784
|
baseline: r,
|
|
8785
8785
|
textHeight: t,
|
|
@@ -8823,7 +8823,7 @@ const vu = (e) => e === void 0 || e === "flat" ? { type: "flat" } : e === "curve
|
|
|
8823
8823
|
let l = i.y2 - i.y1;
|
|
8824
8824
|
if (s > 0) {
|
|
8825
8825
|
const d = kr * s;
|
|
8826
|
-
l
|
|
8826
|
+
l += d * 2;
|
|
8827
8827
|
}
|
|
8828
8828
|
const c = l / r.height * r.physicalHeight, p = a[0] / c;
|
|
8829
8829
|
return kr * p;
|
|
@@ -8839,9 +8839,9 @@ const vu = (e) => e === void 0 || e === "flat" ? { type: "flat" } : e === "curve
|
|
|
8839
8839
|
height: h,
|
|
8840
8840
|
baseline: d
|
|
8841
8841
|
};
|
|
8842
|
-
}, Zr = window.DOMParser, bu = globalThis.DOMMatrix,
|
|
8843
|
-
|
|
8844
|
-
|
|
8842
|
+
}, Zr = window.DOMParser, bu = globalThis.DOMMatrix, Mn = typeof window < "u" ? new URL(window.location.href) : null;
|
|
8843
|
+
Mn?.searchParams.get("mode");
|
|
8844
|
+
Mn?.searchParams.has("rasterlayplan");
|
|
8845
8845
|
typeof navigator < "u" && navigator.vendor && navigator.vendor.indexOf("Apple") > -1;
|
|
8846
8846
|
const Su = {
|
|
8847
8847
|
aliceblue: "#f0f8ff",
|
|
@@ -8995,7 +8995,13 @@ const Su = {
|
|
|
8995
8995
|
}, Tu = (e) => {
|
|
8996
8996
|
let r = Array.from(e), t = !1;
|
|
8997
8997
|
return r[0] === "#" && (r.shift(), t = !0), r.length === 3 && (r = r.map((n) => `${n}${n}`)), `${t ? "#" : ""}${r.join("").toLowerCase()}`;
|
|
8998
|
-
}, Fr = (e) =>
|
|
8998
|
+
}, Fr = (e) => {
|
|
8999
|
+
const r = typeof e == "string" ? Number.parseInt(e, 10) : e;
|
|
9000
|
+
return Math.max(0, Math.min(255, Math.round(r))).toString(16).padStart(2, "0");
|
|
9001
|
+
}, Mt = (...e) => {
|
|
9002
|
+
const [r, t, n] = Array.isArray(e[0]) ? e[0] : e;
|
|
9003
|
+
return `#${Fr(r)}${Fr(t)}${Fr(n)}`;
|
|
9004
|
+
}, ku = (e, r, t) => {
|
|
8999
9005
|
if (r === 0) {
|
|
9000
9006
|
const f = Math.round(t * 255);
|
|
9001
9007
|
return [f, f, f];
|
|
@@ -9015,7 +9021,7 @@ const Su = {
|
|
|
9015
9021
|
const n = r.match(
|
|
9016
9022
|
/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)/
|
|
9017
9023
|
);
|
|
9018
|
-
return n ?
|
|
9024
|
+
return n ? Mt(
|
|
9019
9025
|
Number.parseInt(n[1], 10),
|
|
9020
9026
|
Number.parseInt(n[2], 10),
|
|
9021
9027
|
Number.parseInt(n[3], 10)
|
|
@@ -9027,7 +9033,7 @@ const Su = {
|
|
|
9027
9033
|
);
|
|
9028
9034
|
if (!n) return;
|
|
9029
9035
|
const a = Number.parseInt(n[1], 10), s = Number.parseFloat(n[2]) / 100, o = Number.parseFloat(n[3]) / 100, [u, i, l] = ku(a, s, o);
|
|
9030
|
-
return
|
|
9036
|
+
return Mt(u, i, l);
|
|
9031
9037
|
}
|
|
9032
9038
|
const t = Su[r];
|
|
9033
9039
|
if (t) return t;
|
|
@@ -9148,10 +9154,10 @@ function Au(e, r) {
|
|
|
9148
9154
|
}
|
|
9149
9155
|
return Gn(t, n);
|
|
9150
9156
|
}
|
|
9151
|
-
const
|
|
9157
|
+
const Bu = ["fill", "stroke", "stop-color"], Mu = ["path", "rect", "circle", "ellipse", "polygon", "polyline", "text"];
|
|
9152
9158
|
function Iu(e, r) {
|
|
9153
9159
|
const { doc: t, wasWrapped: n } = Pn(e);
|
|
9154
|
-
for (const s of
|
|
9160
|
+
for (const s of Bu)
|
|
9155
9161
|
for (const o of t.querySelectorAll(`[${s}]`)) {
|
|
9156
9162
|
const u = o.getAttribute(s);
|
|
9157
9163
|
if (!u || !Lu(u)) continue;
|
|
@@ -9160,7 +9166,7 @@ function Iu(e, r) {
|
|
|
9160
9166
|
}
|
|
9161
9167
|
const a = r["#000000"];
|
|
9162
9168
|
if (a) {
|
|
9163
|
-
const s =
|
|
9169
|
+
const s = Mu.map((o) => `${o}:not([fill])`).join(", ");
|
|
9164
9170
|
for (const o of t.querySelectorAll(s))
|
|
9165
9171
|
o.setAttribute("fill", a.hex);
|
|
9166
9172
|
}
|
|
@@ -9207,13 +9213,13 @@ const It = (e, r, t) => e / t * r, Nu = ({
|
|
|
9207
9213
|
throw new Error(
|
|
9208
9214
|
`TOO_WIDE: character "${t[R]}" at index ${R} exceeds baseline path length (${Math.round(I + W)} > ${Math.round(p)})`
|
|
9209
9215
|
);
|
|
9210
|
-
const z = I + Y / 2, $ = f.getTangentAtLength(z),
|
|
9216
|
+
const z = I + Y / 2, $ = f.getTangentAtLength(z), B = Math.atan2($.y, $.x) * 180 / Math.PI, _ = f.getPointAtLength(I), De = _.x, pr = _.y, Ae = A.x2 - A.x1, Be = new fe(A.x1 + Ae / 2, 0), Me = hu(
|
|
9211
9217
|
new fe(A.x1, 0),
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
), Ce = De -
|
|
9218
|
+
B,
|
|
9219
|
+
Be
|
|
9220
|
+
), Ce = De - Me.X, Nn = pr - Me.Y;
|
|
9215
9221
|
let se = Pu();
|
|
9216
|
-
se = se.translate(Ce, Nn),
|
|
9222
|
+
se = se.translate(Ce, Nn), B && (se = se.translate(A.x1 + Ae / 2, 0), se = se.rotate(B), se = se.translate(-A.x1 - Ae / 2, 0));
|
|
9217
9223
|
const Hn = se.toString();
|
|
9218
9224
|
let ve = q.toPathData(2);
|
|
9219
9225
|
ve.length && !ve.endsWith("Z") && (ve += "Z", ve = ve.replace(/M/g, "ZM"), ve = ve.substring(1));
|
|
@@ -9325,7 +9331,7 @@ const It = (e, r, t) => e / t * r, Nu = ({
|
|
|
9325
9331
|
du(y.path), T = y.path;
|
|
9326
9332
|
break;
|
|
9327
9333
|
case "curved":
|
|
9328
|
-
T =
|
|
9334
|
+
T = Bn({
|
|
9329
9335
|
boxDimensions: a,
|
|
9330
9336
|
baseline: x[C].baseline,
|
|
9331
9337
|
textHeight: x[C].height,
|
|
@@ -9370,7 +9376,7 @@ export {
|
|
|
9370
9376
|
pu as DEFAULT_OUTLINE_FACTOR,
|
|
9371
9377
|
$e as DEFAULT_SPACING,
|
|
9372
9378
|
An as LINE_HEIGHT,
|
|
9373
|
-
|
|
9379
|
+
Bn as generateCurvedBaseline,
|
|
9374
9380
|
gu as generateFlatBaseline,
|
|
9375
9381
|
_u as getFontCache,
|
|
9376
9382
|
Vu as getFontColours,
|