Search Unity

TextMesh Pro Style font alignment issue

Discussion in 'UGUI & TextMesh Pro' started by gumboots, Jun 24, 2020.

  1. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Hi all,

    I have a controller glyph font. It aligns perfectly with my regular font (Open Sans) using a style tag. I have another font (Noto Sans) for Simplified Chinese that uses Open Sans as the fallback. These two fonts also align perfectly.

    However the controller glyph font aligns incorrectly with Noto Sans. Here's a screenshot of what I mean:


    (Top is Open Sans + glyphs, middle is Noto Sans + Open Sans, bottom is Noto Sans + glyphs)

    Here is a screenshot of the TextMesh Pro UGUI component. I change the font asset at runtime:



    Any help is greatly appreciated! I just can't figure this out.

    Edit: Sorry I should also note that I'm on Unity 2017.4.39f1, and I'm using the last TextMesh Pro from the private forums.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The behavior is related to the font face info metrics being different. Most specifically the Ascender, Descender, etc. do not match.

    See the following post about normalizing these face info metrics.
     
  3. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Ah, thanks @Stephan_B, I'll try adjusting these! The other issue I'm having is that Noto doesn't seem to use Open Sans' ellipsis as a fallback. I get the warning:

    Unable to use Ellipsis character since it wasn't found in the current Font Asset [NotoSansTC-Medium SDF]. Consider regenerating this font asset to include the Ellipsis character (u+2026).


    I don't suppose there's anyway around this?

    Edit: Sorry one more question: I have to regenerate this font later, once I have the complete translation. Is there a way to keep these values when I regenerate? Or will I have to do it twice?
     
    Last edited: Jun 24, 2020
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What version of the TMP package are you using? In the latest release which is Preview 14, TMP should be able to find the Ellipsis character in the Primary font asset or any potential fallbacks.

    No but adjusting the face metrics to normalize its values to match with the Primary font asset is pretty simple and quick.

    Having said that, the ability to preserve these adjustments when the font asset is updated / regenerated has been requested a few times and something I will look into when I have time.
     
  5. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Yes.

    Although the upgrade process might be a pain, you only have to go through it once.

    Provide you follow the instructions in the top sticky post above about the migration, you should not have any issues. Thousands of users have gone through this process.
     
  7. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    @Stephan_B Unfortunately that guide seems to be for the Package Manager, but I'm on 2017.4.39f1.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Correct and unfortunately updated releases of TMP are only available via the package manager.

    Are you planning on migrating to newer versions of Unity at some point?
     
  9. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    No, it's not really feasible as we're quite close to release and I don't want to risk any kind of major issues.