Search Unity

TextMesh Pro Possibility of displaying missing glyphs as an image or something that is attention grabbing?

Discussion in 'UGUI & TextMesh Pro' started by CanisLupus, Feb 22, 2019.

  1. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    Hey, is it possible in any way to display missing glyphs as an image or a colored letter or something visually attention grabbing?

    Each of our fonts only includes a certain set of characters, so choosing a single character for the missing glyphs replacement (in the project settings) is impossible since on most fonts it won't exist and doesn't show up.

    I like the 0 char (square) from LiberationSans to visualize missing chars, but none of our fonts show anything for that character.

    Thanks!
    Daniel
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The missing glyph character 0 is coming from the Default Font Asset assigned in the TMP Setting which by default is LiberationSans. So unless you have replaced this default font asset by one that does not include the missing glyph symbol then you wouldn't see anything.

    It is also possible to change this 0 for any other glyph in the TMP Settings missing character.
     
  3. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    Ah, I see, we did replace the default font asset, but I thought it was used only as the default for newly created components; not that it acted as a kind of fallback.

    Thank you for your answer. Can you help me with my previous (entirely different) question here?

    Cheers!
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just to provide some additional insight on this...

    When a character / glyph is requested:
    (1) TMP will first look at the Primary font asset assigned to the text object.
    (2) Check the fallback list of the Primary font asset starting with the first font asset and recursively through any fallbacks it may contain. If the character / glyph is still not located, it will search the remaining font assets in this list in the same manner as above.
    (3) Since sprite assets can contain sprites that have unicode values assigned to them, TMP will search any sprite asset assigned to the text object in the Extra Settings section.
    (4) If the requested character / glyph is still not found, TMP will search through the list of general fallbacks assigned in the TMP Settings using the same logic as above.
    (5) It will then search the default sprite asset for any potential sprites that have a unicode value matching the requested character / glyph.
    (6) It will then search the default font asset assigned in the TMP Settings.
    (7) Lastly look for the missing glyph defined in the TMP Settings using the same logic as above.

    P.S. I'll take a look at your other question tomorrow.
     
    CanisLupus likes this.
  5. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    Thank you very much for the details and concise list. :) I was aware of most of it from your video "TextMesh Pro - Font Fallback & Dynamic SDF System overview" but missed the fact that the default font asset was used as a fallback as well (we always change it to the most commonly used font in each project).

    (OK, please answer when you can. It is just to know the best way to do something and it can wait.)

    Looking forward to the new dynamic font atlases and SDFAA. Both are very welcome!
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    A release (preview) of the new Dynamic SDF system is already available for Unity 2018.3. This release is available via the package manager and the latest is version 1.4.0-preview.2a.
     
  7. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    We may try it next week. We knew it existed already but didn't try it yet since it was a preview and we preferred a stable version for short term builds.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Please do play with the preview release as I need feedback to make sure any potential issues are uncovered thus helping ensure the official release is as stable as possible.
     
    CanisLupus likes this.
  9. CanisLupus

    CanisLupus

    Joined:
    Jul 29, 2013
    Posts:
    427
    Hey Stephan, I was able to try the preview and it looks great! :) I ran into a few issues trying to do custom things, which I posted in the main thread.

    My other question still stands when you have some time, but that's less important.

    Thanks for your support.