- Processing
- p5.js
- Processing.py
- Processing for Android

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name | ### textFont()
Examples |
    PFont mono;
    // The font "andalemo.ttf" must be located in the
    // current sketch's "data" directory to load successfully
    mono = loadFont("andalemo.ttf", 32);
    background(0);
    textFont(mono);
    text("word", 12, 60);
Description | Sets the current font that will be drawn with the text() function. Fonts must be created for Processing with createFont() or loaded with loadFont() before they can be used. The font set through textFont() will be used in all subsequent calls to the text() function. If no size parameter is specified, the font size defaults to the original size (the size in which it was created with the "Create Font..." tool) overriding any previous calls to textFont() or textSize(). When fonts are rendered as an image texture (as is the case with the P2D and P3D renderers as well as with loadFont() and vlw files), you should create fonts at the sizes that will be used most commonly. Using textFont() without the size parameter will result in the cleanest type.
Syntax |
    textFont(which)
    textFont(which, size)
Parameters |
which | PFont: any variable of the type PFont
size | float: the size of the letters in units of pixels
Returns | void
Related | createFont() loadFont() PFont text() textSize()

Updated on November 10, 2017 05:36:29pm EST