Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Fallback to emojis BEFORE fonts

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

  1. Francoimora

    Francoimora

    Joined:
    Aug 1, 2013
    Posts:
    68
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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:
    68
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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:
    101
    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

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

    ETGgames

    Joined:
    Jul 10, 2015
    Posts:
    101
    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

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    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.
  9. GTMeghana

    GTMeghana

    Joined:
    Jan 5, 2023
    Posts:
    16
    @Stephan_B does TextmeshPro 3.0.6 has Emoji fallback support?

    I would like to display all the emojis present in android and ios devices in the text component of textmeshpro in unity editor or holoLens device.
    I have downloaded the notosans color emoji ttff file and create a font asset in unity.

    Could please help me in finding the solution to display color emojis?
     
    Last edited: Apr 5, 2023
  10. jongin_unity

    jongin_unity

    Joined:
    Nov 22, 2022
    Posts:
    3
    @Stephan_B In the 3.2.0 pre4 version, I also tried to use the noto color emoji, but it doesn't work. Does anyone have a solution or know how?
     
  11. jongin_unity

    jongin_unity

    Joined:
    Nov 22, 2022
    Posts:
    3

    @Stephan_B
    sorry, I know why not. It was not possible because the font asset was made dynamic. But why is the font's sampling point size fixed at 109?