Class LineMetrics
public abstract class LineMetrics extends Object
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
| Modifier | Constructor | Description |
|---|---|---|
protected |
Constructor for subclasses to call. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
abstract float |
getAscent() |
Returns the ascent of the text. |
abstract int |
getBaselineIndex() |
Returns the baseline index of the text. |
abstract float[] |
getBaselineOffsets() |
Returns the baseline offsets of the text, relative to the baseline of the text. |
abstract float |
getDescent() |
Returns the descent of the text. |
abstract float |
getHeight() |
Returns the height of the text. |
abstract float |
getLeading() |
Returns the leading of the text. |
abstract int |
getNumChars() |
Returns the number of characters ( char values) in the text whose metrics are encapsulated by this LineMetrics object. |
abstract float |
getStrikethroughOffset() |
Returns the position of the strike-through line relative to the baseline. |
abstract float |
getStrikethroughThickness() |
Returns the thickness of the strike-through line. |
abstract float |
getUnderlineOffset() |
Returns the position of the underline relative to the baseline. |
abstract float |
getUnderlineThickness() |
Returns the thickness of the underline. |
Constructor Details
LineMetrics
protected LineMetrics()
Method Details
getNumChars
public abstract int getNumChars()
char values) in the text whose metrics are encapsulated by this LineMetrics object.- Returns:
- the number of characters (
charvalues) in the text with which thisLineMetricswas created.
getAscent
public abstract float getAscent()
- Returns:
- the ascent of the text.
getDescent
public abstract float getDescent()
- Returns:
- the descent of the text.
getLeading
public abstract float getLeading()
- Returns:
- the leading of the text.
getHeight
public abstract float getHeight()
- Returns:
- the height of the text.
getBaselineIndex
public abstract int getBaselineIndex()
ROMAN_BASELINE, CENTER_BASELINE, HANGING_BASELINE.- Returns:
- the baseline of the text.
getBaselineOffsets
public abstract float[] getBaselineOffsets()
CENTER_BASELINE then offsets[HANGING_BASELINE] is usually negative, offsets[CENTER_BASELINE] is zero, and offsets[ROMAN_BASELINE] is usually positive.- Returns:
- the baseline offsets of the text.
getStrikethroughOffset
public abstract float getStrikethroughOffset()
- Returns:
- the position of the strike-through line.
getStrikethroughThickness
public abstract float getStrikethroughThickness()
- Returns:
- the thickness of the strike-through line.
getUnderlineOffset
public abstract float getUnderlineOffset()
- Returns:
- the position of the underline.
getUnderlineThickness
public abstract float getUnderlineThickness()
- Returns:
- the thickness of the underline.
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/java/awt/font/LineMetrics.html