Get width/height of text("Hello world!", x, y)?

Is there someway to ascertain the width and height of text printed via text("Hello world!", 100, 100);?

Thanks!

Hi,

You can check those functions in the reference :

Calculates and returns the width of any character or text string.

The ascent represents the distance, in pixels, of the tallest character above the baseline.

The descent represents the distance, in pixels, of the character with the longest descender below the baseline.

Note that the results of all those functions depends on the font size that you can set with textSize() function.

1 Like

I don’t know why but I really didn’t think this would be possible.

Thanks so much!

2 Likes