Py5Font is the font class for py5.
1 2 3 4
def setup(): font = py5.create_font("DejaVu Sans", 32) py5.text_font(font) py5.text("word", 10, 50)
Py5Font is the font class for py5. To create a font to use with py5, use create_font_file(). This will create a font in the format py5 requires. Py5 displays fonts using the .vlw font format, which uses images for each letter, rather than defining them through vector data. The load_font() function constructs a new font and text_font() makes a font active. The Py5Font.list() method creates a list of the fonts installed on the computer, which is useful information to use with the create_font() function for dynamically converting fonts into a format to use with py5.
To create a new font dynamically, use the create_font() function. Do not use the syntax
Underlying Java class: PFont
The following methods and fields are provided:
ascent(): Get the ascent of this font from the baseline.
descent(): Get the descent of this font from the baseline.
get_glyph_count(): Get the number of glyphs contained in the font.
get_name(): Get the font’s name.
get_post_script_name(): Get the font’s postscript name.
get_size(): Get the font’s size.
is_smooth(): Boolean value reflecting if smoothing (anti-aliasing) was used when the font was created.
list(): Gets a list of the fonts installed on the system.
width(): Get the width of a character in this font.
Updated on September 16, 2021 14:31:43pm UTC