5.4 Font
class | |||||||||||||
|
The kind argument acts as a default and fallback for name. The specific, system-specific font used for a kind can be obtained from Font.kind_to_name. For valid names on a system system, use Font.get_names.
The font size is in “points,” unless in_pixels is true. On Mac OS, 1 point is 1 pixel. On Windows and Unix, 1 point is 96/72 pixels.
The style and weight arguments select italic, slanted, and/or bold. If has_underline is true, then text is drawn as underlined as well.
The smoothing argument controls whether and how much anti-aliasing is applied to text, and hinting controls pixel alignment. See Font.Smoothing and Font.Hinting for more information.
The features argument provides access to additional font features. See Font.FeatureString for more information.
A font like an existing one can be constructed using with and the field names kind, name, size, in_pixels, style, weight, has_underline, smoothing, hinting, and features.
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
| ||
property | ||
annotation | |
|
The Font.features property of a font object is a map of OpenType feature settings to enable or disable optional typographic features of OpenType fonts. Each entry in the hash maps a Font.FeatureString feature tag to its desired value. For boolean OpenType features, a value of 0 means “disabled” and a value of 1 means “enabled”; for other features, the meaning of the value varies (and may even depend on the font itself).
enumeration | ||||
|
#'thin (equivalent to 100)
#'ultralight (equivalent to 200)
#'light (equivalent to 300)
#'semilight (equivalent to 350)
#'book (equivalent to 380)
#'normal (equivalent to 400)
#'medium (equivalent to 500)
#'semibold (equivalent to 600)
#'bold (equivalent to 700)
#'ultrabold (equivalent to 800)
#'heavy (equivalent to 900)
#'ultraheavy (equivalent to 1000)
enumeration | |||||
|
#'default: Platform-specific, sometimes user-configurable.
#'partly_smoothed: Grayscale anti-aliasing.
#'smoothed: Sub-pixel anti-aliasing.
#'unsmoothed: No anti-aliasing.
enumeration | |||
|
#'aligned (the default): Rounds to integers to improve the consistency of letter spacing for pixel-based targets, but at the expense of making metrics less precisely scalable.
#'unaligned: Disables rounding.
function | ||||
| ||||
| ||||
enumeration | ||||
| ||||
| ||||
enumeration | ||||
|
If detail is #'face, then the result is in more standard terminology a list of typefaces, which are combined with style and weight options to arrive at a font. If detail is #'font, then the result includes a string for each available font.
property | |
| |
function | |