Could we limit wrapping by words

Hey.
Is there a way to configure line breaking to keep words in text intact?

Basically, I’d like to force a single word per line for existing text which is kinda not that hard to set up with single language, but with some localization there is usually different word length, so yes, it’s actually requires you to turn wrapping off and modify text to include line breaker(“\n”) or it’s gonna cut some characters to next line when text is too long. Which is a little bit of headache.

Thoughts?

Line breaking always breaks on words unless the width of the text container cannot fit a particular word on a single line. Ie. by default it does not break words unless the word doesn’t fit.

For Asian language which typically do not use spaces, the list of Line Breaking Leading and Following characters which is referenced in the TMP Setting is used to determine where it is appropriate to break a line.

1 Like

Well, I see that TMP by default does not break words unless the word doesn’t fit, but I actually wonder if there a way to not break line even when word does not fit inside provided width.

Would you be kind to clarify, please - Is list of Line Breaking Leading and Following characters is somehow suitable for not asian languages and if so, could I configure it somehow to break line where is spaces only?

Thank you for your response.

What behavior / result would you expect when a word cannot be wrapped? Would you expect the remaining characters to go outside the bounds of the text container?

The Line Breaking rules are specific to East Asian languages. These also only define where it is legal to break lines.

That’s right, I do expect remaining characters to go outside of the bounds, since overflow allows to display then words in such manner.
In fact, when I implemented localization it was little bit of frustrating moment to find out that some characters appeared on next line.

Here. It’s ~kind of what I am talking about.
Custom example

In both cases here expected two words, but since in russian words usually a bit longer - “Заданный” here have drop character “й” on next line.

4778063--455585--Аннотация 2019-07-24 004650.png

Making text object wider will force english text here to be single lined and it’s mean that line breaking suppose to be managed manually for each case to keep overall style uniform.
Also, if there is some user provided localization that might be created by modders - then they’re suppose to concern such moments, which is might be a little bit inconvenient.

Here is what I am looking up to. In this example text bellow has been manually set to wider.

4778063--455618--Аннотация 2019-07-24 011500.png

4 Likes

Same problem

1 Like

I think this could solve your solution?
https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/manual/RichTextNoBreak.html#top