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

textLeading()

Examples
example pic
// Text to display. The "\n" is a "new line" character
String lines = "L1\nL2\nL3";
textSize(12);
fill(0);  // Set fill to black

textLeading(10);  // Set leading to 10
text(lines, 10, 25);

textLeading(20);  // Set leading to 20
text(lines, 40, 25);

textLeading(30);  // Set leading to 30
text(lines, 70, 25);
Description Sets the spacing between lines of text in units of pixels. This setting will be used in all subsequent calls to the text() function. Note, however, that the leading is reset by textSize(). For example, if the leading is set to 20 with textLeading(20), then if textSize(48) is run at a later point, the leading will be reset to the default for the text size of 48.
Syntax
textLeading(leading)
Parameters
leading float: the size in pixels for spacing between lines
Returnsvoid
RelatedloadFont()
text()
textFont()
textSize()
Updated on January 1, 2021 03:38:08am EST