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

public final Class GlyphMetrics

extends Object
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.internal.*

Instances of this class represent glyph metrics.

The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted.

Application code does not need to explicitly release the resources managed by each instance when those instances are no longer required, and thus no dispose() method is provided.

Since
3.2
See Also
TextStyle, TextLayout, Sample code and further information

Field Summary

Modifier and TypeField and Description
public int
ascent

the ascent of the GlyphMetrics

public int
descent

the descent of the GlyphMetrics

public int
width

the width of the GlyphMetrics

Constructor Summary

AccessConstructor and Description
public
GlyphMetrics(int
the GlyphMetrics ascent
ascent
,
int
the GlyphMetrics descent
descent
,
int
the GlyphMetrics width
width
)

Constructs an instance of this class with the given ascent, descent and width values.

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.
pack-priv int
pack-priv int
pack-priv int
public int

Returns:

the receiver's hash
hashCode
()

Overrides java.lang.Object.hashCode.

Returns an integer hash code for the receiver.
public String

Returns:

a string representation of the GlyphMetrics
toString
()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

ascentback to summary
public int ascent

the ascent of the GlyphMetrics

descentback to summary
public int descent

the descent of the GlyphMetrics

widthback to summary
public int width

the width of the GlyphMetrics

Constructor Detail

GlyphMetricsback to summary
public GlyphMetrics(int ascent, int descent, int width)

Constructs an instance of this class with the given ascent, descent and width values.

Parameters
ascent:int

the GlyphMetrics ascent

descent:int

the GlyphMetrics descent

width:int

the GlyphMetrics width

Exceptions
IllegalArgumentException:
  • ERROR_INVALID_ARGUMENT - if the ascent, descent or width argument is negative

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()
getAscentInPixelsback to summary
pack-priv int getAscentInPixels()
getDescentInPixelsback to summary
pack-priv int getDescentInPixels()
getWidthInPixelsback to summary
pack-priv int getWidthInPixels()
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(Object)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string containing a concise, human-readable description of the receiver.

Returns:String

a string representation of the GlyphMetrics

Annotations
@Override