Search Unity

Occassionally get -Infinity in Glyph pairs

Discussion in 'UGUI & TextMesh Pro' started by joonturbo, Nov 20, 2020.

  1. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    77
    Observed on Unity 2019.4.9f1
    TMPRO 2.1.3
    Font: Lato Bold


    I'm regularly getting glyph pair AX values that are -Infinity, and those end up throwing wrapping completely out of whack.

    Bad wrapping example:
    upload_2020-11-20_13-59-17.png

    if I inspect the [áv] glyph pair, I see AX -Infinity.

    upload_2020-11-20_13-59-2.png

    if I manually change it to 0, it also recovers
    upload_2020-11-20_14-1-15.png

    How do I get the atlas generator to never put -Infinity in any of the glyph pair values, or worst case how do I iterate over them to fix it in code?
     

    Attached Files:

  2. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    77
    the atlas is set to dynamic, but otherwise no special settings have been set.
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    A while back (in 2019.4.1f1) I did fix an issue that was causing adjustment pairs to potentially return an adjustment value of -infinity so I am not sure why this would still be occurring in 2019.4.9f1.

    I just tested with Lato-Bold and getting an adjustment value of -1.625 between "áv" with default Sampling Point Size of 90 with padding of 9.

    Since you are using a Dynamic Font Asset, I would suggest using the Reset context menu and then creating a text object with those character to see if you get the same adjustment values or still -inifinty.
     
  4. joonturbo

    joonturbo

    Joined:
    Jun 24, 2013
    Posts:
    77
    resetting the dynamic atlas (or even clearing it on build) does fitx it... for a while
    it seems to do it _sometimes_ and not on every platform :(
    could not find stable reproduction steps unfortunately.
    we're moving back to static atlases to avoid this.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You can disable fetching adjustment pairs at runtime in the TMP Settings. This would enable you to continue using dynamic font asset and prevent you running into this issue until I can figure out what might be causing it.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I finally stumbled upon this behavior while testing and have resolved this issue.

    The fix will require a new version of Unity as the issue is in the Font Engine which is native code part of the Unity and not the TMP package.

    I should be able to get this fix to land in all versions of Unity.