1.0.1 • Published 2 years ago
svg-ttf-generator v1.0.1
svg-ttf-generator
Converts SVG fonts to TTF format. It was forked from svg2ttf.
Why?
Because the glyph tag is old, when we create SVG image, using Adobe Illustrator or other software, we can't get right format. So I fork svg2ttf and change the core to support path tag.
Install:
npm install -g svg-ttf-generator
Usage example:
svg-ttf-generator fontello.svg fontello.ttf
API
svg-ttf-generator(svgFontString, options) -> buf
svgFontString
- SVG font contentoptions
copyright
- copyright string (optional)description
- description string (optional)ts
- Unix timestamp (in seconds) to override creation time (optional)url
- manufacturer url (optional)version
- font version string, can beVersion x.y
orx.y
.
buf
- internal byte buffer object, similar to DataView. It'sbuffer
property isUin8Array
orArray
with ttf content.
Example:
var fs = require('fs');
var svg2ttf = require('svg-ttf-generator');
var ttf = svg2ttf(fs.readFileSync('myfont.svg', 'utf8'), {});
fs.writeFileSync('myfont.ttf', new Buffer(ttf.buffer));