1.0.1 • Published 2 years ago

svg-ttf-generator v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 content
  • options
    • 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 be Version x.y or x.y.
  • buf - internal byte buffer object, similar to DataView. It's buffer property is Uin8Array or Array 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));