UNPKG

svg2ttf

Version:

Converts SVG font to TTF font

19 lines (13 loc) 432 B
'use strict' // 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