Home > Language Reference > Classes

FontMetrics Class

  + Object
    + FontMetrics

Description

The FontMetrics class encapsulates properties and functions used to determine physical characteristics of a given font, taking into account the active coordinates system and the current scaling mode. This class is cloneable, but is neither instantiable nor derivable. The only instances available to the programmer are those returned by a call to the FontMetrics property of the Display object.

Every character in a font has an ascent and a descent. The ascent is the amount by which the character ascends above the baseline. The descent is the amount by which the character descends below the baseline. The ascent of a font is the maximum ascent of all the characters in the font. The descent of a font is the maximum descent of all the characters in the font. The height of a font is the sum of its ascent and descent.

In addition, every font has a leading, an extra space between two consecutive lines of text. The line height of a font is the sum of its height and its leading. However, currently available fonts on the Palm OS® plateform all have a null leading, this extra space being included in the descent, as shown below:

You create a FontMetrics object by querying a Display object, calling its FontMetrics property. The returned object takes into account the currently active font, system coordinates, and scaling mode. You can then call the various properties and function of this class to compute the dimension of any given string. These values are always returned in logical coordinates.

Members

MembersDescription
Ascent Font ascent.
CharsInWidth Number of characters that can be drawn within a given width.
Descent Font descent.
Height Font Height
Leading Font Leading.
LineHeight Font line height.
TextWidth Text Width.
Inherited from ObjectDescription
ClassID Returns the type identifier corresponding to the actual class of the object.
Implements Determines whether the object implements the features of a given class.
Iterate Event raised to iterate over the elements of a container object.
Recipient Recipient of events sent by the object.
Serialize Event raised to serialize the object content into a stream.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A