Wrapping with Chinese

HI All

I am using TMP with chinese, and the wrapping is not my expect

7304440--884809--upload_2021-7-7_11-33-3.png

right now I through RichText \n to make it
have any smarter way?

plus 7304446--884818--upload_2021-7-7_11-40-59.png

Line breaking for Chinese, Japanese and Korean is based on the Leading and Following Character rules which define where it is legal to break a line of text. The list of leading and following characters is defined in the TMP Settings which can be edited.

Based on the above rules, the text would break after ‘文’ since this character is allowed to be at the end of a line. Since the series of “rrrrrrrr” are considered a word (Latin text), the word wraps to the next line. Since the whole word (“rrrrrr”) doesn’t fit on the 2nd line, we then have to break the word which is why the last “r” is on the third line.

As you have shown in your image, the text breaks as follows:

7304920--884929--upload_2021-7-7_1-6-15.png

Here is the same text in Microsoft Word.

7304920--884932--upload_2021-7-7_1-7-4.png
As you can see, TMP breaks the text exactly as it does in Microsoft Word and other text processors / editing tools.

Having said that, you can prevent the text from breaking between the word “Chinese” and the series of “r” by using the or no break tag as seen below:

“中文rrrrrrrrrrr”

7304920--884941--upload_2021-7-7_1-10-55.png

1 Like

WOW amazing!
I didn’t know before it able Line breaking rules
is working for me ,thanks a lot!

how to avoid any line breaking? for example : rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

it still breaks at space position and get a result :
7311481--886369--upload_2021-7-9_14-25-27.png

how to stop any line breaking???

Given the following text: “AB CDEF GH”

We get the following on a single line.
7311520--886384--upload_2021-7-8_23-40-20.png

Then once we can no longer fit everything on a single line, we break on the as seen below.
7311520--886387--upload_2021-7-8_23-41-44.png

Then as we can no longer fit any of the no break groups on a single line, we actually break where it is legal which is at the space between AB and CD.
7311520--886390--upload_2021-7-8_23-43-11.png

If we were to further reduce the width of the text container, we would then break between EF and GH. Then pass that point, we begin breaking on individual characters.

So in your example with all those “r” since we can no longer respect the no break, we break on those spaces between the sequences of "r"s.

Now if we had the following text:

“AAAABBBBCCCC”

Would we expect the text to break on the last C or to break at those if again we could no longer respect the no break?

What is the use case for breaking those individual “r” or breaking on the last C above?

I can certainly rationalize breaking on the last C given we added those in the example above. But in the case of those “r” and given the text does contain logical breaks (spaces) it would seem logical to respect those when we can no longer respect the no break. Thoughts…

Thank you, in some cases, I don’t want to wrap the whole word,
but only part of the word. for example:
7318492--887959--upload_2021-7-12_11-8-23.png
got:
7318492--887965--upload_2021-7-12_11-9-25.png
what i expected is :
7318492--887971--upload_2021-7-12_11-9-44.png

7318492--887959--upload_2021-7-12_11-8-23.png
7318492--887965--upload_2021-7-12_11-9-25.png
7318492--887971--upload_2021-7-12_11-9-44.png

In your 2nd example, is that text enclosed in tags or do you expect it to not break on the white space between “g h”?

what is expected is like: https://discussions.unity.com/t/765309/3

https://discussions.unity.com/t/756186/8

abcdefg hijkl has no effect, “hijkl” still breaks to next line.

Correct. As per one of my previous posts, when the text enclosed in the tag can no longer fit on a single line, we then break the text using logical break points which are typically white spaces. When this is no longer possible, we then break individual words.

My previous post to you was a question about whether or not your example was using the tag which it appears it was.

I am not opposed to adding additional line breaking modes, I am just trying to get a clear understanding of the use case to make sure these new modes achieve the desired result. So back to one of my previous questions:

In the current releases of the TMP package, If the text was “abcdefg hijkl” where the width of the text container is such that the entire text doesn’t fit on a single line, we would break on the space between “g” and “h”.

However, if the text was “abcdefghijkl” where we would then break on the “k” as per your example, would that be acceptable?

The key difference here is having to use the non-breaking space to indicate that we do not want to break between these two words.

P.S. I made the change where using a will force breaking per character as described above.

In this first example, the text is “AB CD EF GW” resulting “CD EF” wrapping as a single word and then between “CD” and “EF” when we are forced to break it. This is the current behavior.

7325872--889474--2021-07-14_0-07-36.gif

In this 2nd example, we revise the text as follows: “AB CDEF GW” to use to force breaking “CD EF” per character when it no longer fits on a single line.

7325872--889480--2021-07-14_0-08-32.gif

Character content is uncertain,so it’s hard to add , if there is a checkbox to control character wrapping, that will be very convenient.

yeah, encountered the same problem. if there is a wrapping mode, that will be better.