[]
A sequence of strings representing the fonts on this system available for use. Because of limitations in Java, not all fonts can be used and some might work with one operating system and not others. When sharing a sketch with other people or posting it on the web, you may need to include a .ttf or .otf version of your font in the data directory of the sketch because other people might not have the font installed on their computer. Only fonts that can legally be distributed should be included with a sketch.
[name size smooth charset]
[name size smooth]
[name size]
Dynamically converts a font to the format used by Processing (a PFont) from either a font name that's installed on the computer, or from a .ttf or .otf file inside the sketches 'data' folder. This function is an advanced feature for precise control. Use available-fonts to obtain the names for the fonts recognized by the computer and are compatible with this function. The size parameter states the font size you want to generate. The smooth parameter specifies if the font should be antialiased or not, and the charset parameter is an array of chars that specifies the characters to generate. This function creates a bitmapped version of a font It loads a font by name, and converts it to a series of images based on the size of the font. When possible, the text function will use a native font rather than the bitmapped version created behind the scenes with create-font. For instance, when using the default renderer setting (JAVA2D), the actual native version of the font will be employed by the sketch, improving drawing quality and performance. With the :p2d, :p3d, and :opengl renderer settings, the bitmapped version will be used. While this can drastically improve speed and appearance, results are poor when exporting if the sketch does not include the .otf or .ttf file, and the requested font is not available on the machine running the sketch.
[font-str]
Returns true if font (specified as a string) is available on this system, false otherwise
[filename]
Loads a font into a variable of type PFont. To load correctly, fonts must be located in the data directory of the current sketch. To create a font to use with Processing use the create-font fn. Like load-image and other methods that load data, the load-font fn should not be used inside draw, because it will slow down the sketch considerably, as the font will be re-loaded from the disk (or network) on each frame. For most renderers, Processing displays fonts using the .vlw font format, which uses images for each letter, rather than defining them through vector data. When hint :enable-native-fonts is used with the JAVA2D renderer, the native version of a font will be used if it is installed on the user's machine. Using create-font (instead of load-font) enables vector data to be used with the JAVA2D (default) renderer setting. This can be helpful when many font sizes are needed, or when using any renderer based on JAVA2D, such as the PDF library.
[s x1 y1 x2 y2]
[s x y]
[s x y z]
Draws text to the screen in the position specified by the x and y parameters and the optional z parameter. A default font will be used unless a font is set with the text-font fn. Change the color of the text with the fill fn. The text displays in relation to the text-align fn, which gives the option to draw to the left, right, and center of the coordinates. The x1, y1, x2 and y2 parameters define a rectangular area to display within and may only be used with string data. For text drawn inside a rectangle, the coordinates are interpreted based on the current rect-mode setting.
[c x y z]
[c x y]
Draws a char to the screen in the specified position. See text fn for more details.
[font]
[font size]
Sets the current font that will be drawn with the text function. Fonts must be loaded with load-font before it can be used. This font 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 until it is changed with text-size. Because fonts are usually bitmaped, you should create fonts at the sizes that will be used most commonly. Using textFont without the size parameter will result in the cleanest-looking text. With the default (JAVA2D) 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 JAVA2D sketches and PDF output in cases where the vector data is available: when the font is still installed, or the font is created via the create-font fn
[num x y]
[num x y z]
Draws a number to the screen in the specified position. See text fn for more details.