Java: FontMetrics ascent incorrect?

前端 未结 3 1703
一整个雨季
一整个雨季 2020-12-31 02:49

When I look at the javadoc for FontMetric.getAscent() I see:

The font ascent is the distance from the font\'s baseline to the top of most alphanumeric

3条回答
  •  别那么骄傲
    2020-12-31 03:16

    The TrueType Reference Manual says that the ascent of a font is stored in the 'hhea' table. The documentation for hhea states, "The values for ascent, descent and lineGap represent the design intentions of the font's creator rather than any computed value." The OpenType specification is an extension of the TrueType specification. It also stores the ascender in the hhea table and references the TrueType definition of ascent. Bottom line, the ascent property is a guide, not an absolute. The GlyphLayoutVector is the most accurate way to get the bounds of text.

提交回复
热议问题