IlvFont: The Font Class

A text string is drawn with specific spacing values as in the following illustration:

Spacing Values

You can get the parameters of an IlvFont object by using the member functions getFamily, getSize, getStyle, and getFoundry.

The member functions ascent, descent, and height return the font metrics.

You can also get the metrics of a specific string by means of calls to the member functions stringWidth, stringHeight, and sizes.

The member function isFixed returns IlTrue if the font object has a fixed width for all characters (which is not the case in the above figure).

You can also obtain the width of the narrowest and widest characters of this font by means of the width values returned by the two member functions maxWidth and minWidth. When both return the same value, isFixed returns IlTrue.

Additional details of the font class are given in:

New Fonts

IlvFont does not have a public constructor. New fonts must be obtained from the display using one of the two member functions getFont. You can specify a font name or a set of font characteristics:

  • Family

  • Size

  • Style

  • Foundry

Font Names

All fonts have a name. When a font is not created using a valid font name but a set of values— family, size, style and foundry—Views computes from these values a name of the form:

"%family-size-style-foundry"

where:

  • family is the string specified as the parameter family.

  • size is the ASCII representation of the parameter size.

  • style is a combination of the letters B, I and U, standing respectively for bold, italic and underlined (upper and lower case do not matter). This field can be empty, in which case the normal style is assumed.

  • foundry is an optional string. It often identifies the company that designed the font. This field is seldom specified. When it is ignored, the trailing ‘-’ can be omitted too.

Fonts cannot be renamed.

Following are examples of syntactically well-formed Views font names (which are not necessarily valid font names in the sense that they may not exist on all platforms):

  • "%helvetica-12-"

  • "%time-12-BU"

  • "%courier-14-i-adobe"

  • "%terminal-11--bitstream"