I am doing some work with font and use the TTF (True Type Font) file format for now. I understand the glyph has a pen point position and an advance width
parameter
Hope this can help people in the future.What I found:
hhea
contains information for the whole fonthtml
table that contains data for each glyph in the font (left side bearing and advance width). Generally this table contains as many entries that the font contains glyph. Each entry specifies the glyph left side bearing and advance width.I didn't find any info about the pen position but I assume the xmin value of the glyph is with respect to the origin of the EM square. So to find the pen position (in x) you need to do something like:
pos_pos_x = glyph->leftSideBearing - glyph->min.x
Once the glyph is drawn you then need to move by glyph->advanceWidth
and repeat that process for drawn glyph. I don't know if this 100% accurate, but at least this is what i have reversed-engineered so far.