Any function that needs a font (like
createTextImage()) require a font created with
createFont(). The
size of the font is fixed at creation. If you require a different
size you'll need to create a new
font. Best practice is to create all the
fonts and
sizes you need at boot and use them as needed. Scaling the image made from
createTextImage() too much can create blurry characters and it's best to create a new font at the right size.
Pixel fonts need to be created at the base size of the original .ttf file. They can safely be scaled up in whole number multiples.
font = createFont("Savior.ttf", 16)
image = createTextImage(font, "Hi there, nice day!")
There is no way to delete a font, so create them once and use them for the rest of the game.