Font
-
class Font
Object that represents a font for writing text.
-
DEFAULT: Font = Ellipsis
The default font.
-
TERMINUS_16: Font = Ellipsis
The Terminus font with a height of 16 pixels.
-
LIBERATIONSANS_14: Font = Ellipsis
The Liberation Sans regular font with a height of 14 pixels.
-
MONO_8X5_8: Font = Ellipsis
A monospaced font with a height of 8 pixels and a width of 5 pixels.
-
family
Gets the family name of the font.
-
style
style -> str
Gets a string describing the font style.
Can be “Regular” or “Bold”.
-
width
Gets the width of the widest character of the font.
-
height
Gets the height of the font.
-
text_width(text)
Gets the width of the text when the text is drawn using this font.
- Parameters:
text (str) – The text.
- Returns:
The width in pixels.
- Return type:
int
-
text_height(text)
Gets the height of the text when the text is drawn using this font.
- Parameters:
text (str) – The text.
- Returns:
The height in pixels.
- Return type:
int