@turntrout/subfont 1.7.0 → 1.8.0
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/CLAUDE.md +39 -13
- package/README.md +24 -14
- package/lib/FontTracerPool.d.ts +38 -0
- package/lib/FontTracerPool.d.ts.map +1 -0
- package/lib/FontTracerPool.js +230 -217
- package/lib/FontTracerPool.js.map +1 -0
- package/lib/HeadlessBrowser.d.ts +18 -0
- package/lib/HeadlessBrowser.d.ts.map +1 -0
- package/lib/HeadlessBrowser.js +216 -210
- package/lib/HeadlessBrowser.js.map +1 -0
- package/lib/cli.d.ts +3 -0
- package/lib/cli.d.ts.map +1 -0
- package/lib/cli.js +15 -12
- package/lib/cli.js.map +1 -0
- package/lib/codepointMaps.d.ts +4 -0
- package/lib/codepointMaps.d.ts.map +1 -0
- package/lib/codepointMaps.js +99 -0
- package/lib/codepointMaps.js.map +1 -0
- package/lib/collectFeatureGlyphIds.d.ts +3 -0
- package/lib/collectFeatureGlyphIds.d.ts.map +1 -0
- package/lib/collectFeatureGlyphIds.js +124 -138
- package/lib/collectFeatureGlyphIds.js.map +1 -0
- package/lib/collectTextsByPage.d.ts +41 -0
- package/lib/collectTextsByPage.d.ts.map +1 -0
- package/lib/collectTextsByPage.js +726 -965
- package/lib/collectTextsByPage.js.map +1 -0
- package/lib/concurrencyLimit.d.ts +3 -0
- package/lib/concurrencyLimit.d.ts.map +1 -0
- package/lib/concurrencyLimit.js +12 -11
- package/lib/concurrencyLimit.js.map +1 -0
- package/lib/escapeJsStringLiteral.d.ts +3 -0
- package/lib/escapeJsStringLiteral.d.ts.map +1 -0
- package/lib/escapeJsStringLiteral.js +7 -6
- package/lib/escapeJsStringLiteral.js.map +1 -0
- package/lib/extractReferencedCustomPropertyNames.d.ts +3 -0
- package/lib/extractReferencedCustomPropertyNames.d.ts.map +1 -0
- package/lib/extractReferencedCustomPropertyNames.js +15 -16
- package/lib/extractReferencedCustomPropertyNames.js.map +1 -0
- package/lib/extractVisibleText.d.ts +7 -0
- package/lib/extractVisibleText.d.ts.map +1 -0
- package/lib/extractVisibleText.js +110 -119
- package/lib/extractVisibleText.js.map +1 -0
- package/lib/findCustomPropertyDefinitions.d.ts +8 -0
- package/lib/findCustomPropertyDefinitions.d.ts.map +1 -0
- package/lib/findCustomPropertyDefinitions.js +41 -48
- package/lib/findCustomPropertyDefinitions.js.map +1 -0
- package/lib/fontConverter.d.ts +2 -0
- package/lib/fontConverter.d.ts.map +1 -0
- package/lib/fontConverter.js +40 -21
- package/lib/fontConverter.js.map +1 -0
- package/lib/fontConverterWorker.d.ts +2 -0
- package/lib/fontConverterWorker.d.ts.map +1 -0
- package/lib/fontConverterWorker.js +52 -15
- package/lib/fontConverterWorker.js.map +1 -0
- package/lib/fontFaceHelpers.d.ts +64 -0
- package/lib/fontFaceHelpers.d.ts.map +1 -0
- package/lib/fontFaceHelpers.js +237 -249
- package/lib/fontFaceHelpers.js.map +1 -0
- package/lib/fontFeatureHelpers.d.ts +30 -0
- package/lib/fontFeatureHelpers.d.ts.map +1 -0
- package/lib/fontFeatureHelpers.js +277 -212
- package/lib/fontFeatureHelpers.js.map +1 -0
- package/lib/fontTracerWorker.d.ts +11 -0
- package/lib/fontTracerWorker.d.ts.map +1 -0
- package/lib/fontTracerWorker.js +94 -60
- package/lib/fontTracerWorker.js.map +1 -0
- package/lib/gatherStylesheetsWithPredicates.d.ts +26 -0
- package/lib/gatherStylesheetsWithPredicates.d.ts.map +1 -0
- package/lib/gatherStylesheetsWithPredicates.js +75 -84
- package/lib/gatherStylesheetsWithPredicates.js.map +1 -0
- package/lib/getCssRulesByProperty.d.ts +29 -0
- package/lib/getCssRulesByProperty.d.ts.map +1 -0
- package/lib/getCssRulesByProperty.js +316 -316
- package/lib/getCssRulesByProperty.js.map +1 -0
- package/lib/getFontInfo.d.ts +11 -0
- package/lib/getFontInfo.d.ts.map +1 -0
- package/lib/getFontInfo.js +31 -33
- package/lib/getFontInfo.js.map +1 -0
- package/lib/initialValueByProp.d.ts +3 -0
- package/lib/initialValueByProp.d.ts.map +1 -0
- package/lib/initialValueByProp.js +20 -17
- package/lib/initialValueByProp.js.map +1 -0
- package/lib/injectSubsetDefinitions.d.ts +3 -0
- package/lib/injectSubsetDefinitions.d.ts.map +1 -0
- package/lib/injectSubsetDefinitions.js +55 -59
- package/lib/injectSubsetDefinitions.js.map +1 -0
- package/lib/normalizeFontPropertyValue.d.ts +3 -0
- package/lib/normalizeFontPropertyValue.d.ts.map +1 -0
- package/lib/normalizeFontPropertyValue.js +59 -54
- package/lib/normalizeFontPropertyValue.js.map +1 -0
- package/lib/parseCommandLineOptions.d.ts +9 -0
- package/lib/parseCommandLineOptions.d.ts.map +1 -0
- package/lib/parseCommandLineOptions.js +145 -149
- package/lib/parseCommandLineOptions.js.map +1 -0
- package/lib/parseFontVariationSettings.d.ts +3 -0
- package/lib/parseFontVariationSettings.d.ts.map +1 -0
- package/lib/parseFontVariationSettings.js +38 -36
- package/lib/parseFontVariationSettings.js.map +1 -0
- package/lib/progress.d.ts +27 -0
- package/lib/progress.d.ts.map +1 -0
- package/lib/progress.js +51 -54
- package/lib/progress.js.map +1 -0
- package/lib/sfntCache.d.ts +4 -0
- package/lib/sfntCache.d.ts.map +1 -0
- package/lib/sfntCache.js +67 -25
- package/lib/sfntCache.js.map +1 -0
- package/lib/stripLocalTokens.d.ts +3 -0
- package/lib/stripLocalTokens.d.ts.map +1 -0
- package/lib/stripLocalTokens.js +23 -21
- package/lib/stripLocalTokens.js.map +1 -0
- package/lib/subfont.d.ts +54 -0
- package/lib/subfont.d.ts.map +1 -0
- package/lib/subfont.js +531 -629
- package/lib/subfont.js.map +1 -0
- package/lib/subsetFontWithGlyphs.d.ts +21 -0
- package/lib/subsetFontWithGlyphs.d.ts.map +1 -0
- package/lib/subsetFontWithGlyphs.js +285 -259
- package/lib/subsetFontWithGlyphs.js.map +1 -0
- package/lib/subsetFonts.d.ts +55 -0
- package/lib/subsetFonts.d.ts.map +1 -0
- package/lib/subsetFonts.js +899 -1200
- package/lib/subsetFonts.js.map +1 -0
- package/lib/subsetGeneration.d.ts +36 -0
- package/lib/subsetGeneration.d.ts.map +1 -0
- package/lib/subsetGeneration.js +328 -325
- package/lib/subsetGeneration.js.map +1 -0
- package/lib/types/shared.d.ts +11 -0
- package/lib/types/shared.d.ts.map +1 -0
- package/lib/types/shared.js +3 -0
- package/lib/types/shared.js.map +1 -0
- package/lib/unicodeRange.d.ts +3 -0
- package/lib/unicodeRange.d.ts.map +1 -0
- package/lib/unicodeRange.js +17 -30
- package/lib/unicodeRange.js.map +1 -0
- package/lib/unquote.d.ts +3 -0
- package/lib/unquote.d.ts.map +1 -0
- package/lib/unquote.js +18 -25
- package/lib/unquote.js.map +1 -0
- package/lib/variationAxes.d.ts +33 -0
- package/lib/variationAxes.d.ts.map +1 -0
- package/lib/variationAxes.js +127 -157
- package/lib/variationAxes.js.map +1 -0
- package/lib/warnAboutMissingGlyphs.d.ts +43 -0
- package/lib/warnAboutMissingGlyphs.d.ts.map +1 -0
- package/lib/warnAboutMissingGlyphs.js +139 -147
- package/lib/warnAboutMissingGlyphs.js.map +1 -0
- package/lib/wasmQueue.d.ts +3 -0
- package/lib/wasmQueue.d.ts.map +1 -0
- package/lib/wasmQueue.js +13 -10
- package/lib/wasmQueue.js.map +1 -0
- package/package.json +12 -2
|
@@ -1,316 +1,342 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
const os = require("os");
|
|
36
|
+
const promises_1 = require("fs/promises");
|
|
37
|
+
const fontverter = __importStar(require("fontverter"));
|
|
38
|
+
const sfntCache_1 = require("./sfntCache");
|
|
39
|
+
const fontConverter_1 = require("./fontConverter");
|
|
7
40
|
// hb_subset_sets_t enum values — https://github.com/harfbuzz/harfbuzz/blob/main/src/hb-subset.h
|
|
8
41
|
const HB_SUBSET_SETS_GLYPH_INDEX = 0;
|
|
9
|
-
const HB_SUBSET_SETS_DROP_TABLE_TAG =
|
|
10
|
-
const HB_SUBSET_SETS_LAYOUT_FEATURE_TAG = 6;
|
|
42
|
+
const HB_SUBSET_SETS_DROP_TABLE_TAG = 3;
|
|
11
43
|
const HB_SUBSET_SETS_NAME_ID = 4;
|
|
12
|
-
|
|
44
|
+
const HB_SUBSET_SETS_NAME_LANG_ID = 5;
|
|
45
|
+
const HB_SUBSET_SETS_LAYOUT_FEATURE_TAG = 6;
|
|
46
|
+
const HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG = 7;
|
|
47
|
+
// Windows English (United States). The only name-table language we keep —
|
|
48
|
+
// browsers don't expose localized name strings to web pages, so other lang
|
|
49
|
+
// IDs are pure overhead.
|
|
50
|
+
const KEEP_NAME_LANG_ID_EN_US = 0x0409;
|
|
13
51
|
// hb_subset_flags_t
|
|
14
52
|
const HB_SUBSET_FLAGS_NO_HINTING = 0x00000001;
|
|
15
|
-
|
|
16
53
|
// Pool of WASM instances for parallel subsetting. Each instance has its
|
|
17
54
|
// own linear memory so concurrent calls are safe. The module is compiled
|
|
18
55
|
// once and instantiated N times (N = CPU count, capped at 8).
|
|
19
56
|
let _compilePromise;
|
|
20
57
|
function compileModule() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
return _compilePromise;
|
|
58
|
+
if (!_compilePromise) {
|
|
59
|
+
// Assign the promise synchronously so concurrent callers share it
|
|
60
|
+
// (an async function would await readFile before the assignment).
|
|
61
|
+
_compilePromise = (0, promises_1.readFile)(require.resolve('harfbuzzjs/hb-subset.wasm')).then((buf) => WebAssembly.compile(buf));
|
|
62
|
+
}
|
|
63
|
+
return _compilePromise;
|
|
29
64
|
}
|
|
30
|
-
|
|
31
|
-
const _pool = []; // Array of { exports, busy: boolean }
|
|
65
|
+
const _pool = [];
|
|
32
66
|
let _poolReady;
|
|
33
67
|
const POOL_SIZE = Math.max(1, Math.min(os.cpus().length, 8));
|
|
34
|
-
|
|
35
68
|
async function initPool() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
if (!_poolReady) {
|
|
70
|
+
_poolReady = (async () => {
|
|
71
|
+
const mod = await compileModule();
|
|
72
|
+
const instantiations = [];
|
|
73
|
+
for (let i = 0; i < POOL_SIZE; i++) {
|
|
74
|
+
instantiations.push(WebAssembly.instantiate(mod).then((inst) => {
|
|
75
|
+
_pool.push({
|
|
76
|
+
// WebAssembly.Exports is opaque (Record<string, ExportValue>);
|
|
77
|
+
// bridge it to our typed surface in one place.
|
|
78
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
79
|
+
exports: inst.exports,
|
|
80
|
+
busy: false,
|
|
81
|
+
});
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
await Promise.all(instantiations);
|
|
85
|
+
})();
|
|
86
|
+
}
|
|
87
|
+
return _poolReady;
|
|
51
88
|
}
|
|
52
|
-
|
|
53
89
|
// Waiters queue: callers waiting for an idle WASM instance.
|
|
54
90
|
const _waiters = [];
|
|
55
91
|
const ACQUIRE_TIMEOUT_MS = 120_000;
|
|
56
|
-
|
|
57
92
|
async function acquireInstance() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
_waiters.push(entry);
|
|
81
|
-
});
|
|
93
|
+
await initPool();
|
|
94
|
+
const idle = _pool.find((inst) => !inst.busy);
|
|
95
|
+
if (idle) {
|
|
96
|
+
idle.busy = true;
|
|
97
|
+
return idle;
|
|
98
|
+
}
|
|
99
|
+
// All instances busy — wait for one to be released.
|
|
100
|
+
return new Promise((resolve, reject) => {
|
|
101
|
+
const entry = (inst) => {
|
|
102
|
+
clearTimeout(timer);
|
|
103
|
+
resolve(inst);
|
|
104
|
+
};
|
|
105
|
+
const timer = setTimeout(() => {
|
|
106
|
+
const idx = _waiters.indexOf(entry);
|
|
107
|
+
if (idx !== -1)
|
|
108
|
+
_waiters.splice(idx, 1);
|
|
109
|
+
reject(new Error(`Timed out waiting for a WASM subsetting instance after ${ACQUIRE_TIMEOUT_MS}ms`));
|
|
110
|
+
}, ACQUIRE_TIMEOUT_MS);
|
|
111
|
+
timer.unref();
|
|
112
|
+
_waiters.push(entry);
|
|
113
|
+
});
|
|
82
114
|
}
|
|
83
|
-
|
|
84
115
|
function releaseInstance(inst) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
116
|
+
inst.busy = false;
|
|
117
|
+
if (_waiters.length > 0) {
|
|
118
|
+
inst.busy = true;
|
|
119
|
+
const waiter = _waiters.shift();
|
|
120
|
+
if (waiter)
|
|
121
|
+
waiter(inst);
|
|
122
|
+
}
|
|
90
123
|
}
|
|
91
|
-
|
|
92
124
|
// woff2 encode/decode uses wawoff2's WASM module, which has a shared
|
|
93
125
|
// instance that corrupts memory under concurrent use. Instead of
|
|
94
126
|
// serializing to p-limit(1) in the main thread, we route woff2
|
|
95
127
|
// operations through fontConverterPool — each worker thread loads its
|
|
96
128
|
// own wawoff2 instance, enabling safe parallel compression.
|
|
97
|
-
|
|
98
129
|
// Re-create on every call — WASM memory.buffer is detached when memory grows,
|
|
99
130
|
// so a cached Uint8Array would silently read/write stale data.
|
|
100
131
|
function getHeapu8(exports) {
|
|
101
|
-
|
|
132
|
+
return new Uint8Array(exports.memory.buffer);
|
|
102
133
|
}
|
|
103
|
-
|
|
104
134
|
// >>> 0 keeps the accumulator unsigned; without it, tags whose first byte
|
|
105
135
|
// exceeds 0x7F would overflow into negative i32 territory after << 24.
|
|
106
136
|
function HB_TAG(str) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
137
|
+
return str.split('').reduce(function (a, ch) {
|
|
138
|
+
return ((a << 8) >>> 0) + ch.charCodeAt(0);
|
|
139
|
+
}, 0);
|
|
110
140
|
}
|
|
111
|
-
|
|
112
141
|
function pinAxisLocation(exports, input, face, axisName, value) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
value
|
|
118
|
-
);
|
|
119
|
-
if (!ok) {
|
|
120
|
-
throw new Error(`Failed to pin axis ${axisName} to ${value}`);
|
|
121
|
-
}
|
|
142
|
+
const ok = exports.hb_subset_input_pin_axis_location(input, face, HB_TAG(axisName), value);
|
|
143
|
+
if (!ok) {
|
|
144
|
+
throw new Error(`Failed to pin axis ${axisName} to ${value}`);
|
|
145
|
+
}
|
|
122
146
|
}
|
|
123
|
-
|
|
124
147
|
function setAxisRange(exports, input, face, axisName, value) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
value.min,
|
|
130
|
-
value.max,
|
|
131
|
-
value.default ?? NaN
|
|
132
|
-
);
|
|
133
|
-
if (!ok) {
|
|
134
|
-
throw new Error(`Failed to set axis range for ${axisName}`);
|
|
135
|
-
}
|
|
148
|
+
const ok = exports.hb_subset_input_set_axis_range(input, face, HB_TAG(axisName), value.min, value.max, value.default ?? NaN);
|
|
149
|
+
if (!ok) {
|
|
150
|
+
throw new Error(`Failed to set axis range for ${axisName}`);
|
|
151
|
+
}
|
|
136
152
|
}
|
|
137
|
-
|
|
138
153
|
// Tables unnecessary for web rendering — safe to drop unconditionally.
|
|
139
|
-
//
|
|
154
|
+
// HB_SUBSET_FLAGS_NO_HINTING already drops cvt/fpgm/prep/hdmx in the
|
|
155
|
+
// harfbuzzjs build we use; gasp/LTSH/VDMX/DSIG/PCLT survive the flag and
|
|
156
|
+
// must be dropped here.
|
|
140
157
|
const DROP_TABLE_TAGS = ['DSIG', 'LTSH', 'VDMX', 'hdmx', 'gasp', 'PCLT'];
|
|
141
|
-
|
|
158
|
+
// Color and bitmap tables — only relevant for color emoji (Apple/Google)
|
|
159
|
+
// and legacy bitmap fonts. Dropped only when the caller signals that no
|
|
160
|
+
// color content needs to render with this font.
|
|
161
|
+
// Note: 'SVG ' has a trailing space (4-byte tag).
|
|
162
|
+
const COLOR_TABLE_TAGS = [
|
|
163
|
+
'COLR',
|
|
164
|
+
'CPAL',
|
|
165
|
+
'SVG ',
|
|
166
|
+
'CBDT',
|
|
167
|
+
'CBLC',
|
|
168
|
+
'sbix',
|
|
169
|
+
'EBDT',
|
|
170
|
+
'EBLC',
|
|
171
|
+
'EBSC',
|
|
172
|
+
];
|
|
142
173
|
// Name IDs needed for web fonts: family (1), subfamily (2), full name (4),
|
|
143
174
|
// PostScript name (6). Copyright (0), unique ID (3), version (5), and
|
|
144
175
|
// everything above 6 are display/license metadata that browsers never read.
|
|
145
176
|
const KEEP_NAME_IDS = [1, 2, 4, 6];
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const flags = exports.hb_subset_input_get_flags(input);
|
|
165
|
-
exports.hb_subset_input_set_flags(input, flags | HB_SUBSET_FLAGS_NO_HINTING);
|
|
166
|
-
|
|
167
|
-
// --- Keep only essential name table entries ---
|
|
168
|
-
const nameIdSet = exports.hb_subset_input_set(input, HB_SUBSET_SETS_NAME_ID);
|
|
169
|
-
exports.hb_set_clear(nameIdSet);
|
|
170
|
-
for (const id of KEEP_NAME_IDS) {
|
|
171
|
-
exports.hb_set_add(nameIdSet, id);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// --- Drop tables not needed for web rendering ---
|
|
175
|
-
const dropTableSet = exports.hb_subset_input_set(
|
|
176
|
-
input,
|
|
177
|
-
HB_SUBSET_SETS_DROP_TABLE_TAG
|
|
178
|
-
);
|
|
179
|
-
for (const tag of DROP_TABLE_TAGS) {
|
|
180
|
-
exports.hb_set_add(dropTableSet, HB_TAG(tag));
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// --- Add unicode codepoints ---
|
|
184
|
-
const inputUnicodes = exports.hb_subset_input_unicode_set(input);
|
|
185
|
-
// Include codepoints from both NFC and NFD normalized forms so the
|
|
186
|
-
// subsetter covers precomposed and decomposed character variants.
|
|
187
|
-
// This guards against harfbuzz subsetter not always expanding
|
|
188
|
-
// codepoints to their NFC/NFD equivalents (harfbuzz issue #2283).
|
|
189
|
-
const nfc = text.normalize('NFC');
|
|
190
|
-
const nfd = text.normalize('NFD');
|
|
191
|
-
for (const c of nfc) {
|
|
192
|
-
exports.hb_set_add(inputUnicodes, c.codePointAt(0));
|
|
193
|
-
}
|
|
194
|
-
for (const c of nfd) {
|
|
195
|
-
exports.hb_set_add(inputUnicodes, c.codePointAt(0));
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// --- Add explicit glyph IDs (from feature glyph collection) ---
|
|
199
|
-
if (glyphIds && glyphIds.length > 0) {
|
|
200
|
-
const glyphSet = exports.hb_subset_input_set(
|
|
201
|
-
input,
|
|
202
|
-
HB_SUBSET_SETS_GLYPH_INDEX
|
|
203
|
-
);
|
|
204
|
-
for (const gid of glyphIds) {
|
|
205
|
-
exports.hb_set_add(glyphSet, gid);
|
|
177
|
+
function configureSubsetInput(exports, input, face, text, glyphIds, variationAxes, featureTags, dropMathTable, dropColorTables, scriptTags) {
|
|
178
|
+
// --- Retain layout features ---
|
|
179
|
+
// hb_subset_input_create_or_fail pre-populates the layout-features set with
|
|
180
|
+
// a curated list of shaping-essential tags (locl, ccmp, calt, mark, mkmk,
|
|
181
|
+
// Indic/Arabic/Khmer shaping features, etc.). When the caller passes
|
|
182
|
+
// featureTags, we leave that default in place and add the CSS-requested
|
|
183
|
+
// tags on top. Optional features the page never references (e.g. ss##,
|
|
184
|
+
// cv##, smcp, swsh) are then dropped, shrinking the GSUB/GPOS tables.
|
|
185
|
+
// When featureTags is undefined, fall back to retain-all behavior.
|
|
186
|
+
const layoutFeatures = exports.hb_subset_input_set(input, HB_SUBSET_SETS_LAYOUT_FEATURE_TAG);
|
|
187
|
+
if (featureTags === undefined) {
|
|
188
|
+
exports.hb_set_clear(layoutFeatures);
|
|
189
|
+
exports.hb_set_invert(layoutFeatures);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
for (const tag of featureTags) {
|
|
193
|
+
exports.hb_set_add(layoutFeatures, HB_TAG(tag));
|
|
194
|
+
}
|
|
206
195
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
196
|
+
// --- Retain layout scripts ---
|
|
197
|
+
// When scriptTags is provided, replace harfbuzz's default (all scripts)
|
|
198
|
+
// with exactly the listed tags. Undefined leaves the default in place.
|
|
199
|
+
if (scriptTags !== undefined) {
|
|
200
|
+
const layoutScripts = exports.hb_subset_input_set(input, HB_SUBSET_SETS_LAYOUT_SCRIPT_TAG);
|
|
201
|
+
exports.hb_set_clear(layoutScripts);
|
|
202
|
+
for (const tag of scriptTags) {
|
|
203
|
+
exports.hb_set_add(layoutScripts, HB_TAG(tag));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// --- Strip hinting instructions (ignored by modern browsers) ---
|
|
207
|
+
const flags = exports.hb_subset_input_get_flags(input);
|
|
208
|
+
exports.hb_subset_input_set_flags(input, flags | HB_SUBSET_FLAGS_NO_HINTING);
|
|
209
|
+
// --- Keep only essential name table entries ---
|
|
210
|
+
const nameIdSet = exports.hb_subset_input_set(input, HB_SUBSET_SETS_NAME_ID);
|
|
211
|
+
exports.hb_set_clear(nameIdSet);
|
|
212
|
+
for (const id of KEEP_NAME_IDS) {
|
|
213
|
+
exports.hb_set_add(nameIdSet, id);
|
|
214
|
+
}
|
|
215
|
+
// --- Keep only en-US localized name strings ---
|
|
216
|
+
const nameLangSet = exports.hb_subset_input_set(input, HB_SUBSET_SETS_NAME_LANG_ID);
|
|
217
|
+
exports.hb_set_clear(nameLangSet);
|
|
218
|
+
exports.hb_set_add(nameLangSet, KEEP_NAME_LANG_ID_EN_US);
|
|
219
|
+
// --- Drop tables not needed for web rendering ---
|
|
220
|
+
const dropTableSet = exports.hb_subset_input_set(input, HB_SUBSET_SETS_DROP_TABLE_TAG);
|
|
221
|
+
for (const tag of DROP_TABLE_TAGS) {
|
|
222
|
+
exports.hb_set_add(dropTableSet, HB_TAG(tag));
|
|
223
|
+
}
|
|
224
|
+
if (dropMathTable) {
|
|
225
|
+
exports.hb_set_add(dropTableSet, HB_TAG('MATH'));
|
|
226
|
+
}
|
|
227
|
+
if (dropColorTables) {
|
|
228
|
+
for (const tag of COLOR_TABLE_TAGS) {
|
|
229
|
+
exports.hb_set_add(dropTableSet, HB_TAG(tag));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// --- Add unicode codepoints ---
|
|
233
|
+
const inputUnicodes = exports.hb_subset_input_unicode_set(input);
|
|
234
|
+
// Include codepoints from both NFC and NFD normalized forms so the
|
|
235
|
+
// subsetter covers precomposed and decomposed character variants.
|
|
236
|
+
// This guards against harfbuzz subsetter not always expanding
|
|
237
|
+
// codepoints to their NFC/NFD equivalents (harfbuzz issue #2283).
|
|
238
|
+
const nfc = text.normalize('NFC');
|
|
239
|
+
const nfd = text.normalize('NFD');
|
|
240
|
+
for (const c of nfc) {
|
|
241
|
+
exports.hb_set_add(inputUnicodes, c.codePointAt(0));
|
|
242
|
+
}
|
|
243
|
+
for (const c of nfd) {
|
|
244
|
+
exports.hb_set_add(inputUnicodes, c.codePointAt(0));
|
|
245
|
+
}
|
|
246
|
+
// --- Add explicit glyph IDs (from feature glyph collection) ---
|
|
247
|
+
if (glyphIds && glyphIds.length > 0) {
|
|
248
|
+
const glyphSet = exports.hb_subset_input_set(input, HB_SUBSET_SETS_GLYPH_INDEX);
|
|
249
|
+
for (const gid of glyphIds) {
|
|
250
|
+
exports.hb_set_add(glyphSet, gid);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// --- Pin/reduce variation axes ---
|
|
254
|
+
if (variationAxes) {
|
|
255
|
+
for (const [axisName, value] of Object.entries(variationAxes)) {
|
|
256
|
+
if (typeof value === 'number') {
|
|
257
|
+
pinAxisLocation(exports, input, face, axisName, value);
|
|
258
|
+
}
|
|
259
|
+
else if (value && typeof value === 'object') {
|
|
260
|
+
setAxisRange(exports, input, face, axisName, value);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
217
263
|
}
|
|
218
|
-
}
|
|
219
264
|
}
|
|
220
|
-
|
|
221
265
|
function extractSubsetFont(exports, subset) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
266
|
+
const result = exports.hb_face_reference_blob(subset);
|
|
267
|
+
const offset = exports.hb_blob_get_data(result, 0);
|
|
268
|
+
const subsetByteLength = exports.hb_blob_get_length(result);
|
|
269
|
+
if (subsetByteLength === 0) {
|
|
270
|
+
exports.hb_blob_destroy(result);
|
|
271
|
+
throw new Error('Failed to create subset font');
|
|
272
|
+
}
|
|
273
|
+
// Fresh view AFTER the WASM calls above — memory.buffer may have been
|
|
274
|
+
// detached by a grow during hb_face_reference_blob / hb_blob_get_data.
|
|
275
|
+
const heapu8 = getHeapu8(exports);
|
|
276
|
+
if (offset < 0 || offset + subsetByteLength > heapu8.byteLength) {
|
|
277
|
+
exports.hb_blob_destroy(result);
|
|
278
|
+
throw new Error(`WASM returned out-of-bounds offset ${offset} + length ${subsetByteLength} (heap size ${heapu8.byteLength})`);
|
|
279
|
+
}
|
|
280
|
+
const subsetFont = Buffer.from(heapu8.subarray(offset, offset + subsetByteLength));
|
|
236
281
|
exports.hb_blob_destroy(result);
|
|
237
|
-
|
|
238
|
-
`WASM returned out-of-bounds offset ${offset} + length ${subsetByteLength} (heap size ${heapu8.byteLength})`
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const subsetFont = Buffer.from(
|
|
243
|
-
heapu8.subarray(offset, offset + subsetByteLength)
|
|
244
|
-
);
|
|
245
|
-
exports.hb_blob_destroy(result);
|
|
246
|
-
return subsetFont;
|
|
282
|
+
return subsetFont;
|
|
247
283
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
// sfntCache routes woff2 decompression through the worker pool.
|
|
257
|
-
const ttf = await toSfnt(originalFont);
|
|
258
|
-
|
|
259
|
-
const inst = await acquireInstance();
|
|
260
|
-
const { exports } = inst;
|
|
261
|
-
let released = false;
|
|
262
|
-
try {
|
|
263
|
-
const fontBuffer = exports.malloc(ttf.byteLength);
|
|
264
|
-
// Fresh view — memory.buffer may have been detached by a prior malloc/grow.
|
|
265
|
-
getHeapu8(exports).set(new Uint8Array(ttf), fontBuffer);
|
|
266
|
-
|
|
267
|
-
const blob = exports.hb_blob_create(fontBuffer, ttf.byteLength, 2, 0, 0);
|
|
268
|
-
const face = exports.hb_face_create(blob, 0);
|
|
269
|
-
exports.hb_blob_destroy(blob);
|
|
270
|
-
|
|
271
|
-
const input = exports.hb_subset_input_create_or_fail();
|
|
272
|
-
if (input === 0) {
|
|
273
|
-
exports.hb_face_destroy(face);
|
|
274
|
-
exports.free(fontBuffer);
|
|
275
|
-
throw new Error('hb_subset_input_create_or_fail returned zero');
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
let subsetFont;
|
|
279
|
-
let subset = 0;
|
|
284
|
+
async function subsetFontWithGlyphs(originalFont, text, { targetFormat, glyphIds, variationAxes, featureTags, dropMathTable = false, dropColorTables = false, scriptTags, } = {}) {
|
|
285
|
+
// Reuse cached sfnt conversion when available (same buffer may have
|
|
286
|
+
// been converted by getFontInfo or collectFeatureGlyphIds already).
|
|
287
|
+
// sfntCache routes woff2 decompression through the worker pool.
|
|
288
|
+
const ttf = await (0, sfntCache_1.toSfnt)(originalFont);
|
|
289
|
+
const inst = await acquireInstance();
|
|
290
|
+
const { exports } = inst;
|
|
291
|
+
let released = false;
|
|
280
292
|
try {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
const fontBuffer = exports.malloc(ttf.byteLength);
|
|
294
|
+
// Fresh view — memory.buffer may have been detached by a prior malloc/grow.
|
|
295
|
+
getHeapu8(exports).set(new Uint8Array(ttf), fontBuffer);
|
|
296
|
+
const blob = exports.hb_blob_create(fontBuffer, ttf.byteLength, 2, 0, 0);
|
|
297
|
+
const face = exports.hb_face_create(blob, 0);
|
|
298
|
+
exports.hb_blob_destroy(blob);
|
|
299
|
+
const input = exports.hb_subset_input_create_or_fail();
|
|
300
|
+
if (input === 0) {
|
|
301
|
+
exports.hb_face_destroy(face);
|
|
302
|
+
exports.free(fontBuffer);
|
|
303
|
+
throw new Error('hb_subset_input_create_or_fail returned zero');
|
|
304
|
+
}
|
|
305
|
+
let subsetFont;
|
|
306
|
+
let subset = 0;
|
|
307
|
+
try {
|
|
308
|
+
configureSubsetInput(exports, input, face, text, glyphIds, variationAxes, featureTags, dropMathTable, dropColorTables, scriptTags);
|
|
309
|
+
subset = exports.hb_subset_or_fail(face, input);
|
|
310
|
+
if (subset === 0) {
|
|
311
|
+
throw new Error('hb_subset_or_fail returned zero');
|
|
312
|
+
}
|
|
313
|
+
subsetFont = extractSubsetFont(exports, subset);
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
// Clean up all WASM resources while we still own the instance.
|
|
317
|
+
if (subset)
|
|
318
|
+
exports.hb_face_destroy(subset);
|
|
319
|
+
exports.hb_subset_input_destroy(input);
|
|
320
|
+
exports.hb_face_destroy(face);
|
|
321
|
+
exports.free(fontBuffer);
|
|
322
|
+
}
|
|
323
|
+
// Instance is fully cleaned up — release it so other subsetting
|
|
324
|
+
// calls can proceed while we wait for the serialized WOFF2 step.
|
|
325
|
+
released = true;
|
|
326
|
+
releaseInstance(inst);
|
|
327
|
+
// Route woff2 compression to a worker thread (each spawns its own
|
|
328
|
+
// wawoff2 WASM instance). Non-woff2 formats use JS-based converters
|
|
329
|
+
// that are safe to call concurrently in the main thread.
|
|
330
|
+
return targetFormat === 'woff2'
|
|
331
|
+
? (0, fontConverter_1.convert)(subsetFont, targetFormat, 'truetype')
|
|
332
|
+
: fontverter.convert(subsetFont, targetFormat, 'truetype');
|
|
333
|
+
}
|
|
334
|
+
finally {
|
|
335
|
+
if (!released)
|
|
336
|
+
releaseInstance(inst);
|
|
295
337
|
}
|
|
296
|
-
|
|
297
|
-
// Instance is fully cleaned up — release it so other subsetting
|
|
298
|
-
// calls can proceed while we wait for the serialized WOFF2 step.
|
|
299
|
-
released = true;
|
|
300
|
-
releaseInstance(inst);
|
|
301
|
-
|
|
302
|
-
// Route woff2 compression to a worker thread (each spawns its own
|
|
303
|
-
// wawoff2 WASM instance). Non-woff2 formats use JS-based converters
|
|
304
|
-
// that are safe to call concurrently in the main thread.
|
|
305
|
-
return targetFormat === 'woff2'
|
|
306
|
-
? convertInWorker(subsetFont, targetFormat, 'truetype')
|
|
307
|
-
: fontverter.convert(subsetFont, targetFormat, 'truetype');
|
|
308
|
-
} finally {
|
|
309
|
-
if (!released) releaseInstance(inst);
|
|
310
|
-
}
|
|
311
338
|
}
|
|
312
|
-
|
|
313
339
|
// Pre-warm the WASM pool: call early to overlap compilation with other work.
|
|
314
340
|
subsetFontWithGlyphs.warmup = () => initPool();
|
|
315
|
-
|
|
316
341
|
module.exports = subsetFontWithGlyphs;
|
|
342
|
+
//# sourceMappingURL=subsetFontWithGlyphs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subsetFontWithGlyphs.js","sourceRoot":"","sources":["../src/subsetFontWithGlyphs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAA0B;AAC1B,0CAAuC;AACvC,uDAAyC;AACzC,2CAAqC;AACrC,mDAA6D;AAE7D,gGAAgG;AAChG,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AACxC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AACtC,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAC5C,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAE3C,0EAA0E;AAC1E,2EAA2E;AAC3E,yBAAyB;AACzB,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC,oBAAoB;AACpB,MAAM,0BAA0B,GAAG,UAAU,CAAC;AA+E9C,yEAAyE;AACzE,0EAA0E;AAC1E,8DAA8D;AAC9D,IAAI,eAAwD,CAAC;AAC7D,SAAS,aAAa;IACpB,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,kEAAkE;QAClE,kEAAkE;QAClE,eAAe,GAAG,IAAA,mBAAQ,EACxB,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAC7C,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,MAAM,KAAK,GAAmB,EAAE,CAAC;AACjC,IAAI,UAAqC,CAAC;AAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,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