Font


super: Object

The Font class provides the interface for getting and setting font information. The class provides you with access to the font's characteristics and also provides the system with access to the font’s glyph information, which is used during layout. You use font objects by passing them to methods that accept them as a parameter.

Properties

  • var familyName: String The font family name. (read-only)

  • var fontName: String The font face name. (read-only)

  • var pointSize: Float The receiver’s point size, or the effective vertical point size for a font with a nonstandard matrix. (read-only)

  • var ascender: Float The top y-coordinate, offset from the baseline, of the receiver’s longest ascender. (read-only)

  • var descender: Float The bottom y-coordinate, offset from the baseline, of the receiver’s longest descender. (read-only)

  • var capHeight: Float The receiver’s cap height information. (read-only)

  • var xHeight: Float The x-height of the receiver. (read-only)

  • var lineHeight: Float The height of text lines (measured in points). (read-only)

  • var objectName: String The name of the object.

Class Methods

  • func systemFont(size: Float): Font Returns the font object used for standard interface items in the specified size.

  • func boldSystemFont(size: Float): Font Returns the font object used for standard interface items that are rendered in boldface type in the specified size.

  • func italicSystemFont(size: Float): Font Returns the font object used for standard interface items that are rendered in italic type in the specified size.

  • func familyNames(): List Returns an array of font family names available on the system.

  • func fontNames(familyName: String): List Returns an array of font names available in a particular font family.

  • func systemFontSize(): Float Returns the size of the standard small system font.

Constructors

  • func Font(name: String, size: Float) A new font object with the given PostScript name and point size.
var font = Font("Helvetica", 12.0);