APIdia Launch Partner
Top Description Constructors Methods
java.awt.font

public abstract Class LineMetrics

extends Object
Class Inheritance
Known Direct Subclasses
sun.font.FontLineMetrics

The LineMetrics class allows access to the metrics needed to layout characters along a line and to layout of a set of lines. A LineMetrics object encapsulates the measurement information associated with a run of text.

Fonts can have different metrics for different ranges of characters. The getLineMetrics methods of Font take some text as an argument and return a LineMetrics object describing the metrics of the initial number of characters in that text, as returned by getNumChars.

Constructor Summary

AccessConstructor and Description
protected
LineMetrics()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public abstract float

Returns:

the ascent of the text.
getAscent
()

Returns the ascent of the text.

public abstract int

Returns:

the baseline of the text.
getBaselineIndex
()

Returns the baseline index of the text.

public abstract float[]

Returns:

the baseline offsets of the text.
getBaselineOffsets
()

Returns the baseline offsets of the text, relative to the baseline of the text.

public abstract float

Returns:

the descent of the text.
getDescent
()

Returns the descent of the text.

public abstract float

Returns:

the height of the text.
getHeight
()

Returns the height of the text.

public abstract float

Returns:

the leading of the text.
getLeading
()

Returns the leading of the text.

public abstract int

Returns:

the number of characters (char values) in the text with which this LineMetrics was created.
getNumChars
()

Returns the number of characters (char values) in the text whose metrics are encapsulated by this LineMetrics object.

public abstract float

Returns:

the position of the strike-through line.
getStrikethroughOffset
()

Returns the position of the strike-through line relative to the baseline.

public abstract float

Returns:

the thickness of the strike-through line.
getStrikethroughThickness
()

Returns the thickness of the strike-through line.

public abstract float

Returns:

the position of the underline.
getUnderlineOffset
()

Returns the position of the underline relative to the baseline.

public abstract float

Returns:

the thickness of the underline.
getUnderlineThickness
()

Returns the thickness of the underline.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LineMetricsback to summary
protected LineMetrics()

Constructor for subclasses to call.

Method Detail

getAscentback to summary
public abstract float getAscent()

Returns the ascent of the text. The ascent is the distance from the baseline to the ascender line. The ascent usually represents the the height of the capital letters of the text. Some characters can extend above the ascender line.

Returns:float

the ascent of the text.

getBaselineIndexback to summary
public abstract int getBaselineIndex()

Returns the baseline index of the text. The index is one of ROMAN_BASELINE, CENTER_BASELINE, HANGING_BASELINE.

Returns:int

the baseline of the text.

getBaselineOffsetsback to summary
public abstract float[] getBaselineOffsets()

Returns the baseline offsets of the text, relative to the baseline of the text. The offsets are indexed by baseline index. For example, if the baseline index is CENTER_BASELINE then offsets[HANGING_BASELINE] is usually negative, offsets[CENTER_BASELINE] is zero, and offsets[ROMAN_BASELINE] is usually positive.

Returns:float[]

the baseline offsets of the text.

getDescentback to summary
public abstract float getDescent()

Returns the descent of the text. The descent is the distance from the baseline to the descender line. The descent usually represents the distance to the bottom of lower case letters like 'p'. Some characters can extend below the descender line.

Returns:float

the descent of the text.

getHeightback to summary
public abstract float getHeight()

Returns the height of the text. The height is equal to the sum of the ascent, the descent and the leading.

Returns:float

the height of the text.

getLeadingback to summary
public abstract float getLeading()

Returns the leading of the text. The leading is the recommended distance from the bottom of the descender line to the top of the next line.

Returns:float

the leading of the text.

getNumCharsback to summary
public abstract int getNumChars()

Returns the number of characters (char values) in the text whose metrics are encapsulated by this LineMetrics object.

Returns:int

the number of characters (char values) in the text with which this LineMetrics was created.

getStrikethroughOffsetback to summary
public abstract float getStrikethroughOffset()

Returns the position of the strike-through line relative to the baseline.

Returns:float

the position of the strike-through line.

getStrikethroughThicknessback to summary
public abstract float getStrikethroughThickness()

Returns the thickness of the strike-through line.

Returns:float

the thickness of the strike-through line.

getUnderlineOffsetback to summary
public abstract float getUnderlineOffset()

Returns the position of the underline relative to the baseline.

Returns:float

the position of the underline.

getUnderlineThicknessback to summary
public abstract float getUnderlineThickness()

Returns the thickness of the underline.

Returns:float

the thickness of the underline.