Static p5_sys::global::textAscent [−][src]
pub static textAscent: TextAscentInternalType
Expand description
Returns the ascent of the current font at its current size. The ascent represents the distance, in pixels, of the tallest character above the baseline.
Examples
let base = height * 0.75; let scalar = 0.8; // Different for each font textSize(32); // Set initial text size let asc = textAscent() * scalar; // Calc ascent line(0, base - asc, width, base - asc); text('dp', 0, base); // Draw text on baseline textSize(64); // Increase text size asc = textAscent() * scalar; // Recalc ascent line(40, base - asc, width, base - asc); text('dp', 40, base); // Draw text on baseline