textFont()
Sets the font used by the text() function.
The first parameter, font, sets the font. textFont() recognizes a font object loaded previously with loadFont().
The second parameter, size, is optional. It sets the font size in pixels. This has the same effect as calling textSize().
Examples

function setup()
size(100,100)
background(200)
font = loadFont('assets/inconsolata.otf')
textFont(font)
textSize(24)
text('hi', 35, 55)
describe('The text "hi" written in a black, monospace font on a gray background.')
end

function setup()
size(100,100)
background('black')
fill('palegreen')
font = loadFont('assets/inconsolata.otf')
textFont(font, 10)
text('You turn to the left and see a door. Do you enter?', 5, 5, 90, 90)
text('>', 5, 70)
describe('A text prompt from a game is written in a green, monospace font on a black background.')
end
Syntax
textFont()
textFont(font, [size])
Parameters
| Parameter | |
|---|---|
| font | Object: font object previously loaded via loadFont |
| size | Number: font size in pixels |