Processing displays text using pre-converted VLW bitmap fonts loaded with loadFont() and textFont()
Processing cannot render system fonts directly in real-time. Fonts must be pre-converted to the VLW format via Tools > Create Font. This generates a bitmap image for each character at the chosen size. Larger font sizes produce larger file sizes. The font is loaded in setup() with loadFont() and activated with textFont(). text() draws strings or characters to the display window. textAlign() controls horizontal anchor (LEFT, RIGHT, CENTER); textSize() changes size at runtime. textWidth() returns the pixel width of a string in the current font — critical for layout since proportional fonts have variable character widths.
Examples
PFont font; void setup() { font = loadFont(“Helvetica-32.vlw”); textFont(font); } void draw() { text(“Hello”, 10, 50); }
Assessment
Explain why you cannot directly use a system font in Processing without conversion; write code that centres a string horizontally using textAlign and textWidth.