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.

34 lines (33 loc) 894 B
import { getBinName as i, matchPlatform as s } from "../load.mjs"; import { createAPI as f } from "../createAPI.mjs"; import { decodeReporter as d } from "../decodeReporter.mjs"; import { api_interface as N } from "../gen/index.mjs"; const e = Deno; let t = e.env.get("CN_FONT_SPLIT_BIN"); t || (t = new URL( "../" + i( s(process.platform, process.arch, () => !1) ), import.meta.url )); const p = e.dlopen(t, { font_split: { parameters: ["buffer", "usize", "function"], result: "void" } }), l = (r) => new e.UnsafeCallback( { parameters: ["pointer", "usize"], result: "void" }, (o, n) => { let a = new e.UnsafePointerView(o).getArrayBuffer( Number(n) ); r(new Uint8Array(a.slice())); } ).pointer, u = f(p.symbols.font_split, l); export { f as createAPI, d as decodeReporter, u as fontSplit, N as proto }; //# sourceMappingURL=index.mjs.map