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.
21 lines (19 loc) • 501 B
JavaScript
import fs from 'fs';
import { fontSplit } from '../dist/node/index.mjs';
const inputBuffer = new Uint8Array(
fs.readFileSync('../demo/public/SmileySans-Oblique.ttf').buffer,
);
// for (let index = 0; index < 10; index++) {
await fontSplit({
input: inputBuffer,
outDir: './dist/font',
renameOutputFont: '[hash:6].[ext]',
subsets: [[65]],
languageAreas: false,
autoSubset: false,
fontFeature: false,
reduceMins: false,
silent: true,
});
console.log('end');
// }