UNPKG

cn-font-split

Version:

划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.

32 lines (31 loc) 1.33 kB
import { getBinName as e, matchPlatform as t } from "../load.mjs"; import { isMusl as n } from "./isMusl.mjs"; import { api_interface as r } from "../gen/index.mjs"; import { decodeReporter as i } from "../decodeReporter.mjs"; import { createAPI as a } from "../createAPI.mjs"; import { dlopen as o } from "../node_modules/.pnpm/@xan105_ffi@1.3.1_koffi@2.10.0/node_modules/@xan105/ffi/lib/koffi/open.mjs"; import { Callback as s } from "../node_modules/.pnpm/@xan105_ffi@1.3.1_koffi@2.10.0/node_modules/@xan105/ffi/lib/koffi/helper.mjs"; import "../node_modules/.pnpm/@xan105_ffi@1.3.1_koffi@2.10.0/node_modules/@xan105/ffi/lib/koffi/index.mjs"; import c, { dirname as l } from "path"; import u from "koffi"; import { fileURLToPath as d } from "url"; //#region src/node/index.ts var f = l(d(import.meta.url)), p = process.env.CN_FONT_SPLIT_BIN; p ||= c.resolve(f, "../" + e(t(process.platform, process.arch, n))); var m = a(o(p, { font_split: { parameters: [ "pointer", "usize", "function" ], result: "void" } }).font_split, (e) => new s({ parameters: ["pointer", "usize"], result: "void" }, (t, n) => { let r = u.decode(t, u.array("uint8_t", n, "Array")); e(new Uint8Array(r)); }).pointer); //#endregion export { a as createAPI, i as decodeReporter, m as fontSplit, r as proto }; //# sourceMappingURL=index.mjs.map