FontMetrics

Methods
10
Fields
None

Getting one

JComponent.new():getFontMetrics(…)

Methods

MethodReturnsDescription
stringWidth(string)numberThe advance of str, in pixels.
getHeight()numberAscent plus descent plus leading.
getAscent()numberThe ascent.
getDescent()numberThe descent.
getLeading()numberThe leading.
getMaxAscent()numberThe largest ascent.
getMaxDescent()numberThe largest descent.
getMaxAdvance()numberThe largest advance.
getFont()FontThe font measured.
getStringBounds(string, any)Rectangle2DThe logical bounds of str from its baseline origin. Pass the Graphics2D; the metrics already carry its context.

Returned by

MethodReturnsDescription
Graphics.getFontMetricsFontMetrics(Graphics) -> FontMetrics: The metrics of the current font, under the current text antialiasing.
JComponent.getFontMetricsFontMetricsThe metrics font measures with in a component: the look's text rendering (the fonts antialiased as their gasp table says), so a width c…

Method details