Sets the font used by the text() function.
The first parameter, font
, sets the font. textFont()
recognizes either a p5.Font object or a string with the name of a system font. For example, 'Courier New'
.
The second parameter, size
, is optional. It sets the font size in pixels. This has the same effect as calling textSize().
Note: WEBGL
mode only supports fonts loaded with loadFont().
Examples
Syntax
textFont(font, [size])
Parameters
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.