FontMetrics doesn't have getters for cap height and x-height of a font.
How can I obtain these values?
As far as cap height goes, there's no guarantee for a particular capital letter that the letter's ascent is the same as the cap height. (e.g. a capital H isn't guaranteed to be flat on the top)
As far as x height goes, I assume it's probably the same as the height of an "x", but again, there's no guarantee.
edit: Grr! I just tried FontMetrics.getBounds()
and FontMetrics.getLineMetrics()
for specific character sequences, and I always get the same answer for heights (getBounds() does differ for widths, obviously). There's a note in the hasUniformLineMetrics()
method about a fontmetrics having several fonts to cover the character set, but that covers character groups, not individual characters.