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.
1 lines • 1.84 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/deno/index.ts"],"sourcesContent":["import { FontSplitProps } from '../interface.js';\nimport { getBinName, matchPlatform } from '../load.js';\nimport { createAPI } from '../createAPI.js';\nexport * from '../interface.js';\nexport * from '../createAPI.js';\n/** @ts-ignore */\nconst _Deno = Deno;\nlet binPath = _Deno.env.get('CN_FONT_SPLIT_BIN');\nif (!binPath) {\n binPath = new URL(\n '../' +\n getBinName(\n matchPlatform(process.platform, process.arch, () => false),\n ),\n import.meta.url,\n );\n // throw new Error('CN_FONT_SPLIT_BIN is undefined!');\n}\nconst dylib = _Deno.dlopen(binPath, {\n font_split: { parameters: ['buffer', 'usize', 'function'], result: 'void' },\n} as const);\nconst createCallback = (cb: (data: Uint8Array) => void) =>\n new _Deno.UnsafeCallback(\n {\n parameters: ['pointer', 'usize'],\n result: 'void',\n } as const,\n (success: any, length: number) => {\n let buffer = new _Deno.UnsafePointerView(success).getArrayBuffer(\n Number(length),\n );\n cb(new Uint8Array(buffer.slice()));\n },\n ).pointer;\n\nexport const fontSplit = createAPI(dylib.symbols.font_split, createCallback);\n"],"mappings":";;;;;AAMA,IAAM,IAAQ,MACV,IAAU,EAAM,IAAI,IAAI,mBAAmB;AAC/C,AACI,MAAU,IAAI,IACV,QACI,EACI,EAAc,QAAQ,UAAU,QAAQ,YAAY,EAAK,CAC7D,GACJ,OAAO,KAAK,GAChB;AAoBJ,IAAa,IAAY,EAjBX,EAAM,OAAO,GAAS,EAChC,YAAY;CAAE,YAAY;EAAC;EAAU;EAAS;CAAU;CAAG,QAAQ;AAAO,EAC9E,CAemC,EAAM,QAAQ,aAdzB,MACpB,IAAI,EAAM,eACN;CACI,YAAY,CAAC,WAAW,OAAO;CAC/B,QAAQ;AACZ,IACC,GAAc,MAAmB;CAC9B,IAAI,IAAS,IAAI,EAAM,kBAAkB,CAAO,EAAE,eAC9C,OAAO,CAAM,CACjB;CACA,EAAG,IAAI,WAAW,EAAO,MAAM,CAAC,CAAC;AACrC,CACJ,EAAE,OAEqE"}