a port of the Processing Visualization Language
Name

PFont

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.

Please use the following demos to learn how fonts can be rendered in Firefox with Processing.js: Letters, Words, textWidth()

Examples
example pic
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);
Description

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.

Methods
PFont.list() Gets a list of the fonts installed on the system.
Constructor
PFont()

PFont(input)

Parameters
input InputStream
Usage Web & Application
Related loadFont()
textFont()
createGraphics()

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub