For capturing the glyph widths of a TrueType
font, I convert the corresponding TTF
file by fontforge
into AFM
, which is in te
Assuming you mean advance widths, what you're interested in is the hmtx table. It's fairly straightforward to parse, as you can see the structure is:
typedef struct _longHorMetric {
USHORT advanceWidth;
SHORT lsb;
} longHorMetric;
Of course, in order to parse the hmtx, you'll also need to know in general how to locate font tables, and you'll also need the numberOfHMetrics value from the hhea table and the font's numGlyphs from the maxp table. The structure of all of these is given in the links and should be fairly easy to parse in any language.