fonteditor-core
FontEditor core functions
Feature
- sfnt parse
- read, write, transform fonts
- ttf (read and write)
- woff (read and write)
- woff2 (read and write)
- eot (read and write)
- svg (read and write)
- otf (only read)
- ttf glyph adjust
- svg to glyph
Usage
// read font fileconst Font = Font;const fs = ; let buffer = fs;// read font datalet font = Font;let fontObject = font;console; /* => [ 'version', 'numTables', 'searchRenge', 'entrySelector', 'rengeShift', 'head', 'maxp', 'glyf', 'cmap', 'name', 'hhea', 'post', 'OS/2', 'fpgm', 'cvt', 'prep']*/ // write font filelet buffer = font;// fs.writeFileSync('font.woff', buffer); // to base64 strfont; // optimize glyffont // compound2simplefont // sort glyffont // find glyflet result = font;let result = font; // merge another font objectfont;
woff2
Notice: woff2 use wasm build of google woff2, before read and write woff2
,
you should first call woff2.init()
.
const Font = Font;const woff2 = woff2; woff2;
Demo
npm run dev
build
npm run build
test
npm run test
support
Node.js:>= 8.0
Browser: Chrome, Safari
Related
License
MIT © Fonteditor