@glissade/core 0.13.0-pre.1 → 0.13.0-pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/font-ingest.js +13 -2
- package/package.json +2 -1
package/dist/font-ingest.js
CHANGED
|
@@ -104,6 +104,17 @@ async function loadSubsetFont() {
|
|
|
104
104
|
});
|
|
105
105
|
return subsetFontPromise;
|
|
106
106
|
}
|
|
107
|
+
let fontverterPromise;
|
|
108
|
+
async function loadFontverter() {
|
|
109
|
+
fontverterPromise ??= import("fontverter").then((m) => {
|
|
110
|
+
const convert = (m.default ?? m).convert;
|
|
111
|
+
if (typeof convert !== "function") throw new FontIngestError(`'fontverter' loaded but exposes no convert() — incompatible version`);
|
|
112
|
+
return convert;
|
|
113
|
+
}, (err) => {
|
|
114
|
+
throw new FontIngestError(`font ingestion needs the optional 'fontverter' dependency for woff/woff2 decode — install it. (${String(err?.message ?? err)})`);
|
|
115
|
+
});
|
|
116
|
+
return fontverterPromise;
|
|
117
|
+
}
|
|
107
118
|
/**
|
|
108
119
|
* Build the "retain every code point" string from a font's own cmap — used to
|
|
109
120
|
* run hb-subset purely as a woff2 DECODER / variable-axis INSTANCER without
|
|
@@ -132,10 +143,10 @@ async function ingestFont(init) {
|
|
|
132
143
|
let bytes;
|
|
133
144
|
if (!needsDecode && !needsInstance) bytes = input;
|
|
134
145
|
else {
|
|
135
|
-
const subsetFont = await loadSubsetFont();
|
|
136
146
|
let decoded = input;
|
|
137
|
-
if (needsDecode) decoded = await
|
|
147
|
+
if (needsDecode) decoded = await (await loadFontverter())(Buffer.from(input), "truetype");
|
|
138
148
|
if (needsInstance) {
|
|
149
|
+
const subsetFont = await loadSubsetFont();
|
|
139
150
|
const coverage = parseCmap(decoded);
|
|
140
151
|
decoded = await subsetFont(decoded, retainAllText(coverage), {
|
|
141
152
|
targetFormat: "sfnt",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/core",
|
|
3
|
-
"version": "0.13.0-pre.
|
|
3
|
+
"version": "0.13.0-pre.3",
|
|
4
4
|
"description": "glissade core: signals, tracks, timeline document, evaluation, easing, springs, seeded RNG. Zero DOM/Node dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"directory": "packages/core"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
+
"fontverter": "^2.0.0",
|
|
38
39
|
"subset-font": "^2.5.0"
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|