Search Unity

TextMesh Pro Auto Size and Wrap Problem

Discussion in 'UGUI & TextMesh Pro' started by LeopardLiang, Jul 23, 2019.

  1. LeopardLiang

    LeopardLiang

    Joined:
    Feb 14, 2019
    Posts:
    9
    Unity v2019.1
    TMP v2.0.1


    These are the TextMeshPro settings
    upload_2019-7-23_12-18-50.png


    When i enter a shorter text, It looks all right
    upload_2019-7-23_12-19-49.png


    But....When a long text is entered, It seem smaller than before, but there is still enough below to show the original size. So Why did it shrink before warp? According to my understanding, the Auto Size option means Text will shrink when space is not enough, Did I get it wrong?
    upload_2019-7-23_12-23-5.png
     

    Attached Files:

  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Auto-Size will increase or decrease the point size of the text while avoiding to break up words.

    In your example, the sequence of characters is considered a single word and as such the text point size will be reduce up to the min value in order to avoid breaking up this long word.
     
  3. LeopardLiang

    LeopardLiang

    Joined:
    Feb 14, 2019
    Posts:
    9
    Thanks for the reply.
    I'm using Asian languages, It usually does not use spaces to partition words, Instead, punctuation is used.
    so is there any option can disable "avoiding to break up words"? or other useful option?
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    With Asian languages, it should be using the list of Line Breaking Leading and Following character referenced in the TMP Settings.

    These specific line breaking characters allow line breaking for Asian characters which should also work with Auto-Size.
     
  5. LeopardLiang

    LeopardLiang

    Joined:
    Feb 14, 2019
    Posts:
    9
    Thanks.
    I just tried it. This can solve part of the problem, but actually in most cases, Texts using Auto-Size have no LineBreaking Following Characters, like Chinese. it is not divided into many words like English. Many times a sentence is connected and very long, A new line does not affect its meaning as other languages do, so we don't want them to wrap.

    So it would be very helpful if there was an option to disable the "break up words".
     
  6. LeopardLiang

    LeopardLiang

    Joined:
    Feb 14, 2019
    Posts:
    9
    Hey Stephan.
    I'm looking at the source code, and i found this in the script "TMPro_UGUI_Private.cs".
    upload_2019-7-23_17-18-2.png

    When I deleted this judgment.
    Just like this:
    upload_2019-7-23_17-19-20.png

    It work!
    upload_2019-7-23_17-24-20.png

    upload_2019-7-23_17-25-1.png
    That's what I want!
    But I haven't read all the source code yet, and I'm not sure if this change will lead to other problems.
    So can you give me some suggest?
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Take a look at the list of Line Breaking Leading and Following character referenced in the TMP Settings. These list define where it is appropriate to break a line for Asian languages. See the following.

    TMP should break correctly with Japanes, Chinese and Korean text provided the list of line breaking characters hasn't been remove or all characters removed from them.