Home > Language Reference > Classes > Display

FontMetrics Property

Returns a FontMetrics object describing the physical charateristics of the currently active font.

Syntax

Public Property Get FontMetrics() As FontMetrics

Remarks

The FontMetrics property returns a FontMetrics object describing the physical characteristics of the currently selected font in the Display object, taking into account its coordinates system and its scaling mode. This object can then be used to compute width and height of a given string.

Note that a subsequent change in the Display font, coordinates system or scaling mode will not be reflected in the properties of the returned FontMetrics object, unless you query a new instance. For example:

Private Sub Button1_Click()
  Dim fm As FontMetrics

  Me.DrawFont=hbFontStandard+hbFontUnderlineNone
  Set fm = Me.FontMetrics
  MsgBox fm.Ascent

  Me.DrawFont=hbFontLarge+hbFontUnderlineNone
  MsgBox fm.Ascent ' Will return the same value as previously

  Set fm = Me.FontMetrics
  MsgBox fm.Ascent ' Will return an updated value.
End Sub

You can refer to the FontMetrics class for more information on the available characteristics of a font.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A