Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

TextMesh Pro TMP size tag issue (2.1.0 preview 11)

Discussion in 'UGUI & TextMesh Pro' started by ameinfjg, Apr 24, 2020.

  1. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    This seems to have stared with preview 10 or 11 but I'm not certain of that yet. I also don't have a clear repro but I'm still trying. When a <size> tag is used on certain text elements with auto-sizing set to a very high max value some unusual spacing occurs
    upload_2020-4-24_10-23-48.png
     
  2. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    I just discovered that it occurs when BOLD is enabled. I will submit a bug shortly.
     
  3. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Thank you for submitting the bug report.

    I had a chance to take a closer look at this case and everything is actually working as expected but the behavior is certainly not intuitive.

    As it turns out, you have a text object with auto-size with a huge range of 18 - 5000 point size where the optimum point size ends up at 2544.6.

    The text contains <size=16> which affects the entire text and forces it to remain 16 points where as such it won't be affected by auto size.

    The text is also bold which results in additional spacing between characters. The amount of additional spacing is defined on a per font asset basis and contained in the Font Weight - Bold Spacing section of the Font Asset Inspector. The bold spacing value by default is 7. All spacing adjustments values represents 1 / 100 em which in this case is 7 / 100 em. For example, if the point size is 100 and the spacing value is 100 or 100 / 100 or 1em, the additional spacing would be exactly 100 pixels.

    Spacing adjustments like Character, Word, Line, Paragraph, <cspace>, <mspace>, etc. as well as the Bold Spacing are all based on the point size of the text object which in this case being 2544.6 ends up being 7 / 100 * 2544.5 pixels between characters. Given our text has a fixed point size of 16, this additional spacing is massive and certainly looks weird.

    Did you mean to use a fixed point size of <size=16> with auto-size?

    The size tag value can be defined as fixed value <size=16>, relative size <size=+2>, font units <size=1.5em> or as percentage <size=85%>.

    Using Percentage or Font Units (em) would be more appropriate with auto-size whereas fixed size and relative size not so much.

    Let me know your thoughts on the above.
     
  5. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    The content of the label is player-driven and we wish to let them keep using size tags but have the game fall back to auto-sizing the text if none is used.

    Edit: We don't have this issue in 2.0.1 by the way
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Auto-size with that large of a min - max is bound to cause other issues. You are going from a point size of 16 to 2544... At 2544 the bold spacing is extreme which makes this seem much worst.

    I will take a look at perhaps having bold spacing be affected by current scale instead of object point size.
     
  7. ameinfjg

    ameinfjg

    Joined:
    Feb 14, 2017
    Posts:
    78
    Is there any update or progress on this?
     
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Preview 12 should be available tomorrow.