@deepseek-ai/libreoffice-kit 0.0.2-rc9 → 0.0.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/NOTICE +0 -240
- package/README.md +53 -43
- package/README.zh.md +58 -35
- package/lib/cli.js +725 -132
- package/lib/index.js +757 -133
- package/lib/types/engine.d.ts +5 -5
- package/lib/types/font-loader.d.ts +18 -16
- package/lib/types/fonts.d.ts +38 -21
- package/lib/types/image-operations.d.ts +1 -1
- package/lib/types/index.d.ts +13 -7
- package/lib/types/native-image-renderer.d.ts +19 -0
- package/lib/types/native.d.ts +1 -1
- package/lib/types/options.d.ts +3 -1
- package/lib/types/wasm.d.ts +4 -1
- package/lib/types/worker.d.ts +2 -0
- package/lib/worker.js +420 -942
- package/package.json +13 -55
- package/assets/font-subset.json +0 -70
- package/assets/font-subset.wasm +0 -0
- package/lib/browser/assets.json +0 -10
- package/lib/browser/index.js +0 -626
- package/lib/browser/types/connection.d.ts +0 -42
- package/lib/browser/types/engine-rendering.d.ts +0 -3
- package/lib/browser/types/engine-types.d.ts +0 -17
- package/lib/browser/types/font-channel.d.ts +0 -36
- package/lib/browser/types/index.d.ts +0 -14
- package/lib/browser/types/office-engine.d.ts +0 -56
- package/lib/browser/types/office-types.d.ts +0 -166
- package/lib/browser/types/office.d.ts +0 -19
- package/lib/browser/types/preparation.d.ts +0 -13
- package/lib/browser/types/protocol.d.ts +0 -137
- package/lib/browser/types/rendering.d.ts +0 -4
- package/lib/browser/types/types.d.ts +0 -115
- package/lib/browser/types/worker.d.ts +0 -2
- package/lib/browser/worker.js +0 -3796
- package/lib/browser-assets.js +0 -119
- package/lib/document.js +0 -178
- package/lib/engine-rendering.js +0 -120
- package/lib/font-config.js +0 -46
- package/lib/font-source.js +0 -395
- package/lib/font-worker.js +0 -1481
- package/lib/rendering.js +0 -99
- package/lib/sheet-geometry.js +0 -111
- package/lib/types/browser-assets.d.ts +0 -15
- package/lib/types/default-fonts.d.ts +0 -3
- package/lib/types/font-config.d.ts +0 -24
- package/lib/types/font-preferences-data.d.ts +0 -16
- package/lib/types/font-preferences.d.ts +0 -29
- package/lib/types/font-request.d.ts +0 -12
- package/lib/types/font-source-types.d.ts +0 -95
- package/lib/types/font-source.d.ts +0 -10
- package/lib/types/font-subsets.d.ts +0 -39
- package/lib/types/font-worker.d.ts +0 -2
- package/lib/types/harfbuzz-subset.d.ts +0 -11
- package/lib/types/unicode-scripts.d.ts +0 -18
- package/licenses/font-subset/harfbuzz-COPYING +0 -42
- package/licenses/font-subset/harfbuzzjs-LICENSE +0 -19
- package/licenses/javascript/fflate-LICENSE +0 -21
- package/licenses/javascript/saxes-LICENSE +0 -64
- package/licenses/javascript/xmlchars-LICENSE +0 -18
- package/sources/browser/packages/browser/package.json +0 -22
- package/sources/browser/packages/browser/src/connection.ts +0 -237
- package/sources/browser/packages/browser/src/engine-rendering.ts +0 -2
- package/sources/browser/packages/browser/src/engine-types.ts +0 -14
- package/sources/browser/packages/browser/src/font-channel.ts +0 -169
- package/sources/browser/packages/browser/src/index.ts +0 -40
- package/sources/browser/packages/browser/src/office-engine.ts +0 -397
- package/sources/browser/packages/browser/src/office-types.ts +0 -128
- package/sources/browser/packages/browser/src/office.ts +0 -128
- package/sources/browser/packages/browser/src/preparation.ts +0 -41
- package/sources/browser/packages/browser/src/protocol.ts +0 -55
- package/sources/browser/packages/browser/src/rendering.ts +0 -3
- package/sources/browser/packages/browser/src/types.ts +0 -118
- package/sources/browser/packages/browser/src/worker.ts +0 -260
- package/sources/browser/packages/browser/tsconfig.json +0 -5
- package/sources/browser/packages/browser/tsdown.config.ts +0 -7
- package/sources/browser/scripts/build-browser.mjs +0 -86
- package/sources/font-subset/engine/font-subset/README.md +0 -23
- package/sources/font-subset/engine/font-subset/README.zh.md +0 -23
- package/sources/font-subset/engine/font-subset/source.json +0 -16
- package/sources/font-subset/harfbuzzjs/config-override-subset.h +0 -7
- package/sources/font-subset/harfbuzzjs/harfbuzz-subset.symbols +0 -34
- package/sources/font-subset/scripts/build-font-subset.mjs +0 -64
- package/sources/font-subset/scripts/pack-utils.mjs +0 -69
- package/sources/font-subset/scripts/platform-matrix.mjs +0 -100
- package/sources/font-subset/scripts/verify-artifacts.mjs +0 -260
package/lib/worker.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { parentPort, workerData } from "node:worker_threads";
|
|
3
3
|
import { closeSync, constants, fstatSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { basename, extname, join } from "node:path";
|
|
4
|
+
import { basename, extname, join, posix, win32 } from "node:path";
|
|
5
5
|
import { strFromU8, unzipSync, zlibSync } from "fflate";
|
|
6
6
|
import { SaxesParser } from "saxes";
|
|
7
|
+
import { homedir } from "node:os";
|
|
7
8
|
import { create } from "fontkit";
|
|
8
9
|
import { createHash } from "node:crypto";
|
|
9
10
|
//#region lib/types/errors.js
|
|
@@ -43,865 +44,9 @@ function failureCode(error) {
|
|
|
43
44
|
return typeof code === "string" && CODES.has(code) ? code : "failed";
|
|
44
45
|
}
|
|
45
46
|
//#endregion
|
|
46
|
-
//#region lib/types/font-config.js
|
|
47
|
-
/** Browser-safe family ordering and Fontconfig XML shared by both WASM adapters. */
|
|
48
|
-
/**
|
|
49
|
-
* Case- and separator-insensitive family key used to compare names across sources.
|
|
50
|
-
* @param value - Family, style, or postscript name as recorded by a document or font.
|
|
51
|
-
* @returns The normalized key.
|
|
52
|
-
*/
|
|
53
|
-
function normalize(value) {
|
|
54
|
-
return value.normalize("NFKC").toLowerCase().replaceAll(/[\s_-]/g, "");
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Order named substitutions and their generic text family without excluding unlisted fonts.
|
|
58
|
-
* @param requested - Original family names, in document order.
|
|
59
|
-
* @param groups - Ordered family groups shared with Fontconfig aliases.
|
|
60
|
-
* @param pitch - VCL pitch; one requests a monospaced fallback.
|
|
61
|
-
* @param symbols - Whether symbol alternatives precede the generic fallback.
|
|
62
|
-
* @returns distinct family names, with original requests first.
|
|
63
|
-
*/
|
|
64
|
-
function fontFamilyPriority(requested, groups, pitch = 0, symbols = false) {
|
|
65
|
-
const original = requested.map(normalize);
|
|
66
|
-
const matched = groups.filter((group) => group.some((family) => original.includes(normalize(family))));
|
|
67
|
-
const generic = original.includes("monospace") || pitch === 1 ? "monospace" : original.includes("serif") ? "serif" : matched.flat().map(normalize).find((family) => family === "serif" || family === "sansserif" || family === "monospace") ?? "sansserif";
|
|
68
|
-
const families = [...requested, ...matched.flat()];
|
|
69
|
-
for (const kind of symbols ? ["symbol", generic] : [generic]) for (const group of groups) if (group.some((family) => normalize(family) === kind)) families.push(...group);
|
|
70
|
-
const priority = /* @__PURE__ */ new Map();
|
|
71
|
-
for (const family of families) {
|
|
72
|
-
const name = normalize(family);
|
|
73
|
-
if (!priority.has(name)) priority.set(name, family);
|
|
74
|
-
}
|
|
75
|
-
return [...priority.values()];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Fontconfig XML restricts WASM discovery to imported originals in MEMFS.
|
|
79
|
-
* @param families - Ordered family groups; the first name of each group is its canonical spelling.
|
|
80
|
-
* @param requested - Additional family names the document declared.
|
|
81
|
-
* @returns the fontconfig document written into the module's memory filesystem.
|
|
82
|
-
*/
|
|
83
|
-
function memoryFontConfig(families, requested = []) {
|
|
84
|
-
const escape = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
85
|
-
return `<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"><fontconfig><dir>/dsh-fonts</dir><cachedir>/dsh/font-cache</cachedir>${[...new Map([...families.flatMap((group) => group.slice(0, 1)), ...requested].map((name) => [normalize(name), name])).values()].map((name) => {
|
|
86
|
-
const alternatives = fontFamilyPriority([name], families).filter((family) => normalize(family) !== normalize(name));
|
|
87
|
-
return `<alias><family>${escape(name)}</family><accept>${alternatives.map((family) => `<family>${escape(family)}</family>`).join("")}</accept></alias>`;
|
|
88
|
-
}).join("")}</fontconfig>`;
|
|
89
|
-
}
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region lib/types/ooxml.js
|
|
92
|
-
/** Bounded OOXML inspection and declared font diagnostics, using maintained ZIP/XML parsers. */
|
|
93
|
-
const MAIN_PARTS = {
|
|
94
|
-
odt: ["content.xml", "application/vnd.oasis.opendocument.text"],
|
|
95
|
-
ods: ["content.xml", "application/vnd.oasis.opendocument.spreadsheet"],
|
|
96
|
-
odp: ["content.xml", "application/vnd.oasis.opendocument.presentation"],
|
|
97
|
-
docx: ["word/document.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"],
|
|
98
|
-
xlsx: ["xl/workbook.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"],
|
|
99
|
-
pptx: ["ppt/presentation.xml", "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"]
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* @param character - One code point as yielded by iteration over a string.
|
|
103
|
-
* @returns the Unicode scalar the character encodes; iteration never yields an empty string.
|
|
104
|
-
*/
|
|
105
|
-
function codePointOf(character) {
|
|
106
|
-
return character.codePointAt(0);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Validate ZIP size and membership before decoding selected document XML.
|
|
110
|
-
* @param bytes - Complete source document bytes.
|
|
111
|
-
* @param extension - Input extension, which selects the main document part.
|
|
112
|
-
* @param limits - Archive entry and declared uncompressed byte limits.
|
|
113
|
-
* @returns declared font families and the scalar values readable document XML declares.
|
|
114
|
-
* @throws ConversionError when the extension is unsupported or the archive violates its limits.
|
|
115
|
-
*/
|
|
116
|
-
function inspectDocument$1(bytes, extension, limits) {
|
|
117
|
-
const main = MAIN_PARTS[extension];
|
|
118
|
-
if (!main) throw new ConversionError("unsupported-format", "Input extension must be docx, xlsx, or pptx.");
|
|
119
|
-
const odf = [
|
|
120
|
-
"odt",
|
|
121
|
-
"ods",
|
|
122
|
-
"odp"
|
|
123
|
-
].includes(extension);
|
|
124
|
-
const names = /* @__PURE__ */ new Set();
|
|
125
|
-
let total = 0;
|
|
126
|
-
let files;
|
|
127
|
-
try {
|
|
128
|
-
files = unzipSync(bytes, { filter(entry) {
|
|
129
|
-
total += entry.originalSize;
|
|
130
|
-
if (names.has(entry.name) || names.size >= limits.maxArchiveEntries || !Number.isSafeInteger(total) || total > limits.maxUncompressedBytes) throw new Error("OOXML archive exceeds its limits or repeats an entry.");
|
|
131
|
-
names.add(entry.name);
|
|
132
|
-
if (odf) return [
|
|
133
|
-
"mimetype",
|
|
134
|
-
"content.xml",
|
|
135
|
-
"styles.xml",
|
|
136
|
-
"META-INF/manifest.xml"
|
|
137
|
-
].includes(entry.name);
|
|
138
|
-
return entry.name === "[Content_Types].xml" || /^(word|xl|ppt)\/.*\.xml$/.test(entry.name) && !entry.name.endsWith("/fontTable.xml") && !entry.name.includes("/theme/");
|
|
139
|
-
} });
|
|
140
|
-
} catch (cause) {
|
|
141
|
-
throw new ConversionError("invalid-document", "Input is not a supported, bounded OOXML archive.", { cause });
|
|
142
|
-
}
|
|
143
|
-
const contentTypes = files["[Content_Types].xml"];
|
|
144
|
-
if (odf ? !names.has("content.xml") || !names.has("META-INF/manifest.xml") || strFromU8(files.mimetype ?? /* @__PURE__ */ new Uint8Array()) !== main[1] : !names.has("_rels/.rels") || !names.has(main[0]) || contentTypes === void 0 || !strFromU8(contentTypes).includes(main[1])) throw new ConversionError("invalid-document", `Input does not contain a ${extension} document.`);
|
|
145
|
-
const families = /* @__PURE__ */ new Map();
|
|
146
|
-
const codePoints = /* @__PURE__ */ new Set();
|
|
147
|
-
for (const [name, data] of Object.entries(files)) {
|
|
148
|
-
if (name === "[Content_Types].xml" || name === "mimetype" || name === "META-INF/manifest.xml") continue;
|
|
149
|
-
const partFamilies = [];
|
|
150
|
-
const partPoints = /* @__PURE__ */ new Set();
|
|
151
|
-
const parser = new SaxesParser({ xmlns: true });
|
|
152
|
-
parser.on("opentag", (tag) => {
|
|
153
|
-
const word = /wordprocessingml\/(?:2006\/)?main$/.test(tag.uri) && tag.local === "rFonts";
|
|
154
|
-
const drawing = /drawingml\/(?:2006\/)?main$/.test(tag.uri);
|
|
155
|
-
const sheet = /spreadsheetml\/(?:2006\/)?main$/.test(tag.uri) && tag.local === "name";
|
|
156
|
-
for (const attribute of Object.values(tag.attributes)) {
|
|
157
|
-
if (odf && attribute.local === "font-family") partFamilies.push(attribute.value.replace(/^['"]|['"]$/g, ""));
|
|
158
|
-
if (word && [
|
|
159
|
-
"ascii",
|
|
160
|
-
"hAnsi",
|
|
161
|
-
"eastAsia",
|
|
162
|
-
"cs"
|
|
163
|
-
].includes(attribute.local) || drawing && attribute.local === "typeface" || sheet && attribute.local === "val") partFamilies.push(attribute.value);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
parser.on("text", (text) => {
|
|
167
|
-
for (const char of text) if (!/\s/u.test(char)) partPoints.add(codePointOf(char));
|
|
168
|
-
});
|
|
169
|
-
const encoding = data[0] === 255 && data[1] === 254 ? "utf-16le" : data[0] === 254 && data[1] === 255 ? "utf-16be" : "utf-8";
|
|
170
|
-
try {
|
|
171
|
-
parser.write(new TextDecoder(encoding).decode(data)).close();
|
|
172
|
-
} catch {
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
for (const declared of partFamilies) for (const family of declared.split(";").map((value) => value.trim()).filter((value) => value && !/^\+(?:mj|mn)-(?:lt|ea|cs)$/.test(value))) families.set(normalize(family), family);
|
|
176
|
-
for (const point of partPoints) codePoints.add(point);
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
families,
|
|
180
|
-
codePoints: [...codePoints]
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region lib/types/document.js
|
|
185
|
-
/** Select bounded OOXML inspection or a legacy Office compound-file import. */
|
|
186
|
-
/** Input suffixes accepted by the public converter. */
|
|
187
|
-
const DOCUMENT_EXTENSIONS = [
|
|
188
|
-
"doc",
|
|
189
|
-
"docx",
|
|
190
|
-
"odt",
|
|
191
|
-
"xls",
|
|
192
|
-
"xlsx",
|
|
193
|
-
"ods",
|
|
194
|
-
"ppt",
|
|
195
|
-
"pptx",
|
|
196
|
-
"odp"
|
|
197
|
-
];
|
|
198
|
-
const COMPOUND_SIGNATURE = [
|
|
199
|
-
208,
|
|
200
|
-
207,
|
|
201
|
-
17,
|
|
202
|
-
224,
|
|
203
|
-
161,
|
|
204
|
-
177,
|
|
205
|
-
26,
|
|
206
|
-
225
|
|
207
|
-
];
|
|
208
|
-
/**
|
|
209
|
-
* Inspect the input container before invoking LibreOffice's document importer.
|
|
210
|
-
* Compound-file streams and legacy font tables are interpreted by LibreOffice;
|
|
211
|
-
* they do not supply the API's OOXML font diagnostics.
|
|
212
|
-
* @param bytes - Source bytes already bounded by maxInputBytes.
|
|
213
|
-
* @param extension - Lowercase source suffix.
|
|
214
|
-
* @param limits - Limits applied to ZIP-based document contents.
|
|
215
|
-
* @returns OOXML font metadata, or empty diagnostics for a binary document.
|
|
216
|
-
*/
|
|
217
|
-
function inspectDocument(bytes, extension, limits) {
|
|
218
|
-
if (!DOCUMENT_EXTENSIONS.includes(extension)) throw new ConversionError("unsupported-format", `Input extension must be ${DOCUMENT_EXTENSIONS.join(", ")}.`);
|
|
219
|
-
if ([
|
|
220
|
-
"docx",
|
|
221
|
-
"xlsx",
|
|
222
|
-
"pptx",
|
|
223
|
-
"odt",
|
|
224
|
-
"ods",
|
|
225
|
-
"odp"
|
|
226
|
-
].includes(extension)) return inspectDocument$1(bytes, extension, limits);
|
|
227
|
-
if (bytes.length < 512 || !COMPOUND_SIGNATURE.every((value, index) => bytes[index] === value)) throw new ConversionError("invalid-document", "Legacy Office input must contain an OLE compound document.");
|
|
228
|
-
const header = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
229
|
-
const version = header.getUint16(26, true);
|
|
230
|
-
const sectorShift = header.getUint16(30, true);
|
|
231
|
-
if (header.getUint16(28, true) !== 65534 || header.getUint16(32, true) !== 6 || !(version === 3 && sectorShift === 9 || version === 4 && sectorShift === 12) || bytes.length < 2 ** sectorShift * 2 || bytes.length % 2 ** sectorShift !== 0) throw new ConversionError("invalid-document", "Legacy Office input has an invalid or truncated compound-file header.");
|
|
232
|
-
return {
|
|
233
|
-
families: /* @__PURE__ */ new Map(),
|
|
234
|
-
codePoints: []
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
//#endregion
|
|
238
|
-
//#region lib/types/default-fonts.js
|
|
239
|
-
/** Named compatibility aliases and generic defaults shared by font consumers. */
|
|
240
|
-
const SANS_CJK_FAMILIES = [
|
|
241
|
-
"Microsoft YaHei",
|
|
242
|
-
"Microsoft YaHei UI",
|
|
243
|
-
"微软雅黑",
|
|
244
|
-
"PingFang SC",
|
|
245
|
-
"Noto Sans CJK SC",
|
|
246
|
-
"Noto Sans SC",
|
|
247
|
-
"Source Han Sans SC",
|
|
248
|
-
"SimHei",
|
|
249
|
-
"黑体",
|
|
250
|
-
"Heiti SC",
|
|
251
|
-
"STHeiti"
|
|
252
|
-
];
|
|
253
|
-
const SANS_KOREAN_FAMILIES = [
|
|
254
|
-
"Malgun Gothic",
|
|
255
|
-
"맑은 고딕",
|
|
256
|
-
"Apple SD Gothic Neo",
|
|
257
|
-
"Noto Sans CJK KR",
|
|
258
|
-
"Noto Sans KR",
|
|
259
|
-
"Source Han Sans K",
|
|
260
|
-
"NanumGothic",
|
|
261
|
-
"AppleGothic",
|
|
262
|
-
"Dotum",
|
|
263
|
-
"돋움"
|
|
264
|
-
];
|
|
265
|
-
const SERIF_KOREAN_FAMILIES = [
|
|
266
|
-
"Batang",
|
|
267
|
-
"바탕",
|
|
268
|
-
"AppleMyungjo",
|
|
269
|
-
"Noto Serif CJK KR",
|
|
270
|
-
"Noto Serif KR",
|
|
271
|
-
"Source Han Serif K",
|
|
272
|
-
"NanumMyeongjo"
|
|
273
|
-
];
|
|
274
|
-
/** Ordered family groups used when the caller supplies none. */
|
|
275
|
-
const DEFAULT_FONT_FALLBACKS = [
|
|
276
|
-
["Calibri", "Carlito"],
|
|
277
|
-
[
|
|
278
|
-
"Calibri Light",
|
|
279
|
-
"Carlito",
|
|
280
|
-
"Calibri"
|
|
281
|
-
],
|
|
282
|
-
["Cambria", "Caladea"],
|
|
283
|
-
[
|
|
284
|
-
"宋体",
|
|
285
|
-
"SimSun",
|
|
286
|
-
"NSimSun",
|
|
287
|
-
"Songti SC",
|
|
288
|
-
"STSong",
|
|
289
|
-
"Noto Serif CJK SC",
|
|
290
|
-
"Noto Serif SC",
|
|
291
|
-
"Source Han Serif SC"
|
|
292
|
-
],
|
|
293
|
-
[
|
|
294
|
-
"黑体",
|
|
295
|
-
"SimHei",
|
|
296
|
-
"Heiti SC",
|
|
297
|
-
"STHeiti",
|
|
298
|
-
"Noto Sans CJK SC",
|
|
299
|
-
"Noto Sans SC",
|
|
300
|
-
"Source Han Sans SC"
|
|
301
|
-
],
|
|
302
|
-
[
|
|
303
|
-
"微软雅黑",
|
|
304
|
-
"Microsoft YaHei",
|
|
305
|
-
"Microsoft YaHei UI",
|
|
306
|
-
"PingFang SC",
|
|
307
|
-
"Noto Sans CJK SC",
|
|
308
|
-
"Noto Sans SC"
|
|
309
|
-
],
|
|
310
|
-
[
|
|
311
|
-
"楷体",
|
|
312
|
-
"KaiTi",
|
|
313
|
-
"Kaiti SC",
|
|
314
|
-
"STKaiti",
|
|
315
|
-
"LXGW WenKai"
|
|
316
|
-
],
|
|
317
|
-
[
|
|
318
|
-
"仿宋",
|
|
319
|
-
"FangSong",
|
|
320
|
-
"STFangsong",
|
|
321
|
-
"Songti SC",
|
|
322
|
-
"Noto Serif CJK SC"
|
|
323
|
-
],
|
|
324
|
-
[
|
|
325
|
-
"sans-serif",
|
|
326
|
-
"Arial",
|
|
327
|
-
"Liberation Sans",
|
|
328
|
-
"Helvetica",
|
|
329
|
-
"DejaVu Sans",
|
|
330
|
-
"Calibri",
|
|
331
|
-
"Calibri Light",
|
|
332
|
-
"Carlito",
|
|
333
|
-
...SANS_CJK_FAMILIES,
|
|
334
|
-
...SANS_KOREAN_FAMILIES
|
|
335
|
-
],
|
|
336
|
-
[
|
|
337
|
-
"serif",
|
|
338
|
-
"Times New Roman",
|
|
339
|
-
"Liberation Serif",
|
|
340
|
-
"Times",
|
|
341
|
-
"DejaVu Serif",
|
|
342
|
-
"Cambria",
|
|
343
|
-
"Caladea",
|
|
344
|
-
"SimSun",
|
|
345
|
-
"NSimSun",
|
|
346
|
-
"宋体",
|
|
347
|
-
"Songti SC",
|
|
348
|
-
"STSong",
|
|
349
|
-
"Noto Serif CJK SC",
|
|
350
|
-
"Noto Serif SC",
|
|
351
|
-
"Source Han Serif SC",
|
|
352
|
-
...SERIF_KOREAN_FAMILIES
|
|
353
|
-
],
|
|
354
|
-
[
|
|
355
|
-
"monospace",
|
|
356
|
-
"Courier New",
|
|
357
|
-
"Liberation Mono",
|
|
358
|
-
"DejaVu Sans Mono",
|
|
359
|
-
"Menlo",
|
|
360
|
-
"Monaco",
|
|
361
|
-
"Courier",
|
|
362
|
-
"NSimSun",
|
|
363
|
-
"Noto Sans Mono CJK SC",
|
|
364
|
-
"Noto Sans Mono CJK KR",
|
|
365
|
-
...SANS_CJK_FAMILIES,
|
|
366
|
-
...SANS_KOREAN_FAMILIES
|
|
367
|
-
],
|
|
368
|
-
[
|
|
369
|
-
"Symbol",
|
|
370
|
-
"Standard Symbols PS",
|
|
371
|
-
"Symbola",
|
|
372
|
-
"Segoe UI Symbol",
|
|
373
|
-
"Apple Symbols",
|
|
374
|
-
"FreeSerif",
|
|
375
|
-
"DejaVu Sans"
|
|
376
|
-
]
|
|
377
|
-
];
|
|
378
|
-
//#endregion
|
|
379
|
-
//#region lib/types/font-preferences-data.js
|
|
380
|
-
/** Generated by scripts/generate-font-preferences.mjs; do not edit.
|
|
381
|
-
+ * Chromium: https://raw.githubusercontent.com/chromium/chromium/ffaf825e8c2e27fccc089b425f9f114d275804ae/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc
|
|
382
|
-
+ * Fontconfig: https://raw.githubusercontent.com/fontconfig/fontconfig/84ae86bc21c94d4aedbc02e32c9dc18b8750193c/conf.d/65-nonlatin.conf
|
|
383
|
-
+ * Unicode: @unicode/unicode-17.0.0 2.0.7. Licenses: packages/entry/NOTICE.
|
|
384
|
-
+ */
|
|
385
|
-
/** Pinned windows fonts. */
|
|
386
|
-
const WINDOWS_FONTS = {
|
|
387
|
-
"arabic": ["Tahoma", "Segoe UI"],
|
|
388
|
-
"armenian": ["Segoe UI", "Sylfaen"],
|
|
389
|
-
"bengali": ["Nirmala UI", "Vrinda"],
|
|
390
|
-
"brahmi": ["Segoe UI Historic"],
|
|
391
|
-
"braille": ["Segoe UI Symbol"],
|
|
392
|
-
"buginese": ["Leelawadee UI"],
|
|
393
|
-
"canadian_aboriginal": ["Gadugi", "Euphemia"],
|
|
394
|
-
"carian": ["Segoe UI Historic"],
|
|
395
|
-
"cherokee": ["Gadugi", "Plantagenet"],
|
|
396
|
-
"coptic": ["Segoe UI Symbol"],
|
|
397
|
-
"cuneiform": ["Segoe UI Historic"],
|
|
398
|
-
"cypriot": ["Segoe UI Historic"],
|
|
399
|
-
"cyrillic": ["Times New Roman"],
|
|
400
|
-
"deseret": ["Segoe UI Symbol"],
|
|
401
|
-
"devanagari": ["Nirmala UI", "Mangal"],
|
|
402
|
-
"egyptian_hieroglyphs": ["Segoe UI Historic"],
|
|
403
|
-
"ethiopic": [
|
|
404
|
-
"Nyala",
|
|
405
|
-
"Abyssinica SIL",
|
|
406
|
-
"Ethiopia Jiret",
|
|
407
|
-
"Visual Geez Unicode",
|
|
408
|
-
"GF Zemen Unicode",
|
|
409
|
-
"Ebrima"
|
|
410
|
-
],
|
|
411
|
-
"georgian": ["Sylfaen", "Segoe UI"],
|
|
412
|
-
"glagolitic": ["Segoe UI Historic", "Segoe UI Symbol"],
|
|
413
|
-
"gothic": ["Segoe UI Historic", "Segoe UI Symbol"],
|
|
414
|
-
"greek": ["Times New Roman"],
|
|
415
|
-
"gujarati": ["Nirmala UI", "Shruti"],
|
|
416
|
-
"gurmukhi": ["Nirmala UI", "Raavi"],
|
|
417
|
-
"hangul": [
|
|
418
|
-
"Noto Sans KR",
|
|
419
|
-
"Noto Sans CJK KR",
|
|
420
|
-
"Malgun Gothic",
|
|
421
|
-
"Gulim"
|
|
422
|
-
],
|
|
423
|
-
"hebrew": ["David", "Segoe UI"],
|
|
424
|
-
"hiragana": [
|
|
425
|
-
"Noto Sans JP",
|
|
426
|
-
"Noto Sans CJK JP",
|
|
427
|
-
"Meiryo",
|
|
428
|
-
"Yu Gothic",
|
|
429
|
-
"MS PGothic",
|
|
430
|
-
"Microsoft YaHei"
|
|
431
|
-
],
|
|
432
|
-
"imperial_aramaic": ["Segoe UI Historic"],
|
|
433
|
-
"inscriptional_pahlavi": ["Segoe UI Historic"],
|
|
434
|
-
"inscriptional_parthian": ["Segoe UI Historic"],
|
|
435
|
-
"javanese": ["Javanese Text"],
|
|
436
|
-
"kannada": ["Tunga", "Nirmala UI"],
|
|
437
|
-
"katakana": [
|
|
438
|
-
"Noto Sans JP",
|
|
439
|
-
"Noto Sans CJK JP",
|
|
440
|
-
"Meiryo",
|
|
441
|
-
"Yu Gothic",
|
|
442
|
-
"MS PGothic",
|
|
443
|
-
"Microsoft YaHei"
|
|
444
|
-
],
|
|
445
|
-
"katakana_or_hiragana": [
|
|
446
|
-
"Noto Sans JP",
|
|
447
|
-
"Noto Sans CJK JP",
|
|
448
|
-
"Meiryo",
|
|
449
|
-
"Yu Gothic",
|
|
450
|
-
"MS PGothic",
|
|
451
|
-
"Microsoft YaHei"
|
|
452
|
-
],
|
|
453
|
-
"kharoshthi": ["Segoe UI Historic"],
|
|
454
|
-
"khmer": [
|
|
455
|
-
"Leelawadee UI",
|
|
456
|
-
"Khmer UI",
|
|
457
|
-
"Khmer OS",
|
|
458
|
-
"MoolBoran",
|
|
459
|
-
"DaunPenh"
|
|
460
|
-
],
|
|
461
|
-
"lao": [
|
|
462
|
-
"Leelawadee UI",
|
|
463
|
-
"Lao UI",
|
|
464
|
-
"DokChampa",
|
|
465
|
-
"Saysettha OT",
|
|
466
|
-
"Phetsarath OT",
|
|
467
|
-
"Code2000"
|
|
468
|
-
],
|
|
469
|
-
"latin": ["Times New Roman"],
|
|
470
|
-
"lisu": ["Segoe UI"],
|
|
471
|
-
"lycian": ["Segoe UI Historic"],
|
|
472
|
-
"lydian": ["Segoe UI Historic"],
|
|
473
|
-
"malayalam": ["Nirmala UI", "Kartika"],
|
|
474
|
-
"meitei_mayek": ["Nirmala UI"],
|
|
475
|
-
"meroitic_cursive": ["Segoe UI Historic", "Segoe UI Symbol"],
|
|
476
|
-
"mongolian": ["Mongolian Baiti"],
|
|
477
|
-
"myanmar": [
|
|
478
|
-
"Myanmar Text",
|
|
479
|
-
"Padauk",
|
|
480
|
-
"Parabaik",
|
|
481
|
-
"Myanmar3",
|
|
482
|
-
"Code2000"
|
|
483
|
-
],
|
|
484
|
-
"new_tai_lue": ["Microsoft New Tai Lue"],
|
|
485
|
-
"nko": ["Ebrima"],
|
|
486
|
-
"ogham": ["Segoe UI Historic", "Segoe UI Symbol"],
|
|
487
|
-
"ol_chiki": ["Nirmala UI"],
|
|
488
|
-
"old_italic": ["Segoe UI Historic", "Segoe UI Symbol"],
|
|
489
|
-
"old_persian": ["Segoe UI Historic"],
|
|
490
|
-
"old_south_arabian": ["Segoe UI Historic"],
|
|
491
|
-
"oriya": [
|
|
492
|
-
"Kalinga",
|
|
493
|
-
"ori1Uni",
|
|
494
|
-
"Lohit Oriya",
|
|
495
|
-
"Nirmala UI"
|
|
496
|
-
],
|
|
497
|
-
"orkhon": ["Segoe UI Historic", "Segoe UI Symbol"],
|
|
498
|
-
"osmanya": ["Ebrima"],
|
|
499
|
-
"phags_pa": ["Microsoft PhagsPa"],
|
|
500
|
-
"runic": ["Segoe UI Historic", "Segoe UI Symbol"],
|
|
501
|
-
"shavian": ["Segoe UI Historic"],
|
|
502
|
-
"simplified_han": [
|
|
503
|
-
"Noto Sans SC",
|
|
504
|
-
"Noto Sans CJK SC",
|
|
505
|
-
"Microsoft YaHei",
|
|
506
|
-
"simsun"
|
|
507
|
-
],
|
|
508
|
-
"sinhala": [
|
|
509
|
-
"Iskoola Pota",
|
|
510
|
-
"AksharUnicode",
|
|
511
|
-
"Nirmala UI"
|
|
512
|
-
],
|
|
513
|
-
"sora_sompeng": ["Nirmala UI"],
|
|
514
|
-
"symbols": ["Segoe UI Symbol"],
|
|
515
|
-
"syriac": [
|
|
516
|
-
"Estrangelo Edessa",
|
|
517
|
-
"Estrangelo Nisibin",
|
|
518
|
-
"Code2000"
|
|
519
|
-
],
|
|
520
|
-
"tai_le": ["Microsoft Tai Le"],
|
|
521
|
-
"tamil": ["Nirmala UI", "Latha"],
|
|
522
|
-
"telugu": ["Nirmala UI", "Gautami"],
|
|
523
|
-
"thaana": ["MV Boli"],
|
|
524
|
-
"thai": [
|
|
525
|
-
"Tahoma",
|
|
526
|
-
"Leelawadee UI",
|
|
527
|
-
"Leelawadee"
|
|
528
|
-
],
|
|
529
|
-
"tibetan": [
|
|
530
|
-
"Microsoft Himalaya",
|
|
531
|
-
"Jomolhari",
|
|
532
|
-
"Tibetan Machine Uni"
|
|
533
|
-
],
|
|
534
|
-
"tifinagh": ["Ebrima"],
|
|
535
|
-
"traditional_han": [
|
|
536
|
-
"Noto Sans TC",
|
|
537
|
-
"Noto Sans CJK TC",
|
|
538
|
-
"Microsoft JhengHei",
|
|
539
|
-
"pmingli"
|
|
540
|
-
],
|
|
541
|
-
"bopomofo": [
|
|
542
|
-
"Noto Sans TC",
|
|
543
|
-
"Noto Sans CJK TC",
|
|
544
|
-
"Microsoft JhengHei",
|
|
545
|
-
"pmingli"
|
|
546
|
-
],
|
|
547
|
-
"vai": ["Ebrima"],
|
|
548
|
-
"yi": [
|
|
549
|
-
"Microsoft Yi Baiti",
|
|
550
|
-
"Nuosu SIL",
|
|
551
|
-
"Code2000"
|
|
552
|
-
]
|
|
553
|
-
};
|
|
554
|
-
/** Pinned fontconfig fonts. */
|
|
555
|
-
const FONTCONFIG_FONTS = {
|
|
556
|
-
"serif": [
|
|
557
|
-
"Artsounk",
|
|
558
|
-
"BPG UTF8 M",
|
|
559
|
-
"Kinnari",
|
|
560
|
-
"Norasi",
|
|
561
|
-
"Frank Ruehl",
|
|
562
|
-
"Dror",
|
|
563
|
-
"JG LaoTimes",
|
|
564
|
-
"Saysettha Unicode",
|
|
565
|
-
"Pigiarniq",
|
|
566
|
-
"B Davat",
|
|
567
|
-
"B Compset",
|
|
568
|
-
"Kacst-Qr",
|
|
569
|
-
"Urdu Nastaliq Unicode",
|
|
570
|
-
"Raghindi",
|
|
571
|
-
"Mukti Narrow",
|
|
572
|
-
"malayalam",
|
|
573
|
-
"Sampige",
|
|
574
|
-
"padmaa",
|
|
575
|
-
"Hapax Berbère",
|
|
576
|
-
"MS Mincho",
|
|
577
|
-
"SimSun",
|
|
578
|
-
"PMingLiu",
|
|
579
|
-
"WenQuanYi Zen Hei",
|
|
580
|
-
"WenQuanYi Bitmap Song",
|
|
581
|
-
"AR PL ShanHeiSun Uni",
|
|
582
|
-
"AR PL New Sung",
|
|
583
|
-
"ZYSong18030",
|
|
584
|
-
"HanyiSong",
|
|
585
|
-
"Hiragino Mincho ProN",
|
|
586
|
-
"Songti SC",
|
|
587
|
-
"Songti TC",
|
|
588
|
-
"SimSong",
|
|
589
|
-
"MgOpen Canonica",
|
|
590
|
-
"Sazanami Mincho",
|
|
591
|
-
"IPAMonaMincho",
|
|
592
|
-
"IPAMincho",
|
|
593
|
-
"Kochi Mincho",
|
|
594
|
-
"AR PL SungtiL GB",
|
|
595
|
-
"AR PL Mingti2L Big5",
|
|
596
|
-
"AR PL Zenkai Uni",
|
|
597
|
-
"MS 明朝",
|
|
598
|
-
"ZYSong18030",
|
|
599
|
-
"Noto Serif CJK KR",
|
|
600
|
-
"NanumMyeongjo",
|
|
601
|
-
"AppleMyungjo",
|
|
602
|
-
"KacstQura",
|
|
603
|
-
"Frank Ruehl CLM",
|
|
604
|
-
"Lohit Bengali",
|
|
605
|
-
"Lohit Gujarati",
|
|
606
|
-
"Lohit Hindi",
|
|
607
|
-
"Lohit Marathi",
|
|
608
|
-
"Lohit Maithili",
|
|
609
|
-
"Lohit Kashmiri",
|
|
610
|
-
"Lohit Konkani",
|
|
611
|
-
"Lohit Nepali",
|
|
612
|
-
"Lohit Sindhi",
|
|
613
|
-
"Lohit Punjabi",
|
|
614
|
-
"Lohit Tamil",
|
|
615
|
-
"Rachana",
|
|
616
|
-
"Lohit Malayalam",
|
|
617
|
-
"Lohit Kannada",
|
|
618
|
-
"Lohit Telugu",
|
|
619
|
-
"Lohit Odia",
|
|
620
|
-
"LKLUG"
|
|
621
|
-
],
|
|
622
|
-
"sans-serif": [
|
|
623
|
-
"Nachlieli",
|
|
624
|
-
"Lucida Sans Unicode",
|
|
625
|
-
"Yudit Unicode",
|
|
626
|
-
"Kerkis",
|
|
627
|
-
"ArmNet Helvetica",
|
|
628
|
-
"Artsounk",
|
|
629
|
-
"BPG UTF8 M",
|
|
630
|
-
"Waree",
|
|
631
|
-
"Loma",
|
|
632
|
-
"Garuda",
|
|
633
|
-
"Umpush",
|
|
634
|
-
"Saysettha Unicode",
|
|
635
|
-
"JG Lao Old Arial",
|
|
636
|
-
"GF Zemen Unicode",
|
|
637
|
-
"Pigiarniq",
|
|
638
|
-
"B Davat",
|
|
639
|
-
"B Compset",
|
|
640
|
-
"Kacst-Qr",
|
|
641
|
-
"Urdu Nastaliq Unicode",
|
|
642
|
-
"Raghindi",
|
|
643
|
-
"Mukti Narrow",
|
|
644
|
-
"malayalam",
|
|
645
|
-
"Sampige",
|
|
646
|
-
"padmaa",
|
|
647
|
-
"Hapax Berbère",
|
|
648
|
-
"MS Gothic",
|
|
649
|
-
"UmePlus P Gothic",
|
|
650
|
-
"Microsoft YaHei",
|
|
651
|
-
"Microsoft JhengHei",
|
|
652
|
-
"WenQuanYi Zen Hei",
|
|
653
|
-
"WenQuanYi Bitmap Song",
|
|
654
|
-
"AR PL ShanHeiSun Uni",
|
|
655
|
-
"AR PL New Sung",
|
|
656
|
-
"Hiragino Sans",
|
|
657
|
-
"PingFang SC",
|
|
658
|
-
"PingFang TC",
|
|
659
|
-
"PingFang HK",
|
|
660
|
-
"Hiragino Sans CNS",
|
|
661
|
-
"Hiragino Sans GB",
|
|
662
|
-
"MgOpen Modata",
|
|
663
|
-
"VL Gothic",
|
|
664
|
-
"IPAMonaGothic",
|
|
665
|
-
"IPAGothic",
|
|
666
|
-
"Sazanami Gothic",
|
|
667
|
-
"Kochi Gothic",
|
|
668
|
-
"AR PL KaitiM GB",
|
|
669
|
-
"AR PL KaitiM Big5",
|
|
670
|
-
"AR PL ShanHeiSun Uni",
|
|
671
|
-
"AR PL SungtiL GB",
|
|
672
|
-
"AR PL Mingti2L Big5",
|
|
673
|
-
"MS ゴシック",
|
|
674
|
-
"ZYSong18030",
|
|
675
|
-
"TSCu_Paranar",
|
|
676
|
-
"Noto Sans CJK KR",
|
|
677
|
-
"NanumGothic",
|
|
678
|
-
"Apple SD Gothic Neo",
|
|
679
|
-
"KacstQura",
|
|
680
|
-
"Lohit Bengali",
|
|
681
|
-
"Lohit Gujarati",
|
|
682
|
-
"Lohit Hindi",
|
|
683
|
-
"Lohit Marathi",
|
|
684
|
-
"Lohit Maithili",
|
|
685
|
-
"Lohit Kashmiri",
|
|
686
|
-
"Lohit Konkani",
|
|
687
|
-
"Lohit Nepali",
|
|
688
|
-
"Lohit Sindhi",
|
|
689
|
-
"Lohit Punjabi",
|
|
690
|
-
"Lohit Tamil",
|
|
691
|
-
"Meera",
|
|
692
|
-
"Lohit Malayalam",
|
|
693
|
-
"Lohit Kannada",
|
|
694
|
-
"Lohit Telugu",
|
|
695
|
-
"Lohit Odia",
|
|
696
|
-
"LKLUG"
|
|
697
|
-
],
|
|
698
|
-
"monospace": [
|
|
699
|
-
"Miriam Mono",
|
|
700
|
-
"VL Gothic",
|
|
701
|
-
"IPAMonaGothic",
|
|
702
|
-
"IPAGothic",
|
|
703
|
-
"Sazanami Gothic",
|
|
704
|
-
"Kochi Gothic",
|
|
705
|
-
"AR PL KaitiM GB",
|
|
706
|
-
"MS Gothic",
|
|
707
|
-
"UmePlus Gothic",
|
|
708
|
-
"NSimSun",
|
|
709
|
-
"MingLiu",
|
|
710
|
-
"AR PL ShanHeiSun Uni",
|
|
711
|
-
"AR PL New Sung Mono",
|
|
712
|
-
"HanyiSong",
|
|
713
|
-
"AR PL SungtiL GB",
|
|
714
|
-
"AR PL Mingti2L Big5",
|
|
715
|
-
"ZYSong18030",
|
|
716
|
-
"Noto Sans Mono CJK KR",
|
|
717
|
-
"NanumGothicCoding",
|
|
718
|
-
"NanumGothic",
|
|
719
|
-
"TlwgTypo",
|
|
720
|
-
"TlwgTypist",
|
|
721
|
-
"TlwgTypewriter",
|
|
722
|
-
"TlwgMono",
|
|
723
|
-
"Hasida",
|
|
724
|
-
"GF Zemen Unicode",
|
|
725
|
-
"Hapax Berbère",
|
|
726
|
-
"Lohit Bengali",
|
|
727
|
-
"Lohit Gujarati",
|
|
728
|
-
"Lohit Hindi",
|
|
729
|
-
"Lohit Marathi",
|
|
730
|
-
"Lohit Maithili",
|
|
731
|
-
"Lohit Kashmiri",
|
|
732
|
-
"Lohit Konkani",
|
|
733
|
-
"Lohit Nepali",
|
|
734
|
-
"Lohit Sindhi",
|
|
735
|
-
"Lohit Punjabi",
|
|
736
|
-
"Lohit Tamil",
|
|
737
|
-
"Meera",
|
|
738
|
-
"Lohit Malayalam",
|
|
739
|
-
"Lohit Kannada",
|
|
740
|
-
"Lohit Telugu",
|
|
741
|
-
"Lohit Odia",
|
|
742
|
-
"LKLUG"
|
|
743
|
-
],
|
|
744
|
-
"system-ui": [
|
|
745
|
-
"Noto Sans Arabic UI",
|
|
746
|
-
"Noto Sans Bengali UI",
|
|
747
|
-
"Noto Sans Devanagari UI",
|
|
748
|
-
"Noto Sans Gujarati UI",
|
|
749
|
-
"Noto Sans Gurmukhi UI",
|
|
750
|
-
"Noto Sans Kannada UI",
|
|
751
|
-
"Noto Sans Khmer UI",
|
|
752
|
-
"Noto Sans Lao UI",
|
|
753
|
-
"Noto Sans Malayalam UI",
|
|
754
|
-
"Noto Sans Myanmar UI",
|
|
755
|
-
"Noto Sans Oriya UI",
|
|
756
|
-
"Noto Sans Sinhala UI",
|
|
757
|
-
"Noto Sans Tamil UI",
|
|
758
|
-
"Noto Sans Telugu UI",
|
|
759
|
-
"Noto Sans Thai UI",
|
|
760
|
-
"Leelawadee UI",
|
|
761
|
-
"Nirmala UI",
|
|
762
|
-
"Yu Gothic UI",
|
|
763
|
-
"Meiryo UI",
|
|
764
|
-
"MS UI Gothic",
|
|
765
|
-
"Khmer UI",
|
|
766
|
-
"Noto Sans CJK KR",
|
|
767
|
-
"Lao UI",
|
|
768
|
-
"Microsoft YaHei UI",
|
|
769
|
-
"Microsoft JhengHei UI"
|
|
770
|
-
]
|
|
771
|
-
};
|
|
772
|
-
/** Pinned script names. */
|
|
773
|
-
const SCRIPT_NAMES = JSON.parse("[\"Adlam\",\"Ahom\",\"Anatolian_Hieroglyphs\",\"Arabic\",\"Armenian\",\"Avestan\",\"Balinese\",\"Bamum\",\"Bassa_Vah\",\"Batak\",\"Bengali\",\"Beria_Erfe\",\"Bhaiksuki\",\"Bopomofo\",\"Brahmi\",\"Braille\",\"Buginese\",\"Buhid\",\"Canadian_Aboriginal\",\"Carian\",\"Caucasian_Albanian\",\"Chakma\",\"Cham\",\"Cherokee\",\"Chorasmian\",\"Common\",\"Coptic\",\"Cuneiform\",\"Cypriot\",\"Cypro_Minoan\",\"Cyrillic\",\"Deseret\",\"Devanagari\",\"Dives_Akuru\",\"Dogra\",\"Duployan\",\"Egyptian_Hieroglyphs\",\"Elbasan\",\"Elymaic\",\"Ethiopic\",\"Garay\",\"Georgian\",\"Glagolitic\",\"Gothic\",\"Grantha\",\"Greek\",\"Gujarati\",\"Gunjala_Gondi\",\"Gurmukhi\",\"Gurung_Khema\",\"Han\",\"Hangul\",\"Hanifi_Rohingya\",\"Hanunoo\",\"Hatran\",\"Hebrew\",\"Hiragana\",\"Imperial_Aramaic\",\"Inherited\",\"Inscriptional_Pahlavi\",\"Inscriptional_Parthian\",\"Javanese\",\"Kaithi\",\"Kannada\",\"Katakana\",\"Kawi\",\"Kayah_Li\",\"Kharoshthi\",\"Khitan_Small_Script\",\"Khmer\",\"Khojki\",\"Khudawadi\",\"Kirat_Rai\",\"Lao\",\"Latin\",\"Lepcha\",\"Limbu\",\"Linear_A\",\"Linear_B\",\"Lisu\",\"Lycian\",\"Lydian\",\"Mahajani\",\"Makasar\",\"Malayalam\",\"Mandaic\",\"Manichaean\",\"Marchen\",\"Masaram_Gondi\",\"Medefaidrin\",\"Meetei_Mayek\",\"Mende_Kikakui\",\"Meroitic_Cursive\",\"Meroitic_Hieroglyphs\",\"Miao\",\"Modi\",\"Mongolian\",\"Mro\",\"Multani\",\"Myanmar\",\"Nabataean\",\"Nag_Mundari\",\"Nandinagari\",\"New_Tai_Lue\",\"Newa\",\"Nko\",\"Nushu\",\"Nyiakeng_Puachue_Hmong\",\"Ogham\",\"Ol_Chiki\",\"Ol_Onal\",\"Old_Hungarian\",\"Old_Italic\",\"Old_North_Arabian\",\"Old_Permic\",\"Old_Persian\",\"Old_Sogdian\",\"Old_South_Arabian\",\"Old_Turkic\",\"Old_Uyghur\",\"Oriya\",\"Osage\",\"Osmanya\",\"Pahawh_Hmong\",\"Palmyrene\",\"Pau_Cin_Hau\",\"Phags_Pa\",\"Phoenician\",\"Psalter_Pahlavi\",\"Rejang\",\"Runic\",\"Samaritan\",\"Saurashtra\",\"Sharada\",\"Shavian\",\"Siddham\",\"Sidetic\",\"SignWriting\",\"Sinhala\",\"Sogdian\",\"Sora_Sompeng\",\"Soyombo\",\"Sundanese\",\"Sunuwar\",\"Syloti_Nagri\",\"Syriac\",\"Tagalog\",\"Tagbanwa\",\"Tai_Le\",\"Tai_Tham\",\"Tai_Viet\",\"Tai_Yo\",\"Takri\",\"Tamil\",\"Tangsa\",\"Tangut\",\"Telugu\",\"Thaana\",\"Thai\",\"Tibetan\",\"Tifinagh\",\"Tirhuta\",\"Todhri\",\"Tolong_Siki\",\"Toto\",\"Tulu_Tigalari\",\"Ugaritic\",\"Unknown\",\"Vai\",\"Vithkuqi\",\"Wancho\",\"Warang_Citi\",\"Yezidi\",\"Yi\",\"Zanabazar_Square\"]");
|
|
774
|
-
/** Pinned script ranges. */
|
|
775
|
-
const SCRIPT_RANGES = JSON.parse("[[0,65,25],[65,91,74],[91,97,25],[97,123,74],[123,170,25],[170,171,74],[171,186,25],[186,187,74],[187,192,25],[192,215,74],[215,216,25],[216,247,74],[247,248,25],[248,697,74],[697,736,25],[736,741,74],[741,746,25],[746,748,13],[748,768,25],[768,880,58],[880,884,45],[884,885,25],[885,888,45],[888,890,167],[890,894,45],[894,895,25],[895,896,45],[896,900,167],[900,901,45],[901,902,25],[902,903,45],[903,904,25],[904,907,45],[907,908,167],[908,909,45],[909,910,167],[910,930,45],[930,931,167],[931,994,45],[994,1008,26],[1008,1024,45],[1024,1157,30],[1157,1159,58],[1159,1328,30],[1328,1329,167],[1329,1367,4],[1367,1369,167],[1369,1419,4],[1419,1421,167],[1421,1424,4],[1424,1425,167],[1425,1480,55],[1480,1488,167],[1488,1515,55],[1515,1519,167],[1519,1525,55],[1525,1536,167],[1536,1541,3],[1541,1542,25],[1542,1548,3],[1548,1549,25],[1549,1563,3],[1563,1564,25],[1564,1567,3],[1567,1568,25],[1568,1600,3],[1600,1601,25],[1601,1611,3],[1611,1622,58],[1622,1648,3],[1648,1649,58],[1649,1757,3],[1757,1758,25],[1758,1792,3],[1792,1806,145],[1806,1807,167],[1807,1867,145],[1867,1869,167],[1869,1872,145],[1872,1920,3],[1920,1970,157],[1970,1984,167],[1984,2043,105],[2043,2045,167],[2045,2048,105],[2048,2094,131],[2094,2096,167],[2096,2111,131],[2111,2112,167],[2112,2140,85],[2140,2142,167],[2142,2143,85],[2143,2144,167],[2144,2155,145],[2155,2160,167],[2160,2194,3],[2194,2199,167],[2199,2274,3],[2274,2275,25],[2275,2304,3],[2304,2385,32],[2385,2389,58],[2389,2404,32],[2404,2406,25],[2406,2432,32],[2432,2436,10],[2436,2437,167],[2437,2445,10],[2445,2447,167],[2447,2449,10],[2449,2451,167],[2451,2473,10],[2473,2474,167],[2474,2481,10],[2481,2482,167],[2482,2483,10],[2483,2486,167],[2486,2490,10],[2490,2492,167],[2492,2501,10],[2501,2503,167],[2503,2505,10],[2505,2507,167],[2507,2511,10],[2511,2519,167],[2519,2520,10],[2520,2524,167],[2524,2526,10],[2526,2527,167],[2527,2532,10],[2532,2534,167],[2534,2559,10],[2559,2561,167],[2561,2564,48],[2564,2565,167],[2565,2571,48],[2571,2575,167],[2575,2577,48],[2577,2579,167],[2579,2601,48],[2601,2602,167],[2602,2609,48],[2609,2610,167],[2610,2612,48],[2612,2613,167],[2613,2615,48],[2615,2616,167],[2616,2618,48],[2618,2620,167],[2620,2621,48],[2621,2622,167],[2622,2627,48],[2627,2631,167],[2631,2633,48],[2633,2635,167],[2635,2638,48],[2638,2641,167],[2641,2642,48],[2642,2649,167],[2649,2653,48],[2653,2654,167],[2654,2655,48],[2655,2662,167],[2662,2679,48],[2679,2689,167],[2689,2692,46],[2692,2693,167],[2693,2702,46],[2702,2703,167],[2703,2706,46],[2706,2707,167],[2707,2729,46],[2729,2730,167],[2730,2737,46],[2737,2738,167],[2738,2740,46],[2740,2741,167],[2741,2746,46],[2746,2748,167],[2748,2758,46],[2758,2759,167],[2759,2762,46],[2762,2763,167],[2763,2766,46],[2766,2768,167],[2768,2769,46],[2769,2784,167],[2784,2788,46],[2788,2790,167],[2790,2802,46],[2802,2809,167],[2809,2816,46],[2816,2817,167],[2817,2820,120],[2820,2821,167],[2821,2829,120],[2829,2831,167],[2831,2833,120],[2833,2835,167],[2835,2857,120],[2857,2858,167],[2858,2865,120],[2865,2866,167],[2866,2868,120],[2868,2869,167],[2869,2874,120],[2874,2876,167],[2876,2885,120],[2885,2887,167],[2887,2889,120],[2889,2891,167],[2891,2894,120],[2894,2901,167],[2901,2904,120],[2904,2908,167],[2908,2910,120],[2910,2911,167],[2911,2916,120],[2916,2918,167],[2918,2936,120],[2936,2946,167],[2946,2948,153],[2948,2949,167],[2949,2955,153],[2955,2958,167],[2958,2961,153],[2961,2962,167],[2962,2966,153],[2966,2969,167],[2969,2971,153],[2971,2972,167],[2972,2973,153],[2973,2974,167],[2974,2976,153],[2976,2979,167],[2979,2981,153],[2981,2984,167],[2984,2987,153],[2987,2990,167],[2990,3002,153],[3002,3006,167],[3006,3011,153],[3011,3014,167],[3014,3017,153],[3017,3018,167],[3018,3022,153],[3022,3024,167],[3024,3025,153],[3025,3031,167],[3031,3032,153],[3032,3046,167],[3046,3067,153],[3067,3072,167],[3072,3085,156],[3085,3086,167],[3086,3089,156],[3089,3090,167],[3090,3113,156],[3113,3114,167],[3114,3130,156],[3130,3132,167],[3132,3141,156],[3141,3142,167],[3142,3145,156],[3145,3146,167],[3146,3150,156],[3150,3157,167],[3157,3159,156],[3159,3160,167],[3160,3163,156],[3163,3164,167],[3164,3166,156],[3166,3168,167],[3168,3172,156],[3172,3174,167],[3174,3184,156],[3184,3191,167],[3191,3200,156],[3200,3213,63],[3213,3214,167],[3214,3217,63],[3217,3218,167],[3218,3241,63],[3241,3242,167],[3242,3252,63],[3252,3253,167],[3253,3258,63],[3258,3260,167],[3260,3269,63],[3269,3270,167],[3270,3273,63],[3273,3274,167],[3274,3278,63],[3278,3285,167],[3285,3287,63],[3287,3292,167],[3292,3295,63],[3295,3296,167],[3296,3300,63],[3300,3302,167],[3302,3312,63],[3312,3313,167],[3313,3316,63],[3316,3328,167],[3328,3341,84],[3341,3342,167],[3342,3345,84],[3345,3346,167],[3346,3397,84],[3397,3398,167],[3398,3401,84],[3401,3402,167],[3402,3408,84],[3408,3412,167],[3412,3428,84],[3428,3430,167],[3430,3456,84],[3456,3457,167],[3457,3460,138],[3460,3461,167],[3461,3479,138],[3479,3482,167],[3482,3506,138],[3506,3507,167],[3507,3516,138],[3516,3517,167],[3517,3518,138],[3518,3520,167],[3520,3527,138],[3527,3530,167],[3530,3531,138],[3531,3535,167],[3535,3541,138],[3541,3542,167],[3542,3543,138],[3543,3544,167],[3544,3552,138],[3552,3558,167],[3558,3568,138],[3568,3570,167],[3570,3573,138],[3573,3585,167],[3585,3643,158],[3643,3647,167],[3647,3648,25],[3648,3676,158],[3676,3713,167],[3713,3715,73],[3715,3716,167],[3716,3717,73],[3717,3718,167],[3718,3723,73],[3723,3724,167],[3724,3748,73],[3748,3749,167],[3749,3750,73],[3750,3751,167],[3751,3774,73],[3774,3776,167],[3776,3781,73],[3781,3782,167],[3782,3783,73],[3783,3784,167],[3784,3791,73],[3791,3792,167],[3792,3802,73],[3802,3804,167],[3804,3808,73],[3808,3840,167],[3840,3912,159],[3912,3913,167],[3913,3949,159],[3949,3953,167],[3953,3992,159],[3992,3993,167],[3993,4029,159],[4029,4030,167],[4030,4045,159],[4045,4046,167],[4046,4053,159],[4053,4057,25],[4057,4059,159],[4059,4096,167],[4096,4256,99],[4256,4294,41],[4294,4295,167],[4295,4296,41],[4296,4301,167],[4301,4302,41],[4302,4304,167],[4304,4347,41],[4347,4348,25],[4348,4352,41],[4352,4608,51],[4608,4681,39],[4681,4682,167],[4682,4686,39],[4686,4688,167],[4688,4695,39],[4695,4696,167],[4696,4697,39],[4697,4698,167],[4698,4702,39],[4702,4704,167],[4704,4745,39],[4745,4746,167],[4746,4750,39],[4750,4752,167],[4752,4785,39],[4785,4786,167],[4786,4790,39],[4790,4792,167],[4792,4799,39],[4799,4800,167],[4800,4801,39],[4801,4802,167],[4802,4806,39],[4806,4808,167],[4808,4823,39],[4823,4824,167],[4824,4881,39],[4881,4882,167],[4882,4886,39],[4886,4888,167],[4888,4955,39],[4955,4957,167],[4957,4989,39],[4989,4992,167],[4992,5018,39],[5018,5024,167],[5024,5110,23],[5110,5112,167],[5112,5118,23],[5118,5120,167],[5120,5760,18],[5760,5789,108],[5789,5792,167],[5792,5867,130],[5867,5870,25],[5870,5881,130],[5881,5888,167],[5888,5910,146],[5910,5919,167],[5919,5920,146],[5920,5941,53],[5941,5943,25],[5943,5952,167],[5952,5972,17],[5972,5984,167],[5984,5997,147],[5997,5998,167],[5998,6001,147],[6001,6002,167],[6002,6004,147],[6004,6016,167],[6016,6110,69],[6110,6112,167],[6112,6122,69],[6122,6128,167],[6128,6138,69],[6138,6144,167],[6144,6146,96],[6146,6148,25],[6148,6149,96],[6149,6150,25],[6150,6170,96],[6170,6176,167],[6176,6265,96],[6265,6272,167],[6272,6315,96],[6315,6320,167],[6320,6390,18],[6390,6400,167],[6400,6431,76],[6431,6432,167],[6432,6444,76],[6444,6448,167],[6448,6460,76],[6460,6464,167],[6464,6465,76],[6465,6468,167],[6468,6480,76],[6480,6510,148],[6510,6512,167],[6512,6517,148],[6517,6528,167],[6528,6572,103],[6572,6576,167],[6576,6602,103],[6602,6608,167],[6608,6619,103],[6619,6622,167],[6622,6624,103],[6624,6656,69],[6656,6684,16],[6684,6686,167],[6686,6688,16],[6688,6751,149],[6751,6752,167],[6752,6781,149],[6781,6783,167],[6783,6794,149],[6794,6800,167],[6800,6810,149],[6810,6816,167],[6816,6830,149],[6830,6832,167],[6832,6878,58],[6878,6880,167],[6880,6892,58],[6892,6912,167],[6912,6989,6],[6989,6990,167],[6990,7040,6],[7040,7104,142],[7104,7156,9],[7156,7164,167],[7164,7168,9],[7168,7224,75],[7224,7227,167],[7227,7242,75],[7242,7245,167],[7245,7248,75],[7248,7296,109],[7296,7307,30],[7307,7312,167],[7312,7355,41],[7355,7357,167],[7357,7360,41],[7360,7368,142],[7368,7376,167],[7376,7379,58],[7379,7380,25],[7380,7393,58],[7393,7394,25],[7394,7401,58],[7401,7405,25],[7405,7406,58],[7406,7412,25],[7412,7413,58],[7413,7416,25],[7416,7418,58],[7418,7419,25],[7419,7424,167],[7424,7462,74],[7462,7467,45],[7467,7468,30],[7468,7517,74],[7517,7522,45],[7522,7526,74],[7526,7531,45],[7531,7544,74],[7544,7545,30],[7545,7615,74],[7615,7616,45],[7616,7680,58],[7680,7936,74],[7936,7958,45],[7958,7960,167],[7960,7966,45],[7966,7968,167],[7968,8006,45],[8006,8008,167],[8008,8014,45],[8014,8016,167],[8016,8024,45],[8024,8025,167],[8025,8026,45],[8026,8027,167],[8027,8028,45],[8028,8029,167],[8029,8030,45],[8030,8031,167],[8031,8062,45],[8062,8064,167],[8064,8117,45],[8117,8118,167],[8118,8133,45],[8133,8134,167],[8134,8148,45],[8148,8150,167],[8150,8156,45],[8156,8157,167],[8157,8176,45],[8176,8178,167],[8178,8181,45],[8181,8182,167],[8182,8191,45],[8191,8192,167],[8192,8204,25],[8204,8206,58],[8206,8293,25],[8293,8294,167],[8294,8305,25],[8305,8306,74],[8306,8308,167],[8308,8319,25],[8319,8320,74],[8320,8335,25],[8335,8336,167],[8336,8349,74],[8349,8352,167],[8352,8386,25],[8386,8400,167],[8400,8433,58],[8433,8448,167],[8448,8486,25],[8486,8487,45],[8487,8490,25],[8490,8492,74],[8492,8498,25],[8498,8499,74],[8499,8526,25],[8526,8527,74],[8527,8544,25],[8544,8585,74],[8585,8588,25],[8588,8592,167],[8592,9258,25],[9258,9280,167],[9280,9291,25],[9291,9312,167],[9312,10240,25],[10240,10496,15],[10496,11124,25],[11124,11126,167],[11126,11264,25],[11264,11360,42],[11360,11392,74],[11392,11508,26],[11508,11513,167],[11513,11520,26],[11520,11558,41],[11558,11559,167],[11559,11560,41],[11560,11565,167],[11565,11566,41],[11566,11568,167],[11568,11624,160],[11624,11631,167],[11631,11633,160],[11633,11647,167],[11647,11648,160],[11648,11671,39],[11671,11680,167],[11680,11687,39],[11687,11688,167],[11688,11695,39],[11695,11696,167],[11696,11703,39],[11703,11704,167],[11704,11711,39],[11711,11712,167],[11712,11719,39],[11719,11720,167],[11720,11727,39],[11727,11728,167],[11728,11735,39],[11735,11736,167],[11736,11743,39],[11743,11744,167],[11744,11776,30],[11776,11870,25],[11870,11904,167],[11904,11930,50],[11930,11931,167],[11931,12020,50],[12020,12032,167],[12032,12246,50],[12246,12272,167],[12272,12293,25],[12293,12294,50],[12294,12295,25],[12295,12296,50],[12296,12321,25],[12321,12330,50],[12330,12334,58],[12334,12336,51],[12336,12344,25],[12344,12348,50],[12348,12352,25],[12352,12353,167],[12353,12439,56],[12439,12441,167],[12441,12443,58],[12443,12445,25],[12445,12448,56],[12448,12449,25],[12449,12539,64],[12539,12541,25],[12541,12544,64],[12544,12549,167],[12549,12592,13],[12592,12593,167],[12593,12687,51],[12687,12688,167],[12688,12704,25],[12704,12736,13],[12736,12774,25],[12774,12783,167],[12783,12784,25],[12784,12800,64],[12800,12831,51],[12831,12832,167],[12832,12896,25],[12896,12927,51],[12927,13008,25],[13008,13055,64],[13055,13056,25],[13056,13144,64],[13144,13312,25],[13312,19904,50],[19904,19968,25],[19968,40960,50],[40960,42125,173],[42125,42128,167],[42128,42183,173],[42183,42192,167],[42192,42240,79],[42240,42540,168],[42540,42560,167],[42560,42656,30],[42656,42744,7],[42744,42752,167],[42752,42786,25],[42786,42888,74],[42888,42891,25],[42891,42973,74],[42973,42993,167],[42993,43008,74],[43008,43053,144],[43053,43056,167],[43056,43066,25],[43066,43072,167],[43072,43128,126],[43128,43136,167],[43136,43206,132],[43206,43214,167],[43214,43226,132],[43226,43232,167],[43232,43264,32],[43264,43310,66],[43310,43311,25],[43311,43312,66],[43312,43348,129],[43348,43359,167],[43359,43360,129],[43360,43389,51],[43389,43392,167],[43392,43470,61],[43470,43471,167],[43471,43472,25],[43472,43482,61],[43482,43486,167],[43486,43488,61],[43488,43519,99],[43519,43520,167],[43520,43575,22],[43575,43584,167],[43584,43598,22],[43598,43600,167],[43600,43610,22],[43610,43612,167],[43612,43616,22],[43616,43648,99],[43648,43715,150],[43715,43739,167],[43739,43744,150],[43744,43767,90],[43767,43777,167],[43777,43783,39],[43783,43785,167],[43785,43791,39],[43791,43793,167],[43793,43799,39],[43799,43808,167],[43808,43815,39],[43815,43816,167],[43816,43823,39],[43823,43824,167],[43824,43867,74],[43867,43868,25],[43868,43877,74],[43877,43878,45],[43878,43882,74],[43882,43884,25],[43884,43888,167],[43888,43968,23],[43968,44014,90],[44014,44016,167],[44016,44026,90],[44026,44032,167],[44032,55204,51],[55204,55216,167],[55216,55239,51],[55239,55243,167],[55243,55292,51],[55292,63744,167],[63744,64110,50],[64110,64112,167],[64112,64218,50],[64218,64256,167],[64256,64263,74],[64263,64275,167],[64275,64280,4],[64280,64285,167],[64285,64311,55],[64311,64312,167],[64312,64317,55],[64317,64318,167],[64318,64319,55],[64319,64320,167],[64320,64322,55],[64322,64323,167],[64323,64325,55],[64325,64326,167],[64326,64336,55],[64336,64830,3],[64830,64832,25],[64832,64976,3],[64976,65008,167],[65008,65024,3],[65024,65040,58],[65040,65050,25],[65050,65056,167],[65056,65070,58],[65070,65072,30],[65072,65107,25],[65107,65108,167],[65108,65127,25],[65127,65128,167],[65128,65132,25],[65132,65136,167],[65136,65141,3],[65141,65142,167],[65142,65277,3],[65277,65279,167],[65279,65280,25],[65280,65281,167],[65281,65313,25],[65313,65339,74],[65339,65345,25],[65345,65371,74],[65371,65382,25],[65382,65392,64],[65392,65393,25],[65393,65438,64],[65438,65440,25],[65440,65471,51],[65471,65474,167],[65474,65480,51],[65480,65482,167],[65482,65488,51],[65488,65490,167],[65490,65496,51],[65496,65498,167],[65498,65501,51],[65501,65504,167],[65504,65511,25],[65511,65512,167],[65512,65519,25],[65519,65529,167],[65529,65534,25],[65534,65536,167],[65536,65548,78],[65548,65549,167],[65549,65575,78],[65575,65576,167],[65576,65595,78],[65595,65596,167],[65596,65598,78],[65598,65599,167],[65599,65614,78],[65614,65616,167],[65616,65630,78],[65630,65664,167],[65664,65787,78],[65787,65792,167],[65792,65795,25],[65795,65799,167],[65799,65844,25],[65844,65847,167],[65847,65856,25],[65856,65935,45],[65935,65936,167],[65936,65949,25],[65949,65952,167],[65952,65953,45],[65953,66000,167],[66000,66045,25],[66045,66046,58],[66046,66176,167],[66176,66205,80],[66205,66208,167],[66208,66257,19],[66257,66272,167],[66272,66273,58],[66273,66300,25],[66300,66304,167],[66304,66340,112],[66340,66349,167],[66349,66352,112],[66352,66379,43],[66379,66384,167],[66384,66427,114],[66427,66432,167],[66432,66462,166],[66462,66463,167],[66463,66464,166],[66464,66500,115],[66500,66504,167],[66504,66518,115],[66518,66560,167],[66560,66640,31],[66640,66688,134],[66688,66718,122],[66718,66720,167],[66720,66730,122],[66730,66736,167],[66736,66772,121],[66772,66776,167],[66776,66812,121],[66812,66816,167],[66816,66856,37],[66856,66864,167],[66864,66916,20],[66916,66927,167],[66927,66928,20],[66928,66939,169],[66939,66940,167],[66940,66955,169],[66955,66956,167],[66956,66963,169],[66963,66964,167],[66964,66966,169],[66966,66967,167],[66967,66978,169],[66978,66979,167],[66979,66994,169],[66994,66995,167],[66995,67002,169],[67002,67003,167],[67003,67005,169],[67005,67008,167],[67008,67060,162],[67060,67072,167],[67072,67383,77],[67383,67392,167],[67392,67414,77],[67414,67424,167],[67424,67432,77],[67432,67456,167],[67456,67462,74],[67462,67463,167],[67463,67505,74],[67505,67506,167],[67506,67515,74],[67515,67584,167],[67584,67590,28],[67590,67592,167],[67592,67593,28],[67593,67594,167],[67594,67638,28],[67638,67639,167],[67639,67641,28],[67641,67644,167],[67644,67645,28],[67645,67647,167],[67647,67648,28],[67648,67670,57],[67670,67671,167],[67671,67680,57],[67680,67712,124],[67712,67743,100],[67743,67751,167],[67751,67760,100],[67760,67808,167],[67808,67827,54],[67827,67828,167],[67828,67830,54],[67830,67835,167],[67835,67840,54],[67840,67868,127],[67868,67871,167],[67871,67872,127],[67872,67898,81],[67898,67903,167],[67903,67904,81],[67904,67930,136],[67930,67968,167],[67968,68000,93],[68000,68024,92],[68024,68028,167],[68028,68048,92],[68048,68050,167],[68050,68096,92],[68096,68100,67],[68100,68101,167],[68101,68103,67],[68103,68108,167],[68108,68116,67],[68116,68117,167],[68117,68120,67],[68120,68121,167],[68121,68150,67],[68150,68152,167],[68152,68155,67],[68155,68159,167],[68159,68169,67],[68169,68176,167],[68176,68185,67],[68185,68192,167],[68192,68224,117],[68224,68256,113],[68256,68288,167],[68288,68327,86],[68327,68331,167],[68331,68343,86],[68343,68352,167],[68352,68406,5],[68406,68409,167],[68409,68416,5],[68416,68438,60],[68438,68440,167],[68440,68448,60],[68448,68467,59],[68467,68472,167],[68472,68480,59],[68480,68498,128],[68498,68505,167],[68505,68509,128],[68509,68521,167],[68521,68528,128],[68528,68608,167],[68608,68681,118],[68681,68736,167],[68736,68787,111],[68787,68800,167],[68800,68851,111],[68851,68858,167],[68858,68864,111],[68864,68904,52],[68904,68912,167],[68912,68922,52],[68922,68928,167],[68928,68966,40],[68966,68969,167],[68969,68998,40],[68998,69006,167],[69006,69008,40],[69008,69216,167],[69216,69247,3],[69247,69248,167],[69248,69290,172],[69290,69291,167],[69291,69294,172],[69294,69296,167],[69296,69298,172],[69298,69314,167],[69314,69320,3],[69320,69328,167],[69328,69337,3],[69337,69370,167],[69370,69376,3],[69376,69416,116],[69416,69424,167],[69424,69466,139],[69466,69488,167],[69488,69514,119],[69514,69552,167],[69552,69580,24],[69580,69600,167],[69600,69623,38],[69623,69632,167],[69632,69710,14],[69710,69714,167],[69714,69750,14],[69750,69759,167],[69759,69760,14],[69760,69827,62],[69827,69837,167],[69837,69838,62],[69838,69840,167],[69840,69865,140],[69865,69872,167],[69872,69882,140],[69882,69888,167],[69888,69941,21],[69941,69942,167],[69942,69960,21],[69960,69968,167],[69968,70007,82],[70007,70016,167],[70016,70112,133],[70112,70113,167],[70113,70133,138],[70133,70144,167],[70144,70162,70],[70162,70163,167],[70163,70210,70],[70210,70272,167],[70272,70279,98],[70279,70280,167],[70280,70281,98],[70281,70282,167],[70282,70286,98],[70286,70287,167],[70287,70302,98],[70302,70303,167],[70303,70314,98],[70314,70320,167],[70320,70379,71],[70379,70384,167],[70384,70394,71],[70394,70400,167],[70400,70404,44],[70404,70405,167],[70405,70413,44],[70413,70415,167],[70415,70417,44],[70417,70419,167],[70419,70441,44],[70441,70442,167],[70442,70449,44],[70449,70450,167],[70450,70452,44],[70452,70453,167],[70453,70458,44],[70458,70459,167],[70459,70460,58],[70460,70469,44],[70469,70471,167],[70471,70473,44],[70473,70475,167],[70475,70478,44],[70478,70480,167],[70480,70481,44],[70481,70487,167],[70487,70488,44],[70488,70493,167],[70493,70500,44],[70500,70502,167],[70502,70509,44],[70509,70512,167],[70512,70517,44],[70517,70528,167],[70528,70538,165],[70538,70539,167],[70539,70540,165],[70540,70542,167],[70542,70543,165],[70543,70544,167],[70544,70582,165],[70582,70583,167],[70583,70593,165],[70593,70594,167],[70594,70595,165],[70595,70597,167],[70597,70598,165],[70598,70599,167],[70599,70603,165],[70603,70604,167],[70604,70614,165],[70614,70615,167],[70615,70617,165],[70617,70625,167],[70625,70627,165],[70627,70656,167],[70656,70748,104],[70748,70749,167],[70749,70754,104],[70754,70784,167],[70784,70856,161],[70856,70864,167],[70864,70874,161],[70874,71040,167],[71040,71094,135],[71094,71096,167],[71096,71134,135],[71134,71168,167],[71168,71237,95],[71237,71248,167],[71248,71258,95],[71258,71264,167],[71264,71277,96],[71277,71296,167],[71296,71354,152],[71354,71360,167],[71360,71370,152],[71370,71376,167],[71376,71396,99],[71396,71424,167],[71424,71451,1],[71451,71453,167],[71453,71468,1],[71468,71472,167],[71472,71495,1],[71495,71680,167],[71680,71740,34],[71740,71840,167],[71840,71923,171],[71923,71935,167],[71935,71936,171],[71936,71943,33],[71943,71945,167],[71945,71946,33],[71946,71948,167],[71948,71956,33],[71956,71957,167],[71957,71959,33],[71959,71960,167],[71960,71990,33],[71990,71991,167],[71991,71993,33],[71993,71995,167],[71995,72007,33],[72007,72016,167],[72016,72026,33],[72026,72096,167],[72096,72104,102],[72104,72106,167],[72106,72152,102],[72152,72154,167],[72154,72165,102],[72165,72192,167],[72192,72264,174],[72264,72272,167],[72272,72355,141],[72355,72368,167],[72368,72384,18],[72384,72441,125],[72441,72448,167],[72448,72458,32],[72458,72544,167],[72544,72552,133],[72552,72640,167],[72640,72674,143],[72674,72688,167],[72688,72698,143],[72698,72704,167],[72704,72713,12],[72713,72714,167],[72714,72759,12],[72759,72760,167],[72760,72774,12],[72774,72784,167],[72784,72813,12],[72813,72816,167],[72816,72848,87],[72848,72850,167],[72850,72872,87],[72872,72873,167],[72873,72887,87],[72887,72960,167],[72960,72967,88],[72967,72968,167],[72968,72970,88],[72970,72971,167],[72971,73015,88],[73015,73018,167],[73018,73019,88],[73019,73020,167],[73020,73022,88],[73022,73023,167],[73023,73032,88],[73032,73040,167],[73040,73050,88],[73050,73056,167],[73056,73062,47],[73062,73063,167],[73063,73065,47],[73065,73066,167],[73066,73103,47],[73103,73104,167],[73104,73106,47],[73106,73107,167],[73107,73113,47],[73113,73120,167],[73120,73130,47],[73130,73136,167],[73136,73180,163],[73180,73184,167],[73184,73194,163],[73194,73440,167],[73440,73465,83],[73465,73472,167],[73472,73489,65],[73489,73490,167],[73490,73531,65],[73531,73534,167],[73534,73563,65],[73563,73648,167],[73648,73649,79],[73649,73664,167],[73664,73714,153],[73714,73727,167],[73727,73728,153],[73728,74650,27],[74650,74752,167],[74752,74863,27],[74863,74864,167],[74864,74869,27],[74869,74880,167],[74880,75076,27],[75076,77712,167],[77712,77811,29],[77811,77824,167],[77824,78934,36],[78934,78944,167],[78944,82939,36],[82939,82944,167],[82944,83527,2],[83527,90368,167],[90368,90426,49],[90426,92160,167],[92160,92729,7],[92729,92736,167],[92736,92767,97],[92767,92768,167],[92768,92778,97],[92778,92782,167],[92782,92784,97],[92784,92863,154],[92863,92864,167],[92864,92874,154],[92874,92880,167],[92880,92910,8],[92910,92912,167],[92912,92918,8],[92918,92928,167],[92928,92998,123],[92998,93008,167],[93008,93018,123],[93018,93019,167],[93019,93026,123],[93026,93027,167],[93027,93048,123],[93048,93053,167],[93053,93072,123],[93072,93504,167],[93504,93562,72],[93562,93760,167],[93760,93851,89],[93851,93856,167],[93856,93881,11],[93881,93883,167],[93883,93908,11],[93908,93952,167],[93952,94027,94],[94027,94031,167],[94031,94088,94],[94088,94095,167],[94095,94112,94],[94112,94176,167],[94176,94177,155],[94177,94178,106],[94178,94180,50],[94180,94181,68],[94181,94192,167],[94192,94199,50],[94199,94208,167],[94208,101120,155],[101120,101590,68],[101590,101631,167],[101631,101632,68],[101632,101663,155],[101663,101760,167],[101760,101875,155],[101875,110576,167],[110576,110580,64],[110580,110581,167],[110581,110588,64],[110588,110589,167],[110589,110591,64],[110591,110592,167],[110592,110593,64],[110593,110880,56],[110880,110883,64],[110883,110898,167],[110898,110899,56],[110899,110928,167],[110928,110931,56],[110931,110933,167],[110933,110934,64],[110934,110948,167],[110948,110952,64],[110952,110960,167],[110960,111356,106],[111356,113664,167],[113664,113771,35],[113771,113776,167],[113776,113789,35],[113789,113792,167],[113792,113801,35],[113801,113808,167],[113808,113818,35],[113818,113820,167],[113820,113824,35],[113824,113828,25],[113828,117760,167],[117760,118013,25],[118013,118016,167],[118016,118452,25],[118452,118458,167],[118458,118481,25],[118481,118496,167],[118496,118513,25],[118513,118528,167],[118528,118574,58],[118574,118576,167],[118576,118599,58],[118599,118608,167],[118608,118724,25],[118724,118784,167],[118784,119030,25],[119030,119040,167],[119040,119079,25],[119079,119081,167],[119081,119143,25],[119143,119146,58],[119146,119163,25],[119163,119171,58],[119171,119173,25],[119173,119180,58],[119180,119210,25],[119210,119214,58],[119214,119275,25],[119275,119296,167],[119296,119366,45],[119366,119488,167],[119488,119508,25],[119508,119520,167],[119520,119540,25],[119540,119552,167],[119552,119639,25],[119639,119648,167],[119648,119673,25],[119673,119808,167],[119808,119893,25],[119893,119894,167],[119894,119965,25],[119965,119966,167],[119966,119968,25],[119968,119970,167],[119970,119971,25],[119971,119973,167],[119973,119975,25],[119975,119977,167],[119977,119981,25],[119981,119982,167],[119982,119994,25],[119994,119995,167],[119995,119996,25],[119996,119997,167],[119997,120004,25],[120004,120005,167],[120005,120070,25],[120070,120071,167],[120071,120075,25],[120075,120077,167],[120077,120085,25],[120085,120086,167],[120086,120093,25],[120093,120094,167],[120094,120122,25],[120122,120123,167],[120123,120127,25],[120127,120128,167],[120128,120133,25],[120133,120134,167],[120134,120135,25],[120135,120138,167],[120138,120145,25],[120145,120146,167],[120146,120486,25],[120486,120488,167],[120488,120780,25],[120780,120782,167],[120782,120832,25],[120832,121484,137],[121484,121499,167],[121499,121504,137],[121504,121505,167],[121505,121520,137],[121520,122624,167],[122624,122655,74],[122655,122661,167],[122661,122667,74],[122667,122880,167],[122880,122887,42],[122887,122888,167],[122888,122905,42],[122905,122907,167],[122907,122914,42],[122914,122915,167],[122915,122917,42],[122917,122918,167],[122918,122923,42],[122923,122928,167],[122928,122990,30],[122990,123023,167],[123023,123024,30],[123024,123136,167],[123136,123181,107],[123181,123184,167],[123184,123198,107],[123198,123200,167],[123200,123210,107],[123210,123214,167],[123214,123216,107],[123216,123536,167],[123536,123567,164],[123567,123584,167],[123584,123642,170],[123642,123647,167],[123647,123648,170],[123648,124112,167],[124112,124154,101],[124154,124368,167],[124368,124411,110],[124411,124415,167],[124415,124416,110],[124416,124608,167],[124608,124639,151],[124639,124640,167],[124640,124662,151],[124662,124670,167],[124670,124672,151],[124672,124896,167],[124896,124903,39],[124903,124904,167],[124904,124908,39],[124908,124909,167],[124909,124911,39],[124911,124912,167],[124912,124927,39],[124927,124928,167],[124928,125125,91],[125125,125127,167],[125127,125143,91],[125143,125184,167],[125184,125260,0],[125260,125264,167],[125264,125274,0],[125274,125278,167],[125278,125280,0],[125280,126065,167],[126065,126133,25],[126133,126209,167],[126209,126270,25],[126270,126464,167],[126464,126468,3],[126468,126469,167],[126469,126496,3],[126496,126497,167],[126497,126499,3],[126499,126500,167],[126500,126501,3],[126501,126503,167],[126503,126504,3],[126504,126505,167],[126505,126515,3],[126515,126516,167],[126516,126520,3],[126520,126521,167],[126521,126522,3],[126522,126523,167],[126523,126524,3],[126524,126530,167],[126530,126531,3],[126531,126535,167],[126535,126536,3],[126536,126537,167],[126537,126538,3],[126538,126539,167],[126539,126540,3],[126540,126541,167],[126541,126544,3],[126544,126545,167],[126545,126547,3],[126547,126548,167],[126548,126549,3],[126549,126551,167],[126551,126552,3],[126552,126553,167],[126553,126554,3],[126554,126555,167],[126555,126556,3],[126556,126557,167],[126557,126558,3],[126558,126559,167],[126559,126560,3],[126560,126561,167],[126561,126563,3],[126563,126564,167],[126564,126565,3],[126565,126567,167],[126567,126571,3],[126571,126572,167],[126572,126579,3],[126579,126580,167],[126580,126584,3],[126584,126585,167],[126585,126589,3],[126589,126590,167],[126590,126591,3],[126591,126592,167],[126592,126602,3],[126602,126603,167],[126603,126620,3],[126620,126625,167],[126625,126628,3],[126628,126629,167],[126629,126634,3],[126634,126635,167],[126635,126652,3],[126652,126704,167],[126704,126706,3],[126706,126976,167],[126976,127020,25],[127020,127024,167],[127024,127124,25],[127124,127136,167],[127136,127151,25],[127151,127153,167],[127153,127168,25],[127168,127169,167],[127169,127184,25],[127184,127185,167],[127185,127222,25],[127222,127232,167],[127232,127406,25],[127406,127462,167],[127462,127488,25],[127488,127489,56],[127489,127491,25],[127491,127504,167],[127504,127548,25],[127548,127552,167],[127552,127561,25],[127561,127568,167],[127568,127570,25],[127570,127584,167],[127584,127590,25],[127590,127744,167],[127744,128729,25],[128729,128732,167],[128732,128749,25],[128749,128752,167],[128752,128765,25],[128765,128768,167],[128768,128986,25],[128986,128992,167],[128992,129004,25],[129004,129008,167],[129008,129009,25],[129009,129024,167],[129024,129036,25],[129036,129040,167],[129040,129096,25],[129096,129104,167],[129104,129114,25],[129114,129120,167],[129120,129160,25],[129160,129168,167],[129168,129198,25],[129198,129200,167],[129200,129212,25],[129212,129216,167],[129216,129218,25],[129218,129232,167],[129232,129241,25],[129241,129280,167],[129280,129624,25],[129624,129632,167],[129632,129646,25],[129646,129648,167],[129648,129661,25],[129661,129664,167],[129664,129675,25],[129675,129678,167],[129678,129735,25],[129735,129736,167],[129736,129737,25],[129737,129741,167],[129741,129757,25],[129757,129759,167],[129759,129771,25],[129771,129775,167],[129775,129785,25],[129785,129792,167],[129792,129939,25],[129939,129940,167],[129940,130043,25],[130043,131072,167],[131072,173792,50],[173792,173824,167],[173824,178206,50],[178206,178208,167],[178208,183982,50],[183982,183984,167],[183984,191457,50],[191457,191472,167],[191472,192094,50],[192094,194560,167],[194560,195102,50],[195102,196608,167],[196608,201547,50],[201547,201552,167],[201552,210042,50],[210042,917505,167],[917505,917506,25],[917506,917536,167],[917536,917632,25],[917632,917760,167],[917760,918000,58],[918000,1114112,167]]");
|
|
776
|
-
/** Pinned script extensions. */
|
|
777
|
-
const SCRIPT_EXTENSIONS = JSON.parse("[[1567,1568,0],[1600,1601,0],[8271,8272,0],[11841,11842,0],[1548,1549,3],[1563,1564,3],[1567,1568,3],[1600,1601,3],[1611,1622,3],[1648,1649,3],[8271,8272,3],[11841,11842,3],[64830,64832,3],[66273,66300,3],[66272,66273,3],[776,777,4],[183,184,5],[11824,11826,5],[700,701,10],[2385,2387,10],[2404,2406,10],[7376,7377,10],[7378,7379,10],[7381,7383,10],[7384,7385,10],[7393,7394,10],[7402,7403,10],[7405,7406,10],[7410,7411,10],[7413,7416,10],[711,712,13],[713,716,13],[729,730,13],[12289,12292,13],[12296,12306,13],[12307,12320,13],[12330,12334,13],[12336,12337,13],[12343,12344,13],[12539,12540,13],[65093,65095,13],[65377,65382,13],[43471,43472,16],[5941,5943,17],[183,184,19],[8282,8283,19],[8285,8286,19],[11825,11826,19],[772,773,20],[817,818,20],[862,863,20],[768,771,23],[772,773,23],[779,781,23],[803,805,23],[816,818,23],[183,184,26],[768,769,26],[772,774,26],[775,776,26],[884,885,26],[11799,11800,26],[66273,66300,26],[66272,66273,26],[65792,65795,28],[65799,65844,28],[65847,65856,28],[65792,65794,29],[700,701,30],[768,771,30],[772,773,30],[774,775,30],[776,777,30],[779,780,30],[785,786,30],[1157,1159,30],[7672,7673,30],[11843,11844,30],[700,701,32],[2385,2387,32],[2404,2406,32],[7379,7380,32],[7393,7394,32],[7401,7405,32],[7406,7412,32],[7413,7415,32],[7376,7379,32],[7380,7393,32],[7394,7401,32],[7405,7406,32],[7412,7413,32],[7416,7418,32],[8432,8433,32],[43056,43066,32],[2404,2406,34],[43056,43066,34],[183,184,35],[775,777,35],[778,779,35],[803,805,35],[11836,11837,35],[113824,113828,35],[183,184,37],[773,774,37],[782,783,39],[1548,1549,40],[1563,1564,40],[1567,1568,40],[183,184,41],[4347,4348,41],[8282,8283,41],[11825,11826,41],[183,184,42],[771,772,42],[773,774,42],[4347,4348,42],[8282,8283,42],[11843,11844,42],[183,184,43],[772,774,43],[776,777,43],[817,818,43],[2385,2387,44],[2404,2406,44],[7376,7377,44],[7379,7380,44],[7378,7379,44],[7410,7412,44],[7412,7413,44],[7416,7418,44],[8432,8433,44],[70459,70460,44],[183,184,45],[768,770,45],[772,773,45],[774,775,45],[776,777,45],[787,788,45],[834,835,45],[837,838,45],[884,885,45],[7616,7618,45],[8285,8286,45],[2385,2387,46],[2404,2406,46],[43056,43066,46],[183,184,47],[2404,2406,47],[2385,2387,48],[2404,2406,48],[43056,43066,48],[2405,2406,49],[183,184,50],[12272,12288,50],[12289,12292,50],[12294,12295,50],[12296,12306,50],[12307,12320,50],[12330,12334,50],[12336,12337,50],[12343,12344,50],[12348,12352,50],[12539,12540,50],[12688,12704,50],[12736,12774,50],[12783,12784,50],[12832,12872,50],[12928,12977,50],[12992,13004,50],[13055,13056,50],[13144,13169,50],[13179,13184,50],[13280,13311,50],[42752,42760,50],[65093,65095,50],[65377,65382,50],[119648,119666,50],[127568,127570,50],[12289,12292,51],[12296,12306,51],[12307,12320,51],[12336,12337,51],[12343,12344,51],[12539,12540,51],[65093,65095,51],[65377,65382,51],[1548,1549,52],[1563,1564,52],[1567,1568,52],[1600,1601,52],[5941,5943,53],[775,777,55],[12289,12292,56],[12296,12306,56],[12307,12320,56],[12336,12342,56],[12343,12344,56],[12348,12350,56],[12443,12445,56],[12448,12449,56],[12441,12443,56],[12539,12541,56],[65093,65095,56],[65377,65382,56],[65392,65393,56],[65438,65440,56],[43471,43472,61],[11825,11826,62],[43056,43066,62],[2385,2387,63],[2404,2406,63],[7376,7377,63],[7379,7380,63],[7378,7379,63],[7386,7387,63],[7410,7411,63],[7412,7413,63],[43056,43062,63],[773,774,64],[803,804,64],[12289,12292,64],[12296,12306,64],[12307,12320,64],[12336,12342,64],[12343,12344,64],[12348,12350,64],[12443,12445,64],[12441,12443,64],[12448,12449,64],[12539,12541,64],[65093,65095,64],[65377,65382,64],[65392,65393,64],[65438,65440,64],[43310,43311,66],[43056,43066,70],[2404,2406,71],[43056,43066,71],[183,184,74],[700,701,74],[711,712,74],[713,716,74],[717,718,74],[727,728,74],[729,730,74],[768,783,74],[784,786,74],[787,788,74],[803,806,74],[813,815,74],[816,818,74],[856,857,74],[862,863,74],[867,880,74],[1157,1159,74],[2385,2387,74],[4347,4348,74],[7672,7673,74],[8239,8240,74],[8432,8433,74],[11799,11800,74],[42752,42760,74],[43310,43311,74],[2405,2406,76],[65799,65844,77],[65792,65795,78],[65799,65844,78],[65847,65856,78],[700,701,79],[717,718,79],[12298,12300,79],[8282,8283,80],[183,184,81],[11825,11826,81],[183,184,82],[2404,2406,82],[43056,43066,82],[2385,2387,84],[2404,2406,84],[7386,7387,84],[7410,7411,84],[43056,43059,84],[1600,1601,85],[1600,1601,86],[2404,2406,88],[8285,8286,93],[43056,43066,95],[6146,6148,96],[6149,6150,96],[8239,8240,96],[12289,12291,96],[12296,12300,96],[43310,43311,99],[2385,2386,102],[2404,2406,102],[7401,7402,102],[7410,7411,102],[7418,7419,102],[43056,43062,102],[2385,2387,104],[7381,7382,104],[7383,7385,104],[7394,7395,104],[7401,7402,104],[7403,7404,104],[7405,7406,104],[1548,1549,105],[1563,1564,105],[1567,1568,105],[64830,64832,105],[2404,2406,110],[8282,8283,111],[8285,8286,111],[11825,11826,111],[11841,11842,111],[183,184,114],[768,769,114],[774,777,114],[787,788,114],[8282,8283,118],[11824,11825,118],[1600,1601,119],[2385,2387,120],[2404,2406,120],[7386,7387,120],[7410,7411,120],[769,770,121],[772,773,121],[779,780,121],[856,857,121],[6146,6148,126],[6149,6150,126],[8239,8240,126],[12290,12291,126],[1600,1601,128],[5867,5870,130],[11825,11826,131],[2385,2386,133],[7383,7384,133],[7385,7386,133],[7388,7390,133],[7392,7393,133],[7402,7403,133],[7405,7406,133],[43056,43062,133],[43064,43065,133],[183,184,134],[2404,2406,138],[7410,7411,138],[1600,1601,139],[768,770,143],[771,772,143],[781,782,143],[784,785,143],[813,814,143],[817,818,143],[2404,2406,144],[771,773,145],[775,777,145],[778,779,145],[803,806,145],[813,815,145],[816,818,145],[1548,1549,145],[1563,1564,145],[1567,1568,145],[1600,1601,145],[1611,1622,145],[1648,1649,145],[7672,7673,145],[7674,7675,145],[5941,5943,146],[5941,5943,147],[768,770,148],[775,777,148],[780,781,148],[2404,2406,152],[43056,43066,152],[2385,2387,153],[2404,2406,153],[7386,7387,153],[70459,70460,153],[12272,12288,155],[12783,12784,155],[2385,2387,156],[2404,2406,156],[7381,7383,156],[7384,7385,156],[7386,7387,156],[7410,7411,156],[1548,1549,157],[1563,1564,157],[1567,1568,157],[700,701,158],[727,728,158],[771,772,158],[817,818,158],[12296,12300,159],[770,771,160],[772,773,160],[774,778,160],[803,804,160],[2385,2387,161],[2404,2406,161],[7381,7382,161],[7394,7395,161],[7410,7411,161],[43056,43066,161],[769,770,162],[772,773,162],[775,776,162],[785,786,162],[787,788,162],[862,863,162],[700,701,164],[7410,7411,165],[7412,7413,165],[43056,43062,165],[1548,1549,172],[1563,1564,172],[1567,1568,172],[12289,12291,173],[12296,12306,173],[12308,12316,173],[12539,12540,173],[65377,65382,173]]");
|
|
778
|
-
//#endregion
|
|
779
|
-
//#region lib/types/font-preferences.js
|
|
780
|
-
/** Script-aware installed-font preferences; synchronous for LibreOffice's VCL callback. */
|
|
781
|
-
const genericNames = /* @__PURE__ */ new Set([
|
|
782
|
-
"serif",
|
|
783
|
-
"sansserif",
|
|
784
|
-
"monospace",
|
|
785
|
-
"systemui",
|
|
786
|
-
"symbol",
|
|
787
|
-
"cursive",
|
|
788
|
-
"fantasy"
|
|
789
|
-
]);
|
|
790
|
-
function scriptOf(point) {
|
|
791
|
-
let left = 0, right = SCRIPT_RANGES.length;
|
|
792
|
-
while (left < right) {
|
|
793
|
-
const middle = left + right >>> 1;
|
|
794
|
-
if (SCRIPT_RANGES[middle][0] <= point) left = middle + 1;
|
|
795
|
-
else right = middle;
|
|
796
|
-
}
|
|
797
|
-
const range = SCRIPT_RANGES[left - 1];
|
|
798
|
-
return range !== void 0 && point < range[1] ? SCRIPT_NAMES[range[2]] : "Unknown";
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Partition missing scalars by Unicode 17; shared marks follow a compatible script when present.
|
|
802
|
-
* @param points - Missing scalars, in engine order.
|
|
803
|
-
* @returns stable script groups without splitting Script_Extensions marks from their base.
|
|
804
|
-
*/
|
|
805
|
-
function fontScriptGroups(points) {
|
|
806
|
-
const scripts = new Set(points.map(scriptOf).filter((script) => script !== "Common" && script !== "Inherited"));
|
|
807
|
-
const groups = /* @__PURE__ */ new Map();
|
|
808
|
-
for (const point of points) {
|
|
809
|
-
let script = scriptOf(point);
|
|
810
|
-
if (script === "Common" || script === "Inherited") {
|
|
811
|
-
const extension = SCRIPT_EXTENSIONS.find(([first, end, index]) => point >= first && point < end && scripts.has(SCRIPT_NAMES[index]));
|
|
812
|
-
script = extension === void 0 ? "Common" : SCRIPT_NAMES[extension[2]];
|
|
813
|
-
}
|
|
814
|
-
const group = groups.get(script) ?? [];
|
|
815
|
-
group.push(point);
|
|
816
|
-
groups.set(script, group);
|
|
817
|
-
}
|
|
818
|
-
return groups;
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
* Recognize CJK regional font names, including platform families without a region suffix.
|
|
822
|
-
* @param family - Family or alias.
|
|
823
|
-
* @returns Noto region key, when the family identifies a regional design.
|
|
824
|
-
*/
|
|
825
|
-
function fontRegion(family) {
|
|
826
|
-
const name = normalize(family);
|
|
827
|
-
if (/malgun|gulim|dotum|batang|nanum|applegothic|applesdgothic|applemyungjo|맑은|돋움|바탕/.test(name)) return "kr";
|
|
828
|
-
if (/hiragino|meiryo|yugothic|yumincho|msp?gothic|msp?mincho|ipam|ipaex|sazanami|kochi|umeplus/.test(name)) return "jp";
|
|
829
|
-
if (/jhenghei|mingliu|pmingli/.test(name)) return "tc";
|
|
830
|
-
if (/yahei|simsun|nsimsun|simhei|stsong|stheiti|wenquanyi|宋体|黑体|微软雅黑/.test(name)) return "sc";
|
|
831
|
-
return /(?:cjk|sans|serif|songti|pingfang|heiti|sourcehan)(sc|tc|hk|jp|kr|k)(?:$|regular|bold|light)/.exec(name)?.[1]?.replace(/^k$/, "kr");
|
|
832
|
-
}
|
|
833
|
-
function hanRegion(request, scripts) {
|
|
834
|
-
const language = request.language.toLowerCase();
|
|
835
|
-
if (/^ja(?:-|$)/.test(language)) return "jp";
|
|
836
|
-
if (/^ko(?:-|$)/.test(language)) return "kr";
|
|
837
|
-
if (/^zh(?:-|$)/.test(language)) return /hk|mo/.test(language) ? "hk" : /hant|tw/.test(language) ? "tc" : "sc";
|
|
838
|
-
for (const family of request.family.split(";")) {
|
|
839
|
-
const region = fontRegion(family);
|
|
840
|
-
if (region) return region;
|
|
841
|
-
}
|
|
842
|
-
const values = new Set(scripts);
|
|
843
|
-
if (values.has("Hiragana") || values.has("Katakana")) return "jp";
|
|
844
|
-
if (values.has("Hangul")) return "kr";
|
|
845
|
-
if (values.has("Bopomofo")) return "tc";
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Separate explicit aliases from generic fallback so script preferences cannot override user intent.
|
|
849
|
-
* @param request - VCL request.
|
|
850
|
-
* @param groups - Configured named and generic aliases.
|
|
851
|
-
* @param script - Current Unicode script.
|
|
852
|
-
* @param scripts - Other scripts in this same request.
|
|
853
|
-
* @param platform - Host OS owning the font catalog.
|
|
854
|
-
* @returns explicit names, ordered body candidates, regional preference and decorative policy.
|
|
855
|
-
*/
|
|
856
|
-
function fontPreferences(request, groups, script, scripts, platform = process.platform) {
|
|
857
|
-
const requested = request.family.split(";").map((value) => value.trim()).filter(Boolean);
|
|
858
|
-
const keys = requested.map(normalize);
|
|
859
|
-
const matched = groups.filter((group) => group.some((name) => keys.includes(normalize(name))));
|
|
860
|
-
const generic = request.pitch === 1 || keys.includes("monospace") ? "monospace" : keys.includes("serif") ? "serif" : matched.flat().map(normalize).find((name) => name === "serif" || name === "sansserif" || name === "monospace") ?? "sansserif";
|
|
861
|
-
const custom = groups.filter((group) => !DEFAULT_FONT_FALLBACKS.some((value) => JSON.stringify(value) === JSON.stringify(group)));
|
|
862
|
-
const explicit = [
|
|
863
|
-
...requested.filter((name) => !genericNames.has(normalize(name))),
|
|
864
|
-
...matched.filter((group) => !group.some((name) => genericNames.has(normalize(name)))).flat(),
|
|
865
|
-
...custom.filter((group) => group.some((name) => normalize(name) === generic || keys.includes(normalize(name)))).flat()
|
|
866
|
-
].filter((name) => !genericNames.has(normalize(name))).map(normalize);
|
|
867
|
-
const region = script === "Hangul" ? "kr" : script === "Hiragana" || script === "Katakana" ? "jp" : script === "Bopomofo" ? "tc" : script === "Han" ? hanRegion(request, scripts) : void 0;
|
|
868
|
-
const scriptKey = script === "Han" ? region === "sc" ? "simplified_han" : region === "tc" || region === "hk" ? "traditional_han" : region === "jp" ? "hiragana" : region === "kr" ? "hangul" : "han" : script === "Old_Turkic" ? "orkhon" : script.toLowerCase();
|
|
869
|
-
const legacy = fontFamilyPriority(requested, groups, request.pitch, script === "Common" && request.codePoints.some((point) => /\p{Symbol}/u.test(String.fromCodePoint(point))));
|
|
870
|
-
const config = FONTCONFIG_FONTS[generic === "sansserif" ? "sans-serif" : generic];
|
|
871
|
-
const windows = WINDOWS_FONTS[scriptKey] ?? [];
|
|
872
|
-
const candidates = script === "Latin" || script === "Greek" || script === "Cyrillic" || script === "Common" ? [
|
|
873
|
-
...legacy,
|
|
874
|
-
...config,
|
|
875
|
-
...windows
|
|
876
|
-
] : platform === "win32" && generic === "sansserif" ? [
|
|
877
|
-
...windows,
|
|
878
|
-
...config,
|
|
879
|
-
...legacy
|
|
880
|
-
] : [
|
|
881
|
-
...config,
|
|
882
|
-
...windows,
|
|
883
|
-
...legacy
|
|
884
|
-
];
|
|
885
|
-
return {
|
|
886
|
-
explicit: [...new Set(explicit)],
|
|
887
|
-
candidates: [...new Set(candidates.map(normalize))],
|
|
888
|
-
region,
|
|
889
|
-
penalizeDecorative: [
|
|
890
|
-
"Latin",
|
|
891
|
-
"Greek",
|
|
892
|
-
"Cyrillic",
|
|
893
|
-
"Hangul",
|
|
894
|
-
"Han",
|
|
895
|
-
"Hiragana",
|
|
896
|
-
"Katakana",
|
|
897
|
-
"Bopomofo"
|
|
898
|
-
].includes(script)
|
|
899
|
-
};
|
|
900
|
-
}
|
|
901
|
-
//#endregion
|
|
902
47
|
//#region lib/types/fonts.js
|
|
903
48
|
/** Host font metadata snapshots and conversion-local glyph matching over original files. */
|
|
904
|
-
const FONT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
49
|
+
const FONT_EXTENSIONS$1 = /* @__PURE__ */ new Set([
|
|
905
50
|
".ttf",
|
|
906
51
|
".otf",
|
|
907
52
|
".ttc",
|
|
@@ -950,6 +95,35 @@ function absent(error) {
|
|
|
950
95
|
"ENOTDIR"
|
|
951
96
|
].includes(String(error.code));
|
|
952
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Case- and separator-insensitive family key used to compare names across sources.
|
|
100
|
+
* @param value - Family, style, or postscript name as recorded by a document or font.
|
|
101
|
+
* @returns The normalized key.
|
|
102
|
+
*/
|
|
103
|
+
function normalize(value) {
|
|
104
|
+
return value.normalize("NFKC").toLowerCase().replaceAll(/[\s_-]/g, "");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Order named substitutions and their generic text family without excluding unlisted fonts.
|
|
108
|
+
* @param requested - Original family names, in document order.
|
|
109
|
+
* @param groups - Ordered family groups shared with Fontconfig aliases.
|
|
110
|
+
* @param pitch - VCL pitch; one requests a monospaced fallback.
|
|
111
|
+
* @param symbols - Whether symbol alternatives precede the generic fallback.
|
|
112
|
+
* @returns distinct family names, with original requests first.
|
|
113
|
+
*/
|
|
114
|
+
function fontFamilyPriority(requested, groups, pitch = 0, symbols = false) {
|
|
115
|
+
const original = requested.map(normalize);
|
|
116
|
+
const matched = groups.filter((group) => group.some((family) => original.includes(normalize(family))));
|
|
117
|
+
const generic = original.includes("monospace") || pitch === 1 ? "monospace" : original.includes("serif") ? "serif" : matched.flat().map(normalize).find((family) => family === "serif" || family === "sansserif" || family === "monospace") ?? "sansserif";
|
|
118
|
+
const families = [...requested, ...matched.flat()];
|
|
119
|
+
for (const kind of symbols ? ["symbol", generic] : [generic]) for (const group of groups) if (group.some((family) => normalize(family) === kind)) families.push(...group);
|
|
120
|
+
const priority = /* @__PURE__ */ new Map();
|
|
121
|
+
for (const family of families) {
|
|
122
|
+
const name = normalize(family);
|
|
123
|
+
if (!priority.has(name)) priority.set(name, family);
|
|
124
|
+
}
|
|
125
|
+
return [...priority.values()];
|
|
126
|
+
}
|
|
953
127
|
function fontPaths(directories, maxFiles) {
|
|
954
128
|
const pending = [...directories].reverse();
|
|
955
129
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -975,7 +149,7 @@ function fontPaths(directories, maxFiles) {
|
|
|
975
149
|
throw error;
|
|
976
150
|
}
|
|
977
151
|
pending.push(...names.sort().reverse().map((name) => join(canonical, name)));
|
|
978
|
-
} else if (status.isFile() && FONT_EXTENSIONS.has(extname(canonical).toLowerCase())) {
|
|
152
|
+
} else if (status.isFile() && FONT_EXTENSIONS$1.has(extname(canonical).toLowerCase())) {
|
|
979
153
|
if (paths.length >= maxFiles) throw new Error("The system font catalog exceeds maxFontFiles.");
|
|
980
154
|
paths.push(canonical);
|
|
981
155
|
}
|
|
@@ -1022,18 +196,16 @@ function covers(face, points) {
|
|
|
1022
196
|
return points.filter((point) => coverage.some(([first, last]) => point >= first && point <= last));
|
|
1023
197
|
}
|
|
1024
198
|
/**
|
|
1025
|
-
* VCL
|
|
199
|
+
* VCL weight, width, and fixed-pitch values for one parsed face.
|
|
1026
200
|
* @param font - The parsed physical face, whose `OS/2` and `post` tables may be absent.
|
|
1027
201
|
* @returns the recorded classes, or the regular defaults for an absent table.
|
|
1028
202
|
*/
|
|
1029
203
|
function faceMetrics(font) {
|
|
1030
204
|
const os2 = font["OS/2"];
|
|
1031
|
-
const familyClass = (os2?.sFamilyClass ?? 0) >>> 8;
|
|
1032
205
|
return {
|
|
1033
206
|
weight: os2 === void 0 ? 400 : os2.usWeightClass,
|
|
1034
207
|
width: os2 === void 0 ? 5 : os2.usWidthClass,
|
|
1035
|
-
fixed: Boolean(font.post?.isFixedPitch)
|
|
1036
|
-
decorative: [3, 4].includes(os2?.panose[0] ?? 0) || [9, 10].includes(familyClass)
|
|
208
|
+
fixed: Boolean(font.post?.isFixedPitch)
|
|
1037
209
|
};
|
|
1038
210
|
}
|
|
1039
211
|
function inspect(path, maxBytes) {
|
|
@@ -1097,33 +269,20 @@ function inspect(path, maxBytes) {
|
|
|
1097
269
|
}
|
|
1098
270
|
return faces;
|
|
1099
271
|
}
|
|
272
|
+
function regionalPriority(face, language) {
|
|
273
|
+
const locale = language.toLowerCase();
|
|
274
|
+
const preferred = locale.startsWith("ja") ? ["jp"] : locale.startsWith("ko") ? ["kr"] : locale.startsWith("zh") ? /hant|tw|hk|mo/.test(locale) ? ["tc", "hk"] : ["sc"] : [];
|
|
275
|
+
if (preferred.length === 0) return 0;
|
|
276
|
+
const region = `${face.family} ${face.postscriptName} ${basename(face.path)}`.toLowerCase().match(/(?:cjk|[\s_-])(sc|tc|jp|kr|hk)(?=[\s_.-]|$)/)?.[1];
|
|
277
|
+
return region === void 0 ? 1 : preferred.includes(region) ? 0 : 2;
|
|
278
|
+
}
|
|
1100
279
|
/**
|
|
1101
280
|
* Snapshot eligible local font metadata without retaining font bytes or decoding glyph coverage.
|
|
1102
281
|
* @param options - Host font roots and physical file limits.
|
|
1103
|
-
* @
|
|
1104
|
-
* @returns current metadata; changed and newly installed files are decoded again.
|
|
282
|
+
* @returns metadata reused for the converter lifetime; recreate it after changing installed fonts.
|
|
1105
283
|
*/
|
|
1106
|
-
function indexSystemFonts(options
|
|
1107
|
-
|
|
1108
|
-
for (const face of previous) {
|
|
1109
|
-
const group = reusable.get(face.path);
|
|
1110
|
-
if (group) group.push(face);
|
|
1111
|
-
else reusable.set(face.path, [face]);
|
|
1112
|
-
}
|
|
1113
|
-
return fontPaths([...options.directories, ...options.files ?? []], options.maxFiles).flatMap((path) => {
|
|
1114
|
-
const prior = reusable.get(path);
|
|
1115
|
-
if (prior !== void 0) {
|
|
1116
|
-
let current;
|
|
1117
|
-
try {
|
|
1118
|
-
current = statSync(path);
|
|
1119
|
-
} catch (error) {
|
|
1120
|
-
if (absent(error)) return [];
|
|
1121
|
-
throw error;
|
|
1122
|
-
}
|
|
1123
|
-
if (current.isFile() && current.size <= options.maxFileBytes && STAT_KEYS.every((key) => current[key] === prior[0][key])) return prior;
|
|
1124
|
-
}
|
|
1125
|
-
return inspect(path, options.maxFileBytes);
|
|
1126
|
-
});
|
|
284
|
+
function indexSystemFonts(options) {
|
|
285
|
+
return fontPaths(options.directories, options.maxFiles).flatMap((path) => inspect(path, options.maxFileBytes));
|
|
1127
286
|
}
|
|
1128
287
|
/** Conversion-local glyph coverage over the converter's first metadata snapshot. */
|
|
1129
288
|
var SystemFontCatalog = class {
|
|
@@ -1138,60 +297,49 @@ var SystemFontCatalog = class {
|
|
|
1138
297
|
}
|
|
1139
298
|
/**
|
|
1140
299
|
* Find installed faces covering the requested family or missing characters.
|
|
1141
|
-
* Exact families
|
|
1142
|
-
* then other glyph-covering faces.
|
|
1143
|
-
* body faces; normal cursive writing systems retain their typographic traditions.
|
|
300
|
+
* Exact families precede configured alternatives, symbol families for missing symbols,
|
|
301
|
+
* generic families, then other glyph-covering faces.
|
|
1144
302
|
* @param request - VCL family/style attributes and Unicode scalars missing from its current font.
|
|
1145
303
|
* @param signal - cancellation checked between synchronous font reads.
|
|
1146
|
-
* @returns selected files
|
|
304
|
+
* @returns selected physical files, deduplicated across collection faces; absent glyphs remain unresolved.
|
|
1147
305
|
* @throws if an indexed font changes or cannot be read during glyph matching.
|
|
1148
306
|
*/
|
|
1149
307
|
match(request, signal) {
|
|
1150
308
|
signal.throwIfAborted();
|
|
1151
|
-
const
|
|
309
|
+
const requested = request.family.split(";").map((family) => family.trim()).filter(Boolean);
|
|
310
|
+
const primary = requested[0];
|
|
1152
311
|
let missingFamily;
|
|
1153
312
|
if (primary !== void 0 && !GENERIC_FAMILIES.has(normalize(primary)) && !this.faces.some((face) => face.aliases.includes(normalize(primary)))) missingFamily = primary;
|
|
1154
|
-
const
|
|
1155
|
-
|
|
313
|
+
const priority = fontFamilyPriority(requested, this.options.fallbackFamilies, request.pitch, request.codePoints.some((point) => /\p{Symbol}/u.test(String.fromCodePoint(point)))).map(normalize);
|
|
314
|
+
const missing = new Set(request.codePoints);
|
|
315
|
+
const ranked = this.faces.map((face) => {
|
|
316
|
+
const rank = priority.findIndex((family) => face.aliases.includes(family));
|
|
317
|
+
const region = regionalPriority(face, request.language);
|
|
318
|
+
const style = (request.style && normalize(request.style) === normalize(face.style) ? -1 : 0) + (request.italic === 3 || request.italic !== 0 === face.italic ? 0 : 100) + (request.pitch === 0 || request.pitch === 1 === face.fixed ? 0 : 50) + Math.abs((VCL_WEIGHTS[request.weight] ?? 400) - face.weight) / 100 + (request.width === 0 ? 0 : Math.abs(request.width - face.width));
|
|
319
|
+
return {
|
|
320
|
+
face,
|
|
321
|
+
rank: rank < 0 ? priority.length : rank,
|
|
322
|
+
region,
|
|
323
|
+
style
|
|
324
|
+
};
|
|
325
|
+
}).sort((left, right) => left.rank - right.rank || left.region - right.region || left.style - right.style || left.face.path.localeCompare(right.face.path, "en") || left.face.faceIndex - right.face.faceIndex);
|
|
1156
326
|
const selected = [];
|
|
1157
327
|
const files = /* @__PURE__ */ new Set();
|
|
1158
|
-
const
|
|
1159
|
-
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
const region = fontRegion(face.family);
|
|
1166
|
-
const locale = preference.region === void 0 ? 0 : region === preference.region || preference.region === "hk" && region === "tc" ? 0 : region === void 0 ? 1 : 2;
|
|
1167
|
-
const style = (request.style && normalize(request.style) === normalize(face.style) ? -1 : 0) + (request.italic === 3 || request.italic !== 0 === face.italic ? 0 : 100) + (request.pitch === 0 || request.pitch === 1 === face.fixed ? 0 : 50) + Math.abs((VCL_WEIGHTS[request.weight] ?? 400) - face.weight) / 100 + (request.width === 0 ? 0 : Math.abs(request.width - face.width));
|
|
1168
|
-
return {
|
|
1169
|
-
face,
|
|
1170
|
-
explicit: explicit < 0 ? preference.explicit.length : explicit,
|
|
1171
|
-
region: explicit < 0 ? locale : 0,
|
|
1172
|
-
rank: explicit < 0 ? rank < 0 ? preference.candidates.length : rank : 0,
|
|
1173
|
-
decorative: explicit < 0 && preference.penalizeDecorative && face.decorative ? 1 : 0,
|
|
1174
|
-
style
|
|
1175
|
-
};
|
|
1176
|
-
}).sort((a, b) => a.explicit - b.explicit || a.region - b.region || a.rank - b.rank || a.decorative - b.decorative || a.style - b.style || a.face.path.localeCompare(b.face.path, "en") || a.face.faceIndex - b.face.faceIndex);
|
|
1177
|
-
for (const { face } of ranked) {
|
|
1178
|
-
signal.throwIfAborted();
|
|
1179
|
-
const covered = covers(face, [...missing]);
|
|
1180
|
-
if (missing.size > 0 && covered.length === 0) continue;
|
|
1181
|
-
const identity = this.options.deduplicateBy === "face" ? `${face.path}#${face.faceIndex}` : face.path;
|
|
1182
|
-
if (!files.has(identity)) {
|
|
1183
|
-
selected.push(face);
|
|
1184
|
-
files.add(identity);
|
|
1185
|
-
}
|
|
1186
|
-
for (const point of covered) missing.delete(point);
|
|
1187
|
-
if (missing.size === 0) break;
|
|
328
|
+
for (const { face } of ranked) {
|
|
329
|
+
signal.throwIfAborted();
|
|
330
|
+
const covered = covers(face, [...missing]);
|
|
331
|
+
if (missing.size > 0 && covered.length === 0) continue;
|
|
332
|
+
if (!files.has(face.path)) {
|
|
333
|
+
selected.push(face);
|
|
334
|
+
files.add(face.path);
|
|
1188
335
|
}
|
|
1189
|
-
|
|
336
|
+
for (const point of covered) missing.delete(point);
|
|
337
|
+
if (missing.size === 0) break;
|
|
1190
338
|
}
|
|
1191
339
|
return {
|
|
1192
340
|
fonts: selected,
|
|
1193
341
|
...missingFamily === void 0 ? {} : { missingFamily },
|
|
1194
|
-
...
|
|
342
|
+
...missing.size === 0 ? {} : { unresolvedCodePoints: [...missing] }
|
|
1195
343
|
};
|
|
1196
344
|
}
|
|
1197
345
|
};
|
|
@@ -1220,20 +368,216 @@ function readFont(face) {
|
|
|
1220
368
|
}
|
|
1221
369
|
}
|
|
1222
370
|
//#endregion
|
|
371
|
+
//#region lib/types/ooxml.js
|
|
372
|
+
/** Bounded OOXML inspection and declared font diagnostics, using maintained ZIP/XML parsers. */
|
|
373
|
+
const MAIN_PARTS = {
|
|
374
|
+
odt: ["content.xml", "application/vnd.oasis.opendocument.text"],
|
|
375
|
+
ods: ["content.xml", "application/vnd.oasis.opendocument.spreadsheet"],
|
|
376
|
+
odp: ["content.xml", "application/vnd.oasis.opendocument.presentation"],
|
|
377
|
+
docx: ["word/document.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"],
|
|
378
|
+
xlsx: ["xl/workbook.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"],
|
|
379
|
+
pptx: ["ppt/presentation.xml", "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"]
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* @param character - One code point as yielded by iteration over a string.
|
|
383
|
+
* @returns the Unicode scalar the character encodes; iteration never yields an empty string.
|
|
384
|
+
*/
|
|
385
|
+
function codePointOf(character) {
|
|
386
|
+
return character.codePointAt(0);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Validate ZIP size and membership before decoding selected document XML.
|
|
390
|
+
* @param bytes - Complete source document bytes.
|
|
391
|
+
* @param extension - Input extension, which selects the main document part.
|
|
392
|
+
* @param limits - Archive entry and declared uncompressed byte limits.
|
|
393
|
+
* @returns declared font families and the scalar values readable document XML declares.
|
|
394
|
+
* @throws ConversionError when the extension is unsupported or the archive violates its limits.
|
|
395
|
+
*/
|
|
396
|
+
function inspectDocument$1(bytes, extension, limits) {
|
|
397
|
+
const main = MAIN_PARTS[extension];
|
|
398
|
+
if (!main) throw new ConversionError("unsupported-format", "Input extension must be docx, xlsx, or pptx.");
|
|
399
|
+
const odf = [
|
|
400
|
+
"odt",
|
|
401
|
+
"ods",
|
|
402
|
+
"odp"
|
|
403
|
+
].includes(extension);
|
|
404
|
+
const names = /* @__PURE__ */ new Set();
|
|
405
|
+
let total = 0;
|
|
406
|
+
let files;
|
|
407
|
+
try {
|
|
408
|
+
files = unzipSync(bytes, { filter(entry) {
|
|
409
|
+
total += entry.originalSize;
|
|
410
|
+
if (names.has(entry.name) || names.size >= limits.maxArchiveEntries || !Number.isSafeInteger(total) || total > limits.maxUncompressedBytes) throw new Error("OOXML archive exceeds its limits or repeats an entry.");
|
|
411
|
+
names.add(entry.name);
|
|
412
|
+
if (odf) return [
|
|
413
|
+
"mimetype",
|
|
414
|
+
"content.xml",
|
|
415
|
+
"styles.xml",
|
|
416
|
+
"META-INF/manifest.xml"
|
|
417
|
+
].includes(entry.name);
|
|
418
|
+
return entry.name === "[Content_Types].xml" || /^(word|xl|ppt)\/.*\.xml$/.test(entry.name) && !entry.name.endsWith("/fontTable.xml") && !entry.name.includes("/theme/");
|
|
419
|
+
} });
|
|
420
|
+
} catch (cause) {
|
|
421
|
+
throw new ConversionError("invalid-document", "Input is not a supported, bounded OOXML archive.", { cause });
|
|
422
|
+
}
|
|
423
|
+
const contentTypes = files["[Content_Types].xml"];
|
|
424
|
+
if (odf ? !names.has("content.xml") || !names.has("META-INF/manifest.xml") || strFromU8(files.mimetype ?? /* @__PURE__ */ new Uint8Array()) !== main[1] : !names.has("_rels/.rels") || !names.has(main[0]) || contentTypes === void 0 || !strFromU8(contentTypes).includes(main[1])) throw new ConversionError("invalid-document", `Input does not contain a ${extension} document.`);
|
|
425
|
+
const families = /* @__PURE__ */ new Map();
|
|
426
|
+
const codePoints = /* @__PURE__ */ new Set();
|
|
427
|
+
for (const [name, data] of Object.entries(files)) {
|
|
428
|
+
if (name === "[Content_Types].xml" || name === "mimetype" || name === "META-INF/manifest.xml") continue;
|
|
429
|
+
const partFamilies = [];
|
|
430
|
+
const partPoints = /* @__PURE__ */ new Set();
|
|
431
|
+
const parser = new SaxesParser({ xmlns: true });
|
|
432
|
+
parser.on("opentag", (tag) => {
|
|
433
|
+
const word = /wordprocessingml\/(?:2006\/)?main$/.test(tag.uri) && tag.local === "rFonts";
|
|
434
|
+
const drawing = /drawingml\/(?:2006\/)?main$/.test(tag.uri);
|
|
435
|
+
const sheet = /spreadsheetml\/(?:2006\/)?main$/.test(tag.uri) && tag.local === "name";
|
|
436
|
+
for (const attribute of Object.values(tag.attributes)) {
|
|
437
|
+
if (odf && attribute.local === "font-family") partFamilies.push(attribute.value.replace(/^['"]|['"]$/g, ""));
|
|
438
|
+
if (word && [
|
|
439
|
+
"ascii",
|
|
440
|
+
"hAnsi",
|
|
441
|
+
"eastAsia",
|
|
442
|
+
"cs"
|
|
443
|
+
].includes(attribute.local) || drawing && attribute.local === "typeface" || sheet && attribute.local === "val") partFamilies.push(attribute.value);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
parser.on("text", (text) => {
|
|
447
|
+
for (const char of text) if (!/\s/u.test(char)) partPoints.add(codePointOf(char));
|
|
448
|
+
});
|
|
449
|
+
const encoding = data[0] === 255 && data[1] === 254 ? "utf-16le" : data[0] === 254 && data[1] === 255 ? "utf-16be" : "utf-8";
|
|
450
|
+
try {
|
|
451
|
+
parser.write(new TextDecoder(encoding).decode(data)).close();
|
|
452
|
+
} catch {
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
for (const declared of partFamilies) for (const family of declared.split(";").map((value) => value.trim()).filter((value) => value && !/^\+(?:mj|mn)-(?:lt|ea|cs)$/.test(value))) families.set(normalize(family), family);
|
|
456
|
+
for (const point of partPoints) codePoints.add(point);
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
families,
|
|
460
|
+
codePoints: [...codePoints]
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region lib/types/document.js
|
|
465
|
+
/** Select bounded OOXML inspection or a legacy Office compound-file import. */
|
|
466
|
+
/** Input suffixes accepted by the public converter. */
|
|
467
|
+
const DOCUMENT_EXTENSIONS = [
|
|
468
|
+
"doc",
|
|
469
|
+
"docx",
|
|
470
|
+
"odt",
|
|
471
|
+
"xls",
|
|
472
|
+
"xlsx",
|
|
473
|
+
"ods",
|
|
474
|
+
"ppt",
|
|
475
|
+
"pptx",
|
|
476
|
+
"odp"
|
|
477
|
+
];
|
|
478
|
+
const COMPOUND_SIGNATURE = [
|
|
479
|
+
208,
|
|
480
|
+
207,
|
|
481
|
+
17,
|
|
482
|
+
224,
|
|
483
|
+
161,
|
|
484
|
+
177,
|
|
485
|
+
26,
|
|
486
|
+
225
|
|
487
|
+
];
|
|
488
|
+
/**
|
|
489
|
+
* Inspect the input container before invoking LibreOffice's document importer.
|
|
490
|
+
* Compound-file streams and legacy font tables are interpreted by LibreOffice;
|
|
491
|
+
* they do not supply the API's OOXML font diagnostics.
|
|
492
|
+
* @param bytes - Source bytes already bounded by maxInputBytes.
|
|
493
|
+
* @param extension - Lowercase source suffix.
|
|
494
|
+
* @param limits - Limits applied to ZIP-based document contents.
|
|
495
|
+
* @returns OOXML font metadata, or empty diagnostics for a binary document.
|
|
496
|
+
*/
|
|
497
|
+
function inspectDocument(bytes, extension, limits) {
|
|
498
|
+
if (!DOCUMENT_EXTENSIONS.includes(extension)) throw new ConversionError("unsupported-format", `Input extension must be ${DOCUMENT_EXTENSIONS.join(", ")}.`);
|
|
499
|
+
if ([
|
|
500
|
+
"docx",
|
|
501
|
+
"xlsx",
|
|
502
|
+
"pptx",
|
|
503
|
+
"odt",
|
|
504
|
+
"ods",
|
|
505
|
+
"odp"
|
|
506
|
+
].includes(extension)) return inspectDocument$1(bytes, extension, limits);
|
|
507
|
+
if (bytes.length < 512 || !COMPOUND_SIGNATURE.every((value, index) => bytes[index] === value)) throw new ConversionError("invalid-document", "Legacy Office input must contain an OLE compound document.");
|
|
508
|
+
const header = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
509
|
+
const version = header.getUint16(26, true);
|
|
510
|
+
const sectorShift = header.getUint16(30, true);
|
|
511
|
+
if (header.getUint16(28, true) !== 65534 || header.getUint16(32, true) !== 6 || !(version === 3 && sectorShift === 9 || version === 4 && sectorShift === 12) || bytes.length < 2 ** sectorShift * 2 || bytes.length % 2 ** sectorShift !== 0) throw new ConversionError("invalid-document", "Legacy Office input has an invalid or truncated compound-file header.");
|
|
512
|
+
return {
|
|
513
|
+
families: /* @__PURE__ */ new Map(),
|
|
514
|
+
codePoints: []
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
//#endregion
|
|
1223
518
|
//#region lib/types/font-loader.js
|
|
1224
|
-
/** Conversion-local font imports
|
|
1225
|
-
|
|
1226
|
-
|
|
519
|
+
/** Conversion-local font imports backed by a factory-lifetime match cache. */
|
|
520
|
+
const faceKey = (face) => `${face.path}\0${face.faceIndex}`;
|
|
521
|
+
const requestKey = ({ codePoints: _codePoints, ...request }) => JSON.stringify(request);
|
|
522
|
+
/** Build one operation's loader over a factory-owned immutable font snapshot. */
|
|
523
|
+
function createFontLoader(options, document, install, faces, cache = []) {
|
|
1227
524
|
const catalog = new SystemFontCatalog({
|
|
1228
525
|
faces,
|
|
1229
526
|
fallbackFamilies: options.fontFallbacks
|
|
1230
527
|
});
|
|
528
|
+
const byFace = new Map(faces.map((face) => [faceKey(face), face]));
|
|
529
|
+
const matches = /* @__PURE__ */ new Map();
|
|
530
|
+
for (const entry of cache.slice(-options.maxFontResolutionEntries)) matches.set(entry.key, {
|
|
531
|
+
...entry,
|
|
532
|
+
codePoints: [...entry.codePoints],
|
|
533
|
+
faces: entry.faces.map((face) => ({ ...face }))
|
|
534
|
+
});
|
|
1231
535
|
const loaded = /* @__PURE__ */ new Map();
|
|
1232
536
|
const resolved = /* @__PURE__ */ new Map();
|
|
1233
537
|
const missing = /* @__PURE__ */ new Map();
|
|
1234
538
|
const substitutions = /* @__PURE__ */ new Map();
|
|
1235
539
|
const signal = new AbortController().signal;
|
|
1236
540
|
let bytes = 0;
|
|
541
|
+
function retain(entry) {
|
|
542
|
+
matches.delete(entry.key);
|
|
543
|
+
matches.set(entry.key, entry);
|
|
544
|
+
while (matches.size > options.maxFontResolutionEntries) matches.delete(matches.keys().next().value);
|
|
545
|
+
}
|
|
546
|
+
function cachedMatch(request) {
|
|
547
|
+
const key = requestKey(request);
|
|
548
|
+
const points = [...new Set(request.codePoints)].sort((left, right) => left - right);
|
|
549
|
+
const prior = matches.get(key);
|
|
550
|
+
if (prior && (points.length === 0 && prior.emptyRequest || points.every((point) => prior.codePoints.includes(point)))) {
|
|
551
|
+
retain(prior);
|
|
552
|
+
return {
|
|
553
|
+
fonts: prior.faces.map((reference) => byFace.get(faceKey(reference))).filter((face) => face !== void 0),
|
|
554
|
+
...prior.missingFamily === void 0 ? {} : { missingFamily: prior.missingFamily }
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
const unknown = prior === void 0 ? points : points.filter((point) => !prior.codePoints.includes(point));
|
|
558
|
+
const current = catalog.match({
|
|
559
|
+
...request,
|
|
560
|
+
codePoints: points.length === 0 ? [] : unknown
|
|
561
|
+
}, signal);
|
|
562
|
+
const references = new Map((prior?.faces ?? []).map((face) => [faceKey(face), face]));
|
|
563
|
+
for (const face of current.fonts) references.set(faceKey(face), {
|
|
564
|
+
path: face.path,
|
|
565
|
+
faceIndex: face.faceIndex
|
|
566
|
+
});
|
|
567
|
+
const missingFamily = prior?.missingFamily ?? current.missingFamily;
|
|
568
|
+
const entry = {
|
|
569
|
+
key,
|
|
570
|
+
codePoints: [.../* @__PURE__ */ new Set([...prior?.codePoints ?? [], ...points])].sort((left, right) => left - right),
|
|
571
|
+
emptyRequest: prior?.emptyRequest === true || points.length === 0,
|
|
572
|
+
faces: [...references.values()],
|
|
573
|
+
...missingFamily === void 0 ? {} : { missingFamily }
|
|
574
|
+
};
|
|
575
|
+
retain(entry);
|
|
576
|
+
return {
|
|
577
|
+
fonts: entry.faces.map((reference) => byFace.get(faceKey(reference))).filter((face) => face !== void 0),
|
|
578
|
+
...entry.missingFamily === void 0 ? {} : { missingFamily: entry.missingFamily }
|
|
579
|
+
};
|
|
580
|
+
}
|
|
1237
581
|
return {
|
|
1238
582
|
get missingFonts() {
|
|
1239
583
|
return [...missing.values()];
|
|
@@ -1244,11 +588,14 @@ function createFontLoader(options, document, install, faces) {
|
|
|
1244
588
|
get files() {
|
|
1245
589
|
return [...loaded.values()];
|
|
1246
590
|
},
|
|
591
|
+
get cacheEntries() {
|
|
592
|
+
return [...matches.values()];
|
|
593
|
+
},
|
|
1247
594
|
resolve(request) {
|
|
1248
595
|
const key = JSON.stringify(request);
|
|
1249
596
|
const cached = resolved.get(key);
|
|
1250
597
|
if (cached) return cached;
|
|
1251
|
-
const match =
|
|
598
|
+
const match = cachedMatch(request);
|
|
1252
599
|
if (match.missingFamily && document.families.has(normalize(match.missingFamily))) {
|
|
1253
600
|
const family = normalize(match.missingFamily);
|
|
1254
601
|
missing.set(family, match.missingFamily);
|
|
@@ -1289,6 +636,98 @@ function preloadFonts(loader, options, document, native = false) {
|
|
|
1289
636
|
codePoints: native ? document.codePoints : []
|
|
1290
637
|
});
|
|
1291
638
|
}
|
|
639
|
+
/** Fontconfig XML restricts WASM discovery to imported originals in MEMFS. */
|
|
640
|
+
function memoryFontConfig(families, requested = []) {
|
|
641
|
+
const escape = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
642
|
+
return `<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"><fontconfig><dir>/dsh-fonts</dir><cachedir>/dsh/font-cache</cachedir>${[...new Map([...families.flatMap((group) => group.slice(0, 1)), ...requested].map((name) => [normalize(name), name])).values()].map((name) => {
|
|
643
|
+
const alternatives = fontFamilyPriority([name], families).filter((family) => normalize(family) !== normalize(name));
|
|
644
|
+
return `<alias><family>${escape(name)}</family><accept>${alternatives.map((family) => `<family>${escape(family)}</family>`).join("")}</accept></alias>`;
|
|
645
|
+
}).join("")}</fontconfig>`;
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region lib/types/office-fonts.js
|
|
649
|
+
/** Curated fonts discovered from a user's Microsoft Office installation. */
|
|
650
|
+
const FONT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
651
|
+
".ttf",
|
|
652
|
+
".otf",
|
|
653
|
+
".ttc",
|
|
654
|
+
".otc",
|
|
655
|
+
".dfont"
|
|
656
|
+
]);
|
|
657
|
+
const OFFICE_FONT_FILE = /^(?:aptos(?:[- ].*)?|arial(?:bd|bi|i)?|calibri(?:b|i|z|l|li)?|cambria(?:b|i|z)?|cour(?:bd|bi|i)?|deng(?:b|l)?|fangsong|kaiti|msjh(?:bd)?|msyh(?:bd|l)?|segoeui(?:b|i|z|l|li|sb|sbi|sl|sli)?|simhei|simsunb?|symbol|times(?:bd|bi|i)?|wingdings(?: [23])?|wingdng[23])\.(?:ttf|otf|ttc|otc)$/iu;
|
|
658
|
+
const FAMILIES = new Set([
|
|
659
|
+
"aptos",
|
|
660
|
+
"aptos display",
|
|
661
|
+
"aptos narrow",
|
|
662
|
+
"arial",
|
|
663
|
+
"calibri",
|
|
664
|
+
"calibri light",
|
|
665
|
+
"cambria",
|
|
666
|
+
"cambria math",
|
|
667
|
+
"courier new",
|
|
668
|
+
"dengxian",
|
|
669
|
+
"fangsong",
|
|
670
|
+
"kaiti",
|
|
671
|
+
"microsoft jhenghei",
|
|
672
|
+
"microsoft jhenghei ui",
|
|
673
|
+
"microsoft yahei",
|
|
674
|
+
"microsoft yahei ui",
|
|
675
|
+
"nsimsun",
|
|
676
|
+
"segoe ui",
|
|
677
|
+
"simhei",
|
|
678
|
+
"simsun",
|
|
679
|
+
"symbol",
|
|
680
|
+
"times new roman",
|
|
681
|
+
"wingdings",
|
|
682
|
+
"wingdings 2",
|
|
683
|
+
"wingdings 3"
|
|
684
|
+
].map(normalize));
|
|
685
|
+
/** @returns whether parsed font names belong to the curated Office compatibility set. */
|
|
686
|
+
function officeFontFace(face) {
|
|
687
|
+
return face.aliases.some((alias) => FAMILIES.has(alias));
|
|
688
|
+
}
|
|
689
|
+
function directory(path) {
|
|
690
|
+
try {
|
|
691
|
+
return statSync(path).isDirectory();
|
|
692
|
+
} catch (error) {
|
|
693
|
+
if (absent(error)) return false;
|
|
694
|
+
throw error;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
function files(root, recursive, namesOnly = true) {
|
|
698
|
+
const pending = [root], result = [];
|
|
699
|
+
for (let current = pending.pop(); current !== void 0; current = pending.pop()) {
|
|
700
|
+
let entries;
|
|
701
|
+
try {
|
|
702
|
+
entries = readdirSync(current, { withFileTypes: true });
|
|
703
|
+
} catch (error) {
|
|
704
|
+
/* v8 ignore next -- Optional Office cache disappearance is also covered by system-font absence handling. */
|
|
705
|
+
if (absent(error)) continue;
|
|
706
|
+
throw error;
|
|
707
|
+
}
|
|
708
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name, "en"))) if (entry.isDirectory()) {
|
|
709
|
+
if (recursive && entry.name !== "PreviewFont") pending.push(join(current, entry.name));
|
|
710
|
+
} else if (entry.isFile() && FONT_EXTENSIONS.has(extname(entry.name).toLowerCase()) && (!namesOnly || OFFICE_FONT_FILE.test(entry.name))) result.push(join(current, entry.name));
|
|
711
|
+
}
|
|
712
|
+
return result;
|
|
713
|
+
}
|
|
714
|
+
/** Find compatibility font files without exposing their paths outside the font Worker. */
|
|
715
|
+
function officeFontFiles(platform = process.platform, home = homedir(), env = process.env, applicationRoots = ["/Applications", posix.join(home, "Applications")]) {
|
|
716
|
+
const bundled = platform === "darwin" ? [
|
|
717
|
+
"Microsoft Word",
|
|
718
|
+
"Microsoft Excel",
|
|
719
|
+
"Microsoft PowerPoint"
|
|
720
|
+
].flatMap((app) => applicationRoots.map((root) => posix.join(root, `${app}.app/Contents/Resources/DFonts`))).find(directory) : platform === "win32" ? [env.ProgramFiles, env["ProgramFiles(x86)"]].filter((root) => Boolean(root)).map((root) => win32.join(root, "Microsoft Office", "root", "vfs", "Fonts", "private")).find(directory) : void 0;
|
|
721
|
+
const cloud = platform === "darwin" ? posix.join(home, "Library/Group Containers/UBF8T346G9.Office/FontCache") : platform === "win32" ? win32.join(env.LOCALAPPDATA ?? win32.join(home, "AppData", "Local"), "Microsoft", "FontCache") : void 0;
|
|
722
|
+
const ordered = [...bundled === void 0 ? [] : files(bundled, false).sort(), ...cloud === void 0 ? [] : files(cloud, true, false).sort((a, b) => b.localeCompare(a, "en", { numeric: true }))];
|
|
723
|
+
const unique = /* @__PURE__ */ new Map();
|
|
724
|
+
for (const file of ordered) {
|
|
725
|
+
const portable = file.replaceAll("\\", "/");
|
|
726
|
+
const name = portable.slice(portable.lastIndexOf("/") + 1).toLowerCase();
|
|
727
|
+
if (!unique.has(name)) unique.set(name, file);
|
|
728
|
+
}
|
|
729
|
+
return [...unique.values()];
|
|
730
|
+
}
|
|
1292
731
|
//#endregion
|
|
1293
732
|
//#region lib/types/font-full.js
|
|
1294
733
|
/** Whole fonts for engines such as PDFium that perform their own glyph mapping. */
|
|
@@ -1304,6 +743,7 @@ function fullFontFile(face) {
|
|
|
1304
743
|
const original = readFont(face);
|
|
1305
744
|
const sourceHash = createHash("sha256").update(original).digest("hex");
|
|
1306
745
|
let bytes = original;
|
|
746
|
+
/* v8 ignore next -- Apple dfont resource extraction is exercised by matching-host font qualification. */
|
|
1307
747
|
if (extname(face.path).toLowerCase() === ".dfont") bytes = indexedFace(create(original), face).stream.buffer;
|
|
1308
748
|
return {
|
|
1309
749
|
bytes,
|
|
@@ -1339,6 +779,7 @@ function preloadPdfFonts(options, faces, install) {
|
|
|
1339
779
|
codePoints: []
|
|
1340
780
|
}, new AbortController().signal);
|
|
1341
781
|
for (const face of result.fonts) {
|
|
782
|
+
/* v8 ignore next -- Apple dfont face identity is covered by matching-host font qualification. */
|
|
1342
783
|
const physical = `${face.path}#${extname(face.path).toLowerCase() === ".dfont" ? face.faceIndex : ""}`;
|
|
1343
784
|
if (files.has(physical)) continue;
|
|
1344
785
|
files.add(physical);
|
|
@@ -1462,7 +903,7 @@ async function withWasmSession(request, use) {
|
|
|
1462
903
|
const path = `/dsh-fonts/${name}`;
|
|
1463
904
|
loadedModule.FS.writeFile(path, bytes);
|
|
1464
905
|
return path;
|
|
1465
|
-
}, faces);
|
|
906
|
+
}, faces, request.fontCache);
|
|
1466
907
|
if (pdf) {
|
|
1467
908
|
loadedModule.FS.mkdirTree("/usr/share/fonts/dsh-pdfium");
|
|
1468
909
|
preloadPdfFonts(options, faces, (name, bytes) => loadedModule.FS.writeFile(`/usr/share/fonts/dsh-pdfium/${name}`, bytes));
|
|
@@ -1509,7 +950,7 @@ async function withWasmSession(request, use) {
|
|
|
1509
950
|
]);
|
|
1510
951
|
if (!document) throw engineError(instance, office);
|
|
1511
952
|
}
|
|
1512
|
-
|
|
953
|
+
const result = await use({
|
|
1513
954
|
module: instance,
|
|
1514
955
|
office,
|
|
1515
956
|
document,
|
|
@@ -1541,6 +982,8 @@ async function withWasmSession(request, use) {
|
|
|
1541
982
|
}
|
|
1542
983
|
}
|
|
1543
984
|
});
|
|
985
|
+
request.onFontCache?.(requiredFontLoader(fontLoader).cacheEntries);
|
|
986
|
+
return result;
|
|
1544
987
|
} catch (error) {
|
|
1545
988
|
fatal ||= error instanceof WebAssembly.RuntimeError;
|
|
1546
989
|
failure = error;
|
|
@@ -1572,7 +1015,11 @@ async function withWasmSession(request, use) {
|
|
|
1572
1015
|
async function convertWithWasm(request) {
|
|
1573
1016
|
return withWasmSession(request, (session) => {
|
|
1574
1017
|
const { module, office, document } = session;
|
|
1575
|
-
const {
|
|
1018
|
+
const { options } = request;
|
|
1019
|
+
const operation = request.operation ?? {
|
|
1020
|
+
format: "pdf",
|
|
1021
|
+
recalculate: false
|
|
1022
|
+
};
|
|
1576
1023
|
const output = `/dsh/output.${operation.format}`;
|
|
1577
1024
|
const filterOptions = operation.format === "pdf" ? JSON.stringify({
|
|
1578
1025
|
ExportBookmarks: {
|
|
@@ -2165,8 +1612,26 @@ function requireParentPort(port) {
|
|
|
2165
1612
|
return port;
|
|
2166
1613
|
}
|
|
2167
1614
|
const port = requireParentPort(parentPort);
|
|
1615
|
+
function indexFonts(options) {
|
|
1616
|
+
const primary = indexSystemFonts({
|
|
1617
|
+
directories: options.fontDirectories,
|
|
1618
|
+
maxFiles: options.maxFontFiles,
|
|
1619
|
+
maxFileBytes: options.maxFontFileBytes
|
|
1620
|
+
});
|
|
1621
|
+
if (!options.includeOfficeFonts) return primary;
|
|
1622
|
+
const primaryFiles = new Set(primary.map((face) => face.path));
|
|
1623
|
+
const remaining = Math.max(0, options.maxFontFiles - primaryFiles.size);
|
|
1624
|
+
if (remaining === 0) return primary;
|
|
1625
|
+
const supplemental = indexSystemFonts({
|
|
1626
|
+
directories: officeFontFiles().slice(0, remaining),
|
|
1627
|
+
maxFiles: remaining,
|
|
1628
|
+
maxFileBytes: options.maxFontFileBytes
|
|
1629
|
+
});
|
|
1630
|
+
const aliases = new Set(primary.flatMap((face) => face.aliases));
|
|
1631
|
+
return [...primary, ...supplemental.filter((face) => officeFontFace(face) && !face.aliases.some((alias) => aliases.has(alias)))];
|
|
1632
|
+
}
|
|
2168
1633
|
try {
|
|
2169
|
-
const { inputPath, extension, operation, options, engine, scratch, fontFaces } = workerData;
|
|
1634
|
+
const { inputPath, extension, operation, options, engine, scratch, fontFaces, fontCache } = workerData;
|
|
2170
1635
|
const bytes = readFileSync(inputPath);
|
|
2171
1636
|
const images = "kind" in operation && operation.kind === "images";
|
|
2172
1637
|
if (images && extension === "pdf" && new TextDecoder().decode(bytes.subarray(0, 5)) !== "%PDF-") throw new ConversionError("invalid-document", "Input does not contain a PDF header.");
|
|
@@ -2174,19 +1639,15 @@ try {
|
|
|
2174
1639
|
families: /* @__PURE__ */ new Map(),
|
|
2175
1640
|
codePoints: []
|
|
2176
1641
|
} : inspectDocument(bytes, extension, options);
|
|
2177
|
-
const faces = fontFaces ??
|
|
2178
|
-
directories: options.fontDirectories,
|
|
2179
|
-
maxFiles: options.maxFontFiles,
|
|
2180
|
-
maxFileBytes: options.maxFontFileBytes
|
|
2181
|
-
});
|
|
1642
|
+
const faces = fontFaces ?? indexFonts(options);
|
|
2182
1643
|
if (!fontFaces) port.postMessage({
|
|
2183
1644
|
kind: "fonts",
|
|
2184
1645
|
faces
|
|
2185
1646
|
});
|
|
2186
|
-
if (images && engine.backend !== "wasm") throw new ConversionError("unavailable", "Direct image rendering requires the installed WASM engine.");
|
|
2187
1647
|
if (engine.backend === "wasm") {
|
|
2188
1648
|
if (faces.length === 0 && extension !== "pdf") throw new ConversionError("unavailable", "No usable fonts were found. Install fonts or configure fontDirectories before converting documents.");
|
|
2189
1649
|
if (images) {
|
|
1650
|
+
let cacheEntries = [];
|
|
2190
1651
|
const result = await renderImagesWithWasm({
|
|
2191
1652
|
engine,
|
|
2192
1653
|
bytes,
|
|
@@ -2194,7 +1655,15 @@ try {
|
|
|
2194
1655
|
operation,
|
|
2195
1656
|
options,
|
|
2196
1657
|
document,
|
|
2197
|
-
faces
|
|
1658
|
+
faces,
|
|
1659
|
+
...fontCache === void 0 ? {} : { fontCache },
|
|
1660
|
+
onFontCache: (entries) => {
|
|
1661
|
+
cacheEntries = entries;
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
port.postMessage({
|
|
1665
|
+
kind: "font-cache",
|
|
1666
|
+
entries: cacheEntries
|
|
2198
1667
|
});
|
|
2199
1668
|
port.postMessage({
|
|
2200
1669
|
ok: true,
|
|
@@ -2208,7 +1677,12 @@ try {
|
|
|
2208
1677
|
operation,
|
|
2209
1678
|
options,
|
|
2210
1679
|
document,
|
|
2211
|
-
faces
|
|
1680
|
+
faces,
|
|
1681
|
+
...fontCache === void 0 ? {} : { fontCache },
|
|
1682
|
+
onFontCache: (entries) => port.postMessage({
|
|
1683
|
+
kind: "font-cache",
|
|
1684
|
+
entries
|
|
1685
|
+
})
|
|
2212
1686
|
});
|
|
2213
1687
|
port.postMessage({
|
|
2214
1688
|
ok: true,
|
|
@@ -2225,8 +1699,12 @@ try {
|
|
|
2225
1699
|
mode: 384
|
|
2226
1700
|
});
|
|
2227
1701
|
return path;
|
|
2228
|
-
}, faces);
|
|
1702
|
+
}, faces, fontCache);
|
|
2229
1703
|
preloadFonts(fonts, options, document, true);
|
|
1704
|
+
port.postMessage({
|
|
1705
|
+
kind: "font-cache",
|
|
1706
|
+
entries: fonts.cacheEntries
|
|
1707
|
+
});
|
|
2230
1708
|
port.postMessage({
|
|
2231
1709
|
ok: true,
|
|
2232
1710
|
fonts: fonts.files,
|