svg2ttf

Convert SVG graphics to TTF font

svg2ttf

svg2ttf converts SVG graphics to TTF format. It was written for Fontello, but you can find it useful for your projects.

For developpers:

Internal API is similar to FontForge's one. Since primary goal is generating iconic fonts, sources can lack some spesific TTF/OTF features, like kerning and so on. Anyway, current code is a good base for development, because it will save you tons of hours to implement correct writing & optimizing TTF tables.

Also, library code can be browserified without problems. Use webmake or something similar.

Install:

npm install -g svg2ttf

Usage example:

svg2ttf fontello.svg fontello.ttf
  • svgFontString - SVG font content
  • options - not used yet
  • buf - internal ByteBuffer object, similar to DataView. It's buffer property is Uin8Array or Array with ttf content

Example:

var fs = require('fs');
var svg2ttf = require('svg2ttf');
 
var ttf = svg2ttf(fs.readFileSync('myfont.svg'), {});
fs.writeFileSync('myfont.ttf', new Buffer(ttf.buffer));

Copyright (c) 2013 Vitaly Puzrin. Released under the MIT license. See LICENSE for details.