Search Unity

TextMeshPro - Glyphs are offset when Font Asset is generated with SDF/SDF8/SDF16/SDF32

Discussion in 'UGUI & TextMesh Pro' started by Vedran_M, Oct 16, 2020.

  1. Vedran_M

    Vedran_M

    Joined:
    Dec 16, 2019
    Posts:
    14
    Hello,

    When generating font atlas with SDFAA/SDFAA-HINTED it all looks good, but when generated with SDF/SDF8/SDF16/SDF32, some of the glyphs are vertically offset. And which glyphs are offset and for how much, depends on Sampling Point Size setting.

    For example, number zero is too high when generated with SDF8/16/32 and Sampling Point Size (SPS) of 32, while when generating with SPS=45, both numbers 1 and 0 are a bit too high, and number 1 a bit more than 0:
    upload_2020-10-16_12-16-6.png

    Or up close:
    upload_2020-10-16_12-26-10.png

    For that reason, we can't use SDF16/32 in our game, and we had to switch to SDFAA-Hinted instead. Letters looked too much all around, as some letters are higher and some lower than they should be.

    Steps to reproduce:
    - Noto Sans Black font (https://www.google.com/get/noto/)
    - Generate font atlas with SDF8/16/32, and with custom "Sampling Point Size", e.g. 32
    - Create TextMeshProUGUI component, add some text to it. Some glyphs will be a bit too high or too low.

    Would it be any chance to fix this in upcoming TextMeshPro updates? We would really like to use higher quality SDF fonts.

    Thanks in advance!
     
    Last edited: Oct 16, 2020
  2. Vedran_M

    Vedran_M

    Joined:
    Dec 16, 2019
    Posts:
    14
    Bump for this issue - if this is not fixed, basically we can only use SDFAA and SDFAA-Hinted fonts in production, SDF8/SDF16/SDF32 are unfortunately unusable, even though they're of better quality.
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    What version of Unity are you using as I did fix a similar issue a few months ago.
     
  4. Vedran_M

    Vedran_M

    Joined:
    Dec 16, 2019
    Posts:
    14
    Unity 2019.3.15f1 with TextMeshPro version 2.1.1.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    This issue was fixed in 2019.4.1f1.

    In the event you cannot upgrade to 2019.4, you can always create the font assets in 2019.4 and then copy them into your 2019.3 project.
     
    lyha and Vedran_M like this.
  6. Vedran_M

    Vedran_M

    Joined:
    Dec 16, 2019
    Posts:
    14
    Thanks Stephan!