|Processing.js Behavior||Font support for the Canvas element varies across browsers. FireFox currently has the best support, but still uses a pre-defined set of fonts. (Documentation to follow soon.) Good alternatives to the browser's Canvas-font functions are available: such as the Glyph method. See also: Canvas Text, BurntToys Bauhaus.
PFont font; // The font must be located in the sketch's // "data" directory to load successfully font = loadFont("FFScala.ttf"); textFont(font, 32); text("word", 15, 50);
PFont is the font class for Processing. 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.
|Usage||Web & Application|