Top Description Fields Constructors Methods
org.eclipse.swt.graphics

public final Class FontMetrics

extends Object
Class Inheritance

Instances of this class provide measurement information about fonts including ascent, descent, height, leading space between rows, and average character width. FontMetrics are obtained from GCs using the getFontMetrics() method.
See Also
GC#getFontMetrics, Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the object is the same as this object and false otherwise
equals
(Object
the object to compare with this object
object
)

Overrides java.lang.Object.equals.

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
public int

Returns:

the ascent of the font
getAscent
()

Returns the ascent of the font described by the receiver.

public double

Returns:

the average character width of the font
getAverageCharacterWidth
()

Returns the average character width, measured in points, of the font described by the receiver.

public int

Returns:

the average character width of the font
getAverageCharWidth
()

Deprecated Use getAverageCharacterWidth() instead
Returns the average character width, measured in points, of the font described by the receiver.
public int

Returns:

the descent of the font
getDescent
()

Returns the descent of the font described by the receiver.

public int

Returns:

the height of the font
getHeight
()

Returns the height of the font described by the receiver, measured in points.

public int

Returns:

the leading space of the font
getLeading
()

Returns the leading area of the font described by the receiver.

public int

Returns:

the receiver's hash
hashCode
()

Overrides java.lang.Object.hashCode.

Returns an integer hash code for the receiver.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

ascentInPointsback to summary
pack-priv int ascentInPoints
averageCharWidthInPointsback to summary
pack-priv int averageCharWidthInPoints
descentInPointsback to summary
pack-priv int descentInPoints

Constructor Detail

FontMetricsback to summary
pack-priv FontMetrics()

Method Detail

equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Parameters
object:Object

the object to compare with this object

Returns:boolean

true if the object is the same as this object and false otherwise

Annotations
@Override
See Also
hashCode
getAscentback to summary
public int getAscent()

Returns the ascent of the font described by the receiver. A font's ascent is the distance from the baseline to the top of actual characters, not including any of the leading area, measured in points.

Returns:int

the ascent of the font

getAverageCharacterWidthback to summary
public double getAverageCharacterWidth()

Returns the average character width, measured in points, of the font described by the receiver.

Returns:double

the average character width of the font

Since
3.107
getAverageCharWidthback to summary
public int getAverageCharWidth()

Deprecated

Use getAverageCharacterWidth() instead

Returns the average character width, measured in points, of the font described by the receiver.

Returns:int

the average character width of the font

Annotations
@Deprecated
getDescentback to summary
public int getDescent()

Returns the descent of the font described by the receiver. A font's descent is the distance from the baseline to the bottom of actual characters, not including any of the leading area, measured in points.

Returns:int

the descent of the font

getHeightback to summary
public int getHeight()

Returns the height of the font described by the receiver, measured in points. A font's height is the sum of its ascent, descent and leading area.

Returns:int

the height of the font

See Also
getAscent, getDescent, getLeading
getLeadingback to summary
public int getLeading()

Returns the leading area of the font described by the receiver. A font's leading area is the space above its ascent which may include accents or other marks.

Returns:int

the leading space of the font

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns an integer hash code for the receiver. Any two objects that return true when passed to equals must return the same value for this method.

Returns:int

the receiver's hash

Annotations
@Override
See Also
equals