# How to work with TextBounds in instance mode

**URL:** <https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654>\
**Category:** Beginners\
**Created:** [May 9, 2020, 12:42am UTC](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654 "2020-05-09T00:42:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![murillazo](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@murillazo](https://discourse.processing.org/u/murillazo)\
**Post date:** [May 9, 2020, 12:42am UTC](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654/1 "2020-05-09T00:42:40Z")

</div>

Hi,

I have the following problem, when I try to use textBounds on instance mode im not sure how to do it, is reporting me this error -\> Unable to get property ‘unitsPerEm’ of undefined or null reference.

```auto
let name = "test";
let font = this.loadFont('assets/AvantBold.otf');
let bounds = font.textBounds(name, 0, 0, 32);

```

Im just trying to do this example in instance mode: [https://p5js.org/reference/#/p5.Font/textToPoints](https://p5js.org/reference/#/p5.Font/textToPoints)

---

<div class="post-metadata">

**Author:** ![Sven](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sven/32/8293_2.png) [@Sven](https://discourse.processing.org/u/Sven)\
**Post date:** [May 9, 2020, 7:06am UTC](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654/2 "2020-05-09T07:06:52Z")

</div>

Hello @murillazo,

What the error message is telling you, in a somewhat cryptic fashion, is that variable `font` is `null` or `undefined`. Maybe there’s not a font present at `assets/AvantBold.otf`?

---

<div class="post-metadata">

**Author:** ![murillazo](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@murillazo](https://discourse.processing.org/u/murillazo)\
**Post date:** [May 9, 2020, 7:23am UTC](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654/3 "2020-05-09T07:23:53Z")

</div>

@Sven Problem solved, the problem was the use of the preload function, I wasn’t using it.
