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. Unity 2022.2 is now available as the latest Tech release.
    Dismiss Notice
  3. We are making some changes to the DOTS forums.
    Dismiss Notice
  4. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

TMP "Font Units" Spacing Broken after Updating from 1.3.0 to 1.4.1

Discussion in 'UGUI & TextMesh Pro' started by bstockwell, Jun 28, 2019.

  1. bstockwell

    bstockwell

    Joined:
    Apr 6, 2018
    Posts:
    7
    So I have a decent amount of UI in this game that uses "Font Units" in various places, example strings:

    "<mspace=2.2em>00:03:49</mspace>"
    "
    2<voffset=-0.25em><space=1em><sup>nd</sup>"

    Here is how the text looked before upgrading TMP:



    Here is how the Text looks after upgrading to 1.4.1 :




    This is the string: "<mspace=2.2em>00:03:49</mspace>"

    Here is another before and after:

    Before:


    After:


    Here is the string: "2<voffset=-0.25em><space=1em><sup>nd</sup>"


    Is there anyway to fix this with TMP Settings or Font Asset Settings?

    The only notable change log said this:
    • Fixed an issue where rich text tags using pixel (px) or font units (em) were not correctly accounting for orthographic camera mode. This change only affects the normal TMP text component.
    What changed that cause this to be broken now? How can I easily fix it with out manually checking what "em" number makes it look like the way it used to?

    Thanks!
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,576
    My apologies as I did change the handling of spacing since it was incorrect in previous releases. This should have also made it into the release notes.

    Subsequent to the changes, using something like <mspace=50px> will now correctly space the characters by 50 pixels. Using <mspace=1em> when the point size is 50 will also now result in the characters being spaced by 50 pixels.

    Spacing options in the Inspector have also been revised (in the next release 1.4.2) where the values now specified in 1/100 em will also result in the correct spacing.

    In terms of how to adjust existing values to account for this change, let me take a look to see if I can come up with some simple solution / migration there.

    Note: In previous releases, 1em equaled the width of 1 space character. Now like I said above, 1em will equal 1 pixel * point size.
     
    Last edited: Jul 1, 2019
    Deleted User likes this.