Search Unity

TMP Bug

Discussion in 'UGUI & TextMesh Pro' started by chenlove, Mar 24, 2020.

  1. chenlove

    chenlove

    Joined:
    Mar 24, 2020
    Posts:
    5

    as shown in the figure
    souce code:TMPro_UGUI_Private.cs 3009-3037
     

    Attached Files:

  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Please test with the latest release which is 1.5.0-preview.8 for Unity 2018.4, version 2.1.0-preview.8 for Unity 2019.x and 3.0.0-preview.8 for Unity 2020.x.

    Also please be more specific on what the issue is which I presume is the line breaking after the first CJK character but I just want to be certain.
     
  3. chenlove

    chenlove

    Joined:
    Mar 24, 2020
    Posts:
    5
    You are right!
    The line breaking after the first CJK character or white space.
    The picture which I marded by red rect,these is the reason why line breaking.
    I dont understand why handle this.when I comment this code,it's work.
    my release is 2.0.1.
    i'm sorry,my english is worse.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    This issue should have been resolved in the latest TMP package which is version 2.1.0-preview.8 for Unity 2019.x.
     
  5. chenlove

    chenlove

    Joined:
    Mar 24, 2020
    Posts:
    5
    企业微信截图_1585302289653.png
    企业微信截图_15853023161595.png 企业微信截图_15853023263277.png
    The problem remains unresolved
    my unity version is 2019.3.2f1
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just going over the details to make sure I understand the issue.

    Given the following text: "123456你好7890"

    You would expect the first line break to be as follows:

    123456你好
    7890

    whereas in the current version we get:

    123456你好7
    890

    where the "7" is incorrectly wrapped.

    Please confirm that is the issue.
     
  7. Fizzer

    Fizzer

    Joined:
    Nov 16, 2016
    Posts:
    40
    Hello,

    I think I am running into this bug, too. I just filed case 1231343 with a repro project.

    If I input the string "One two ₩123 three four five" into a Text Mesh Pro UGUI object, it will wrap in the middle of a number. This is a big problem since it makes the number "123" (one hundred and twenty three) look like "1" (one) and "23" (twenty three) since TMP is inserting a line break in the middle of a number.

    Repro steps:

    1. Look at case 1231343's project in the editor, which contains the string "One two ₩123 three four five"

    Actual results:

    The first line reads "One two ₩1" and the second line starts with "23 three four"

    Expected results:

    It should only wrap words where the spaces are. Therefore the first line should fit "One two" since that's all that can fit, and the second line should start with "₩123 three"

    Notes:

    The bug seems somehow related to the unicode ₩, the Korean won symbol. Putting a normal "W" in front of the number does not repro the bug, so the ₩ symbol is somehow messing up Text Mesh Pro.

    I'm in Unity 2018.4.18f1. I am observing this bug in TMP 1.5.0 preview 8. I also tested TMP 1.4.1 but it worked properly (no bug). So this is a bug only in 1.5.0. However, I cannot use TMP 1.4.1 in my project due to bug 1168274, which is broken in TMP 1.4.1 but fixed in 1.5.0.

    I tried messing with the "Use Modern Line Breaking" toggle but doesn't seem to have any affect. I tried removing the ₩ character from "LineBreaking Leading Characters.txt" but it had no effect.

    Thank you for your efforts!
     
  8. chenlove

    chenlove

    Joined:
    Mar 24, 2020
    Posts:
    5
    I confirm that
     
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just letting everyone know that I am still reading and planning on looking at this this week and trying to get whatever potential fix in the next package release which will be preview 9.
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just wanted to provide feedback on the above.

    I have made some improvements to the line breaking handling to address the issues outlined in this thread.

    The first issue is the incorrect breaking between non CJK characters and other characters such as "AB ₩123 CD" where the line would break on "1" instead of breaking before "₩123". Here is a video of the revised behavior.



    The second behavior that has been addressed is when there are no spaces between the CJK character and non CJK character as in this example "AB《你好》CD".



    I have also added support for zero width space tag <zwsp> which can provide additional control in layout. The <nbsp> tag was also added a while back as well as the <nobr> </nobr> tags. All of these to help provide increased control over layout and formatting.

    The above changes will be included in Preview 9 which should be available late this week / over the weekend.
     
    Last edited: Apr 9, 2020
  11. Fizzer

    Fizzer

    Joined:
    Nov 16, 2016
    Posts:
    40
    Thank you!