textDescent()
Returns the descent of the text.
The textDescent() function calculates the distance from the baseline to the lowest point of the current font. This value represents the descent, which is essential for determining the overall height of the text along with textAscent().
Examples

require("L5")
function setup()
size(150, 100)
windowTitle("textAscent()/textDescent() example")
background(240)
fill(0)
textAlign(LEFT, BASELINE)
local baselineY = 60
local msg = "Hello"
text(msg, 20, baselineY)
stroke(255, 0, 0)
local topY = baselineY - textAscent()
line(20, topY, 20 + textWidth(msg), topY)
stroke(0, 0, 255)
local bottomY = baselineY + textDescent()
line(20, bottomY, 20 + textWidth(msg), bottomY)
describe("The text Hello with a red line above and a blue line below.")
end
Syntax
textDescent()
Returns
Number: The descent value in pixels.
Related
This reference page contains content adapted from p5.js and Processing by p5.js Contributors and Processing Foundation, licensed under CC BY-NC-SA 4.0.