class Font

A Font object represents a set of characters of a particular typeface, style and size. Font objects are immutable.

Constructor

Font(family, size, style)
The family is the name of a font family ("Times", "Helvetica", etc...). The size is measured in points. The style is a list of zero or more of: 'bold', 'italic'.

Properties

family
Read-only. Family name of the font.

style
Read-only. Style of the font.

size
Read-only. Point size of the font.

ascent
Read-only. Distance from the baseline of the font to the top of the tallest character.

descent
Read-only. Distance from the baseline of the font to the bottom of the lowest character.

height
Read-only. Height of the font (equal to ascent + descent).

leading
Read-only. Recommended space to leave between adjacent lines of text.

line_height
Read-only. Recommended distance between the baselines of adjacent lines of text (equal to ascent + descent + leading).

cap_height
Read-only. Height above the baseline of capital letters. May not be accurate on all platforms.

x_height
Read-only. Height above the baseline of lower case letters without ascenders. May not be accurate on all platforms.

 Methods

width(string [,start [,end]])
Returns the width of the specified part of the given string when drawn in this font.

Constants

system_font
application_font
Predefined Font instances representing the standard fonts for system text and application text, respectively.