Py5Font is the font class for py5.
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 Processing 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_default_size(): Get the font’s size that will be used when text_font() is called.
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_shape(): Get a single character as a Py5Shape object.
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 March 06, 2023 02:49:26am UTC