GUI text wrapping

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)

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

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

4 Likes