...
Font can be saved within the sketch folder too, incase the font isn't installed on the computer running the sketch.
Code Block |
---|
PFont font; size(200, 200); background(0); // the .ttf file should be saved in the sketch folder font = createFont("Trebuchet-BoldItalic", 32); textFont(font, 32); text("word", 10, 50); textSize(70); text("word", 10, 100); |
...
Alternatively fonts can be saved in a bitmap format that Processing uses. This will generally offer better performance and be more consistent across different computers, with the compromise that it can not be scaled up without looking pixelated. It is an option however, to save the font in multiple sizes. To create the .vlw file, open Processing and select the >Tools > Create Font> menu item.
Code Block |
---|
PFont font; size(200, 200); background(0); // The vlw file should be saved in the sketch folder font = loadFont("Trebuchet-BoldItalic-32.vlw"); textFont(font, 32); text("word", 10, 50); textSize(70); text("word", 10, 100); |
...