fonteditor core functions
FontEditor core functions
Read and write sfnt font like ttf, woff, woff2, eot, svg, otf.
…This library supports both CommonJS and ES Modules. For detailed information on using with modern bundlers, please see ESM_USAGE.md.
// ESM import
import fonteditorCore, { createFont, woff2 } from 'fonteditor-core';
createFont(buffer, options);Notice: woff2 use wasm build of google woff2, before read and write woff2, we should first call woff2.init().
import {createFont, woff2} from 'fonteditor-core';
// in nodejs
woff2.init().then(() => {
// read woff2
const font = createFont(buffer, {
type: 'woff2'
});
// write woff2
const buffer = font.write({type: 'woff2'});
});
// in browser
woff2.init('/assets/woff2.wasm').then(() => {
// read woff2
const font = createFont();
// write woff2
const arrayBuffer = font.write({type: 'woff2'});
});npm run devnpm run buildnpm run testNode.js:>= 12.0
Browser: Chrome, Safari
MIT © Fonteditor
No open issues yet, or sync has not completed.