Search Unity

Bug Dynamic font atlas fallback issue

Discussion in 'UGUI & TextMesh Pro' started by Nyankoooo, Aug 13, 2022.

  1. Nyankoooo

    Nyankoooo

    Joined:
    May 21, 2016
    Posts:
    144
    I'm having the following font setup:

    Static Font Atlas: contains base Japanese characters (hiragana, katakana + a few kanji)
    -> Fallback 1: Static Font Atlas that contains Latin characters only
    -> Fallback 2: Dynamic Font Atlas that has the same source font as the original font atlas (for Japanese characters)

    What I expect: When typing a kanji that is not in the source static font atlas, TMP will check the first fallback for the character. It will not find it, so it will look in the second fallback. Because it is dynamic and possible to display with the source font, it will display it correctly.

    What I see: Instead of the kanji, the square symbol is shown, which indicates that the kanji couldn't be found.

    I double-checked, and the kanji can be displayed with the font source, so I'm not sure what is happening here.

    Also, the reason for the non-Japanese font fallback is that I want to display Japanese and Latin at the same time. When switching Fallback 1 and Fallback 2, the Japanese font displays all Japanese characters, which doesn't look good.
     
    Last edited: Aug 14, 2022
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The above should be working.

    Can you post an image of your fallback setup (just to confirm the above).

    What is the font file that you are using? Can you provide a link to it for me to check its glyph coverage.

    Lastly can you post an example of the text that you are using for testing just so that I can copy / paste?

    Once I have the above information, I'll test this on my end and report my findings.
     
  3. Nyankoooo

    Nyankoooo

    Joined:
    May 21, 2016
    Posts:
    144
    @Stephan_B Thank you for looking into this! You can find the screenshots below. I will also send you the font via private message.

    The test text would be 近頃. I will also include my text file from which I created my main font atlas in the private message.
     

    Attached Files:

  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for providing the additional information and PM with the font file.

    I am able to confirm that your source font file does indeed contain those characters. I seems like the issue might be related to fallback character caching which I will be investigating further tomorrow. This indeed appears to be a bug.

    Although I will be investigating this directly, please submit a bug report with project / steps to reproduce as this will make it easier for other to track within Unity and document once fixed. On my end, I'll try to get your a potential code fix that you can make locally in your TMP package.