True Type Font format: Pen Position, Advance Width and Kerning

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 that specifies the distance by which we should move to the right (assume left to right font here and horizontal) before drawing the next glyph. My questions:

  • where do I find the data for the advanced width in the FFT file. Is that in the hhea table? Is that advanceWidthMax ?
  • I can't find where would the pen position defined in the file? Could you please indicate me the table where this would be stored? (or should I compute that from the glyph xmin, ymin, baseline and left bearing data? and then potentially use kerning for additional small adjustments?)

  • is the advanced width global for the font?

  • is there a pen position for each glyph?

  • I understand in order to adjust position between glyph you should be using the kerning data that specifies an offset between glyph with respect to the advanced width . Is that correct?

  • EDIT

    I found a partial answer to my questions:

  • hhea contains information for the whole font
  • though this info is not really applicable. You need to read the data from the htmx table that contains data for each glyph in the font (left side bearing and advance width).
  • I am still interested in pen position) and how to properly use kerning data.


    Hope this can help people in the future.What I found:

  • hhea contains information for the whole font
  • though this info is not really applicable. You need to read the data from the html 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.

    链接地址: http://www.djcxy.com/p/87314.html

    上一篇: 为什么禁用Safari中的文本在黑体中未呈现?

    下一篇: True Type字体格式:笔位置,提前宽度和字距