Font

A font used by Text objects.

Constructor

Font(file_dir: str, pt_size: int)

Parameters

  • file_dir : Path to a .ttf font file, or one of the built-in names "kraken-clean" or "kraken-retro".
  • pt_size : The point size. Values below 8 are clamped to 8. For "kraken-retro", the size is rounded to the nearest multiple of 8 to preserve pixel alignment.

Properties


NameDescriptionType
alignmentThe alignment of the font when drawing text.Align
hintingThe font hinting mode.FontHint
pt_sizeThe point size of the font.int
boldWhether the font is bold.bool
italicWhether the font is italic.bool
underlineWhether the font is underlined.bool
strikethroughWhether the font is strikethrough.bool
heightThe height of the font in pixels.int
ascentThe ascent of the font in pixels.int
descentThe descent of the font in pixels.int
line_spacingThe line spacing of the font in pixels.int
kerningWhether kerning is enabled for the font.bool
outlineThe outline thickness of the font in pixels.int