APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.javafx.tk

public Class FontMetrics

extends Object
Class Inheritance
Imports
javafx.scene.text.Font

The metrics for a Font, including helper functions for computing string width/height and other metrics based on a specific String of text with this font.

Field Summary

Modifier and TypeField and Description
private float
ascent

The distance from the baseline to the avg max character height.

private int
baseline

The baseline is the imaginary line upon which letters without descenders (for example, the lowercase letter "a") sits.

private float
descent

The distance from the baseline down to the lowest avg.

private Font
font

The font that was used to construct these metrics.

private float
leading

The amount of space between lines of text in this font.

private float
lineHeight

The maximum line height for a line of text in this font

private float
maxAscent

The distance from the baseline to the max character height.

private float
maxDescent

The distance from the baseline down to the absolute lowest descender.

private float
xheight

The distance from the baseline to the top of the avg.

Constructor Summary

AccessConstructor and Description
public
FontMetrics(float maxAscent, float ascent, float xheight, float descent, float maxDescent, float leading, Font font)

Method Summary

Modifier and TypeMethod and Description
public static FontMetrics
createFontMetrics(float maxAscent, float ascent, float xheight, float descent, float maxDescent, float leading, Font font)

public final float
public final int
public float
getCharWidth(char ch)

Computes the width of the char when rendered with the font represented by this FontMetrics instance.

public final float
public final Font
public final float
public final float
public final float
public final float
public final float
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

ascentback to summary
private float ascent

The distance from the baseline to the avg max character height. this value is always positive

baselineback to summary
private int baseline

The baseline is the imaginary line upon which letters without descenders (for example, the lowercase letter "a") sits. In terms of the font metrics, all other metrics are derived from this point. This point is implicitly defined as zero.

descentback to summary
private float descent

The distance from the baseline down to the lowest avg. descender. This value is always positive

fontback to summary
private Font font

The font that was used to construct these metrics.

leadingback to summary
private float leading

The amount of space between lines of text in this font. This is the amount of space between he maxDecent of one line and the maxAscent of the next. This number is included in the lineHeight.

lineHeightback to summary
private float lineHeight

The maximum line height for a line of text in this font

maxAscentback to summary
private float maxAscent

The distance from the baseline to the max character height. This value is always positive

maxDescentback to summary
private float maxDescent

The distance from the baseline down to the absolute lowest descender. this value is always positive

xheightback to summary
private float xheight

The distance from the baseline to the top of the avg. lowercase letter.

Constructor Detail

FontMetricsback to summary
public FontMetrics(float maxAscent, float ascent, float xheight, float descent, float maxDescent, float leading, Font font)

Method Detail

createFontMetricsback to summary
public static FontMetrics createFontMetrics(float maxAscent, float ascent, float xheight, float descent, float maxDescent, float leading, Font font)
getAscentback to summary
public final float getAscent()
getBaselineback to summary
public final int getBaseline()
getCharWidthback to summary
public float getCharWidth(char ch)

Computes the width of the char when rendered with the font represented by this FontMetrics instance.

getDescentback to summary
public final float getDescent()
getFontback to summary
public final Font getFont()
getLeadingback to summary
public final float getLeading()
getLineHeightback to summary
public final float getLineHeight()
getMaxAscentback to summary
public final float getMaxAscent()
getMaxDescentback to summary
public final float getMaxDescent()
getXheightback to summary
public final float getXheight()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override