Loading Fonts#
Again, this is very similar to loading images. Just an example:
PFont lgFont;
lgFont = createFont("LuckiestGuy-Regular.ttf", 40);
background(0);
textFont(lgFont);
text("Test", 5, 80);
createFont()
loads a file and specifies a size in pixels. We would normally do this in setup()
, but I chose to have a shorter example, here. We then set this to be the font we want to be using with textFont()
. Finally, we just draw text()
in the exact same way we always did!
Sources Of Fonts#
- https://fonts.google.com/ - please do not "hotlink" to google. Download the fonts to your
data
directory! - https://www.dafont.com/ - usually these are "free to use for personal projects"
Always Credit the Author
In a university context, all work you hand in is assumed to be yours, that includes any assets that you use. Credit authors of fonts even if their license does not require it.