How to add line breaking in Japanese?

Hi all,

I have the following text in Japanese:

これらの手紙があなたを見つけてくれますように。

When the container is scaled down, it should break like this.

これらの手紙があなたを
見つけてくれますように。

Currently my barebones repro project just wraps on every character. I tried adding zero width spaces, or even a regular space, and it still wraps for every character. Example below has multiple spaces for demonstration purposes.

What is the correct way to do this? Should TextMeshPro be able to do this automatically, or is there some sort of optional line break character we need to add.

Any help would be great!

Use

It uses HTML mark-up

For better semi automated line breaking in TMP you migh be interested in reading this response from StephanB No Line Breaks in Japanese After 、Character

You can either manually prevent breaking in some range using tags. Or in project TMP settings you can specify two lists of chracters “Leading Characters” and “Following Characters”. Assuming I understood correctly TMP will avoid inserting a line break after “Leading Characters” and before “Following characters”.

1 Like

Thanks for replies, I found the correct answer here: ugui Text doesn't work well with Chinese/Japanese

is no good as it’s supposed to be an optional break not a forced break, and leading/following characters also isn’t sufficient as it doesn’t break between words. Weird the above isn’t documented anywhere.