Skip to content

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!

screenshot of Processing with the previously explained program running, showing the text "Test"

Sources Of Fonts#

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.