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

- 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 | ### textWidth()
Examples |
    textSize(28);

    char c = 'T';
    float cw = textWidth(c);
    text(c, 0, 40);
    line(cw, 0, cw, 50);

    String s = "Tokyo";
    float sw = textWidth(s);
    text(s, 0, 85);
    line(sw, 50, sw, 100);
Description | Calculates and returns the width of any character or text string.
Syntax |
    textWidth(c)
    textWidth(str)
Parameters |
c | char: the character to measure
str | String: the String of characters to measure
Returns | float
Related | loadFont() text() textFont() textSize()

Updated on January 9, 2020 00:33:10pm EST