| Name | textLeading() |
||
|---|---|---|---|
| Processing.js Behavior | Font support for the Canvas element varies across browsers. FireFox currently has the best support, but still uses a pre-defined set of fonts. (Documentation to follow soon.) Good alternatives to the browser's Canvas-font functions are available: such as the Glyph method. See also: Canvas Text, BurntToys Bauhaus.
Please use the following demos to learn how fonts can be rendered in Firefox with Processing.js: Letters, Words, width() |
||
| Examples | ![]() PFont font;
// The font must be located in the sketch's
// "data" directory to load successfully
font = loadFont("EurekaMonoCond-Bold.ttf");
// Text to display. The "\n" is a "new line" character
String lines = "LIN1\nLIN2\nLIN3";
textFont(font, 14);
textLeading(10);
text(lines, 5, 25);
fill(126); // Set value to gray
textLeading(20);
text(lines, 36, 25);
fill(0); // Set value to black
textLeading(30);
text(lines, 68, 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. |
||
| Syntax | textLeading(dist) |
||
| Parameters |
|
||
| Returns | None | ||
| Usage | Web & Application | ||
| Related |
loadFont() PFont text() textFont() |