字体2svg从字体文件创建SVG子集字体


var fs = require('fs');

var font2svg = require('font2svg');

var buf = fs.readFileSync('path/to/font.otf');

font2svg(buf, { include: ['A', 'B', 'C', '0', '1', '2'] }, function (err, result) {

   if (err) {

      throw err;

   }

   result.toString();

   //=> '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?> <svg> <font '="" ...="" <="" code="" });=""></font></svg>