Static p5_sys::global::textDescent[][src]

pub static textDescent: TextDescentInternalType
Expand description

Returns the descent of the current font at its current size. The descent represents the distance, in pixels, of the character with the longest descender below the baseline.

Examples

let base = height * 0.75;
let scalar = 0.8; // Different for each font

textSize(32); // Set initial text size
let desc = textDescent() * scalar; // Calc ascent
line(0, base + desc, width, base + desc);
text('dp', 0, base); // Draw text on baseline

textSize(64); // Increase text size
desc = textDescent() * scalar; // Recalc ascent
line(40, base + desc, width, base + desc);
text('dp', 40, base); // Draw text on baseline