Does Line Break work on the GUI text node?

I thought the Line Break function for the Text node would automatically break lines according to the node’s size, but it doesn’t seem to work that way.

Am I missing a setting? Or am I simply misunderstanding the feature?

When Line Breaks are enabled it simply means that line breaks in the text are respected. It does not mean that Defold will automatically measure and line break the text for you.

1 Like

That’s wrong, the Line Break option actually does automatically measure and break the text into lines. And manual line breaks are even respected if you disable the Line Break option.

The problem with the example in the screenshot is that there is no space. Defold will break lines after a word when the next word would cross the width of the text node, but it will not break words into single characters. So if there is only one word without space, then there are no line breaks to apply between words.

So if you use space between words and the width of the text node is larger than the longest word, then the lines will never cross the width. If you actually intend to have the text break after characters instead of after words, you would have to write a script that inputs a zero-width space (​) after each character (and add the zero-width space to the font).

6 Likes

Oh man, yes, you are right. How could I forget?!

2 Likes