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

**URL:** <https://discourse.processing.org/t/get-width-height-of-text-hello-world-x-y/27611>\
**Category:** Beginners\
**Created:** [February 5, 2021, 7:09pm UTC](https://discourse.processing.org/t/get-width-height-of-text-hello-world-x-y/27611 "2021-02-05T19:09:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [February 5, 2021, 7:09pm UTC](https://discourse.processing.org/t/get-width-height-of-text-hello-world-x-y/27611/1 "2021-02-05T19:09:27Z")

</div>

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

Thanks!

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [February 5, 2021, 7:33pm UTC](https://discourse.processing.org/t/get-width-height-of-text-hello-world-x-y/27611/2 "2021-02-05T19:33:42Z")

</div>

Hi,

You can check those functions in the reference :

- [`textWidth()`](https://p5js.org/reference/#/p5/textWidth)

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

- [`textAscent()`](https://p5js.org/reference/#/p5/textAscent)

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

- [`textDescent()`](https://p5js.org/reference/#/p5/textDescent)

> 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()`](https://p5js.org/reference/#/p5/textSize) function.**

---

<div class="post-metadata">

**Author:** ![Bassam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@Bassam](https://discourse.processing.org/u/Bassam)\
**Post date:** [February 5, 2021, 7:48pm UTC](https://discourse.processing.org/t/get-width-height-of-text-hello-world-x-y/27611/3 "2021-02-05T19:48:00Z")

</div>

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

Thanks so much!
