Reference for Processing version 1.2. 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 | textFont() |
||||
---|---|---|---|---|---|
Examples | PFont metaBold; // The font "Meta-Bold.vlw" must be located in the // current sketch's "data" directory to load successfully metaBold = loadFont("Meta-Bold.vlw"); textFont(metaBold, 44); text("word", 15, 50); |
||||
Description | Sets the current font. The font must be loaded with loadFont() 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 (the size it was created at with the "Create Font..." tool) until it is changed with textSize(). 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 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 createFont() function (rather than the Tool). |
||||
Syntax | textFont(font) textFont(font, size) |
||||
Parameters |
|
||||
Returns | None | ||||
Usage | Web & Application | ||||
Related | createFont() loadFont() PFont text() |