Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Fallback to emojis BEFORE fonts

Discussion in 'UGUI & TextMesh Pro' started by Francoimora, Oct 21, 2021.

  1. Francoimora

    Francoimora

    Joined:
    Aug 1, 2013
    Posts:
    40
    Hi,

    I have a problem with emojis configuration in TextMesh Pro. My setting is :

    - A primary static font
    - Noto as dynamic font fallback (set in primary font settings, not in TMP Settings)
    - Emojis as sprite asset fallback (set in TMP Settings)

    Problem is, when I put unicode chars that are in Noto (★ for example), my primary font fallback to Noto and doesn't reach the emojis.

    How to priorize the fallback to emojis ?
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    Although you can assign a local sprite asset to individual text objects in the extra settings, the fallback search order is as follows:

    Primary font asset
    Recursive search thru Fallbacks assigned to primary
    Local sprite asset and its potential fallbacks
    Recursive search thru global fallbacks assigned in TMP Settings
    Sprite asset assigned in the TMP Settings along with its potential fallbacks
    Default font asset assigned in TMP Settings along with its potential fallbacks
    Display missing character

    The issue is that the fallbacks such as your Noto are searched before any sprite assets. Assuming we could change the order where the primary is first and then sprite assets, you would still run into the same issue if Noto was the primary.

    So I think a potential option would be to add a setting in the TMP Settings that would instruct TMP to search the local and global sprite assets when a requested characters is in a specific unicode range where such range would be the already defined emoji ranges.

    I don't have an ETA on when I would be able to add this new feature but I think that could work. Thoughts?
     
  3. Francoimora

    Francoimora

    Joined:
    Aug 1, 2013
    Posts:
    40
    We never use Noto as primary font but I understand that your solution is a better one to ensure that it works for everyone. Being able to exclude custom unicode chars from being fetched by classic fonts seems to be the best way to do it.

    Thanks for your reply, I'll wait to see it in a patch note.
     
    Stephan_B likes this.
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    Just letting you know that I added some new functionality to TMP that will enable you to achieve the above.

    What I added is the ability to define a list of Text Assets (Font Assets and Sprite Assets) in the TMP Settings where these will be prioritized / searched first when requesting a character defined as an Emoji in the Unicode 14.0 standards.

    Also added the following new property to enable controlling this new functionality on a per text object basis.
    Code (csharp):
    1.  
    2. /// <summary>
    3. /// Determines if text assets defined in the Emoji Fallback Text Assets list in the TMP Settings will be search first for characters defined as Emojis in the Unicode 14.0 standards.
    4. /// </summary>
    5. public bool emojiFallbackSupport
    This new property is also exposed in the Extra Settings of the text object inspector.
     
  5. ETGgames

    ETGgames

    Joined:
    Jul 10, 2015
    Posts:
    63
    Is it out yet? I can't seem to drag in sprite assets to the fallback list in 3.0.6
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    This new functionality is in version 3.2.0-pre.3.
     
    ETGgames likes this.
  7. ETGgames

    ETGgames

    Joined:
    Jul 10, 2015
    Posts:
    63
    When I updated, all the text in my game disappears. I'm on 2022.1.20f1 macos apple silicon. i've had to revert. I hope this issue is know before making it out of prereleas
     
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    As per the release notes and upgrade note of version 3.2.0, you have to update the TMP Essential Resources as the shader have changed. This is why the text objects are not visible.
     
    ETGgames likes this.