This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.awt.font
class LineMetrics

java.lang.Object extended by java.awt.font.LineMetrics

Most common way to construct:

Font font = …;
String string = …;
FontRenderContext frc = …;

LineMetrics lm = font.getLineMetrics(string, frc);

Based on 47 examples


public abstract class LineMetrics
extends Object

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 {@link java.awt.Font 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 {@link #getNumChars}.


Constructor Summary

          
 
Method Summary
abstract float

          Returns the ascent of the text.
abstract int

          Returns the baseline index of the text.
abstract float[]

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

          Returns the descent of the text.
abstract float

          Returns the height of the text.
abstract float

          Returns the leading of the text.
abstract int

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

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

          Returns the thickness of the strike-through line.
abstract float

          Returns the position of the underline relative to the baseline.
abstract float

          Returns the thickness of the underline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineMetrics

public LineMetrics()
Method Detail

getAscent

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:
the ascent of the text.

getBaselineIndex

public abstract int getBaselineIndex()
Returns the baseline index of the text. The index is one of {@link java.awt.Font#ROMAN_BASELINE ROMAN_BASELINE}, {@link java.awt.Font#CENTER_BASELINE CENTER_BASELINE}, {@link java.awt.Font#HANGING_BASELINE HANGING_BASELINE}.

Returns:
the baseline of the text.

getBaselineOffsets

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:
the baseline offsets of the text.

getDescent

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:
the descent of the text.

getHeight

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:
the height of the text.

getLeading

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:
the leading of the text.

getNumChars

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

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

getStrikethroughOffset

public abstract float getStrikethroughOffset()
Returns the position of the strike-through line relative to the baseline.

Returns:
the position of the strike-through line.

getStrikethroughThickness

public abstract float getStrikethroughThickness()
Returns the thickness of the strike-through line.

Returns:
the thickness of the strike-through line.

getUnderlineOffset

public abstract float getUnderlineOffset()
Returns the position of the underline relative to the baseline.

Returns:
the position of the underline.

getUnderlineThickness

public abstract float getUnderlineThickness()
Returns the thickness of the underline.

Returns:
the thickness of the underline.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.