# Text function wrapping - Hyphens vs Full word line break

**URL:** <https://discourse.processing.org/t/text-function-wrapping-hyphens-vs-full-word-line-break/29975>\
**Category:** Coding Questions\
**Created:** [May 9, 2021, 2:43am UTC](https://discourse.processing.org/t/text-function-wrapping-hyphens-vs-full-word-line-break/29975 "2021-05-09T02:43:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikthelegend](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@mikthelegend](https://discourse.processing.org/u/mikthelegend)\
**Post date:** [May 9, 2021, 2:43am UTC](https://discourse.processing.org/t/text-function-wrapping-hyphens-vs-full-word-line-break/29975/1 "2021-05-09T02:43:52Z")

</div>

Hello! I’m having trouble using the text() function in p5.js.

I understand that when you provide 5 inputs to the function, the last four describe a rectangle in which it will wrap your provided string. However, in some of my projects it wraps the text by hyphenating the words that cross the box, and moving the rest of the word to the next line, and in other projects if a word crosses the box it moves the entire word to the next line.

Ex 1:  
The quick brown fox jump-  
ed over the lazy dog.

Ex 2:  
The quick brown fox  
jumped over the lazy dog.

My issue is that I don’t know how to tell the function which of these options I want.  
In most instances I’d prefer the second option, but p5.js seems to be deciding at random which option it takes.

Thanks in advance to anyone who can help me with this! 🙂

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [May 9, 2021, 8:02am UTC](https://discourse.processing.org/t/text-function-wrapping-hyphens-vs-full-word-line-break/29975/2 "2021-05-09T08:02:06Z")

</div>

When your text is always the same you can use `\n` to make a manual line break

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [May 9, 2021, 11:12am UTC](https://discourse.processing.org/t/text-function-wrapping-hyphens-vs-full-word-line-break/29975/3 "2021-05-09T11:12:02Z")

</div>

Hi! Welcome to the forum!

are you sure that hyphenation happens with `text` function and not with DOM? I don’t see it implemented besides the recent addition of [`textWrap`](https://github.com/processing/p5.js/pull/5146) (it will be added in the next release it seems). It would be great if you can provide an example.
