Skip to content

darkicerain/fonteditor-core

 
 

Repository files navigation

fonteditor-core

font editor core functions

NPM version Build Status Downloads

Feature

  • sfnt parse
  • read, write, transform fonts (ttf, woff, eot, svg, otf)
  • ttf glyph adjust
  • svg to glyph

Usage

// read font file
var fs = require('fs');
var bufferToArrayBuffer = require('b3b').bufferToArrayBuffer;
var fontBuffer = fs.readFileSync('font.ttf');
var fontArrayBuffer = bufferToArrayBuffer(fontBuffer);

// read font data
var TTFReader = require('fonteditor-core').TTFReader;
var ttfReader = new TTFReader({ hinting: true });
var fontData = ttfReader.read(fontArrayBuffer);

console.log(Object.keys(fontData));
/* => [ 'version',
  'numTables',
  'searchRenge',
  'entrySelector',
  'rengeShift',
  'head',
  'maxp',
  'glyf',
  'cmap',
  'name',
  'hhea',
  'post',
  'OS/2',
  'fpgm',
  'cvt',
  'prep'
]
*/

Demo

edp webserver

open http://127.0.0.1:9999/demo

Related

License

MIT © Fonteditor

About

fonteditor core functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.9%
  • HTML 4.8%
  • Other 0.3%