makeHmtxTable function
dynamic
makeHmtxTable(
- dynamic glyphs
Implementation
makeHmtxTable(glyphs) {
var t = new Table('hmtx', [], null);
for (var i = 0; i < glyphs.length; i += 1) {
var glyph = glyphs.get(i);
var advanceWidth = glyph.advanceWidth ?? 0;
var leftSideBearing = glyph.leftSideBearing ?? 0;
t.fields.push({"name": 'advanceWidth_${i}', "type": 'USHORT', "value": advanceWidth});
t.fields.push({"name": 'leftSideBearing_${i}', "type": 'SHORT', "value": leftSideBearing});
}
return t;
}