Horizontal wrap causing text size of Chinese characters to shrink

Hello. I am working on an application built by someone else previously, and I have been asked to make some changes. One of these was adding Chinese translations of the content (provided to us by translators, I don’t know the language myself). I am having a problem with horizontal wrapping causing the text size to become much smaller when working with the Chinese text.

I have attached screenshots to illustrate the issue. As you can see from the first image, when inputting English characters, the text size remains consistent regardless of whether the sentence runs over one or multiple lines. The text card element simply grows in height, as expected.

3453371--273681--01.jpg

Note that each sentence in the “multiple sentences” example is separated by a blank space. I have not entered any manual line breaks.

The second screenshot shows the problem I am having with Chinese test. As soon as the sentence runs over one line, it gets shrunk significantly.

3453371--273682--02.jpg

I realise that part of the problem is that the Chinese character used for a period at the end of a sentence is the following “。” which is a single character that has a small amount of horizontal space built into it. In other words, unlike in English, there actually aren’t any physical blank space characters in between sentences to help the wrapping functionality break up the words accordingly.

This was confirmed when I manually inserted blank spaces after the “。” period character which resulted in normal rendering of the text size. However, this isn’t a suitable solution. Firstly, it is unfeasible for me to go through the application and manually insert spaces into the numerous text boxes that exist. Secondly, even if I could, it still doesn’t entirely fix the problem when there is actually a long sentence without any punctuation characters. It helps a bit, but the text size still gets shrunk, as shown in the final screenshot.

3453371--273683--03.jpg

And not knowing the language, I can’t go around placing random blank spaces in between charcters, as I don’t know if it would change the meaning of the words.

I have attempted to play around with the minimum, preferred, and flexible height values of the Layout Element attached to the text card objects, but nothing seems to help.

If anyone has any suggestions for how I could resolve this, it would be greatly appreciated.

Thank you.

bump!

I have the similar problem using “Best Fit”, Unity resized all Chinese character to smaller font size without wrapping them… English is alright and kept the optimal size coz it’s wrapped.

The only way to fix is disable “Best Fit” for Chinese (and all languages not using white spaces)

Just ran into this implementing multi-lingual support. As long as best fit is enabled (which I have enabled on pretty much everything in case something overflows) it will just shrink the text without trying to word wrap because Japanese doesn’t use spaces. =[

I wonder if there’s a way to check if vertical overflow has kicked in and lower the font size in real time…

Bumping, since this thread shows up on Google when searching solution for the issue described above.

This custom replacement for Unity’s default “text” component fixes the bug. Text without spaces is downsized correctly when “best fit” is enabled.

The only problem with this solution is that it requires replacing Unity’s default text component with a new custom text component.

Found this old report after some more googling. Unity was apparently aware of the bug since 2015 and decided not to fix it.

In the end I copy-pasted com.unity.ugui package into “Packages” project folder (thus creating a custom package override), and edited Text.cs by inserting the fix mentioned above. This allows to resolve the issue and keep using the default Text component without any additional setup.