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.
| Name |
PFont |
| Examples | 
PFont font;
// The font must be located in the sketch's
// "data" directory to load successfully
font = loadFont("LetterGothicStd-32.vlw");
textFont(font, 32);
text("word", 10, 50);
|
| Description |
PFont is the font class for Processing. To create a font to use with Processing, select "Create Font..." from the Tools menu. This will create a font in the format Processing requires and also adds it to the current sketch's data directory. Processing displays fonts using the .vlw font format, which uses images for each letter, rather than defining them through vector data. The loadFont() function constructs a new font and textFont() makes a font active. The list() method creates a list of the fonts installed on the computer, which is useful information to use with the createFont() function for dynamically converting fonts into a format to use with Processing.
|
JavaScript
Notes |
Use a "@pjs font" directive to preload font files before your sketch starts:
/* @pjs font="Arial.ttf"; */
Please see this page for details on font handling in JavaScript mode:
http://wiki.processing.org/w/Font_handling_in_JavaScript_mode
|
| Methods |
| list() |
Gets a list of the fonts installed on the system |
|
| Constructor | PFont()
PFont(font, smooth)
PFont(font, smooth, charset)
PFont(font, smooth, charset, stream)
PFont(input)
|
| Parameters |
| font |
Font: font the font object to create from |
| smooth |
boolean: smooth true to enable smoothing/anti-aliasing |
| charset |
char[]: array of all unicode chars that should be included |
| input |
InputStream: InputStream |
|
| Related | loadFont()
|
Updated on February 19, 2013 07:58:55pm EST