# GUI text wrapping

**URL:** <https://forum.babylonjs.com/t/gui-text-wrapping/39299>\
**Category:** Bugs\
**Created:** [March 23, 2023, 7:11pm UTC](https://forum.babylonjs.com/t/gui-text-wrapping/39299 "2023-03-23T19:11:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrianK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/briank/32/18020_2.png) [@BrianK](https://forum.babylonjs.com/u/BrianK)\
**Post date:** [March 23, 2023, 7:11pm UTC](https://forum.babylonjs.com/t/gui-text-wrapping/39299/1 "2023-03-23T19:11:17Z")

</div>

Hi, what I’d like to do is to truncate the TextBlock’s text to a single line on a word boundary.

- e.g. `Foo Bar Baz` gets truncated to `Foo Bar...`

The way I tried to do this was use `TextWrapping.WordWrapEllipsis` and then to set the text block’s height to it’s font size in pixels, with the idea being that it will not wrap to another line.

What I see is a bit strange, instead of ellipsis truncating, the final space is removed.

- e.g. instead of `Foo Bar...`, the text shows `Foo BarBaz` (last space missing, no truncation).

It’s certainly related somehow to the measurement, as it only repros at certain widths and text sizes.

Here is a sample playground: [Simple GUI in fullscreen mode | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#XCPP9Y#18079)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [March 23, 2023, 7:15pm UTC](https://forum.babylonjs.com/t/gui-text-wrapping/39299/2 "2023-03-23T19:15:50Z")

</div>

Definitely looks like a bug, @carolhmj can you have a look ?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [March 23, 2023, 7:34pm UTC](https://forum.babylonjs.com/t/gui-text-wrapping/39299/3 "2023-03-23T19:34:36Z")

</div>

Assigned @carolhmj on March 23, 2023, 7:34pm UTC



---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [March 23, 2023, 8:11pm UTC](https://forum.babylonjs.com/t/gui-text-wrapping/39299/4 "2023-03-23T20:11:26Z")

</div>

Indeed it was, thanks for reporting Brian! 😃 A fix is here: [Fix word wrap ellipsis algorithm. by carolhmj · Pull Request #13669 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/pull/13669)

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [March 24, 2023, 12:28pm UTC](https://forum.babylonjs.com/t/gui-text-wrapping/39299/5 "2023-03-24T12:28:51Z")

</div>

Unassigned @carolhmj on March 24, 2023, 12:28pm UTC


