ericfreese/node-freetype2

Do you have plan to save back the result of parse() to a new font file?

Closed this issue · 1 comments

I have a font file and I want use it as web font, But it's size is so large! I think if exclude the unused chars can minimise the font file. can you provide a method to save font files? For example:

var fs = require('fs'),
    freetype = require('freetype2');

fs.readFile('/path/to/a/font.woff', function(err, buffer) {
  if (!!err) throw err;
  var fontface = freetype.parse(buffer);

  // Only save ten chars.
  fontface. available_characters = fontface. available_characters.slice(0, 10);
  freetype.save('./min-font.ttf', fontface, 'ttf');
  freetype.save('./min-font.woff', fontface, 'woff');
  // ...

});

I don't believe FreeType provides a way to do this. It's only responsible for rendering fonts.