Search Unity

Bug How to make Fallback Fonts work?? Is this a bug or am I doing it wrong???

Discussion in 'UI Toolkit' started by mikejm_, Aug 11, 2022.

  1. mikejm_

    mikejm_

    Joined:
    Oct 9, 2021
    Posts:
    346
    I am trying to use the built in Font fallback system.

    If, for example, I have a Font set up like this one:

    montserrat.PNG

    Is that set up correctly? I have a font Montserrat Extra Bold and when it encounters missing characters, I want it to use NotoSansCompiled-Medium (which is a massive test almost-full-Unicode font I made).

    However, when I build to Android, if I assign any special language Unicode to a Label with this Font, it does not actually use the fallback. I get ☐☐☐ for the special characters where the fallback could definitely show them.

    I can confirm Unity knows Montserrat Extra Bold doesn't have these characters with Font.HasCharacter(). But yet it still doesn't use the available fallback.

    I see someone else posted the same issue here from 2018 with TMP: https://forum.unity.com/threads/fallback-font-not-used.582295/

    Is this a known bug or are we doing it wrong? If it is not a known bug or usage issue, please let me know and I will submit a bug report.

    Thanks for any help.
     
    Last edited: Aug 11, 2022
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    499
    Hi @mikejm_ !

    The legacy Text system is not supported in UI Toolkit. In fact, we are converting Font to TextCore FontAsset on the fly when provided a Font. This was made to ensure backward compatibility when we switch the TextEngine to TextCore. Note that we are on the verge of deprecating the Legacy text system in favour of TextCore in IMGUI as well. The fallback font system offered by TextCore is both more robust and more comprehensive. It supports Global and local fallback as well as Dynamic OS font and more.

    What are the reasons for using the Legacy Text System over TextCore? My recommendation would be to change to using TextCore with FontAsset.
     
    mikejm_ likes this.
  3. thesanketkale

    thesanketkale

    Joined:
    Dec 14, 2016
    Posts:
    65
    Hi @HugoBD-Unity,

    We have been using the legacy Text system for our project that allows user-generated comments in various Native Indian languages. Now, we had tried using TMP back in the day but it took too much time to load the text in the comments due to more than 10 assigned fallback fonts containing different language fonts. However, the legacy Text system loaded the different language comments way faster with the same fallback fonts assigned, almost instantaneously.

    Now after updating to Unity 2023.2.x, I see that the fallback font system of the legacy Text works in the Unity Editor but does not work in the mobile builds (Android and iOS).

    Does this mean that the bugs related to the fallback font loading in the legacy Text system won't be solved?
     
  4. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    499
    Which UI System are you using in 2023.2 ?
     
  5. thesanketkale

    thesanketkale

    Joined:
    Dec 14, 2016
    Posts:
    65
    I am using Unity UI version 2.0.0 on Unity version 2023.2.17f1 for Android build target platform with Built-in Render Pipeline.

    Also, below is the screenshot of the fallback font settings in the main font used in legacy text component.

     
    Last edited: Apr 15, 2024 at 9:15 AM