This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.
PFont mono; // The font "AndaleMono-48.vlw"" must be located in the // current sketch's "data" directory to load successfully mono = loadFont("AndaleMono-32.vlw"); background(0); textFont(mono); text("word", 12, 60);
Sets the current font that will be drawn with the text() function. Fonts must be created for Processing with createFont() or loaded with loadFont() before they can be used. The font set through textFont() will be used in all subsequent calls to the text() function. If no size parameter is input, the font will appear at its original size (the size in which it was created with the "Create Font..." tool) until it is changed with textSize().
Because fonts are usually bitmapped, you should create fonts at the sizes that will be used most commonly. Using textFont() without the size parameter will result in the cleanest type.
With the default and PDF renderers, it's also possible to enable the use of native fonts via the command hint(ENABLE_NATIVE_FONTS). This will produce vector text in both on-screen sketches and PDF output when the vector data is available, such as when the font is still installed, or the font is created dynamically via the createFont() function (rather than with the "Create Font..." tool).
textFont(which) textFont(which, size)