svg2ttf
Version:
Converts SVG font to TTF font
20 lines (13 loc) • 439 B
JavaScript
;
// See documentation here: http://www.microsoft.com/typography/otspec/hmtx.htm
var _ = require('lodash');
var ByteBuffer = require('microbuffer');
function createHtmxTable(font) {
var buf = new ByteBuffer(font.glyphs.length * 4);
_.forEach(font.glyphs, function (glyph) {
buf.writeUint16(glyph.width); //advanceWidth
buf.writeInt16(glyph.xMin); //lsb
});
return buf;
}
module.exports = createHtmxTable;