Search Unity

Bug Text component generates chinese text fine but Text Mesh Pro is only white boxes

Discussion in 'UGUI & TextMesh Pro' started by Warmacha, Jul 7, 2022.

  1. Warmacha

    Warmacha

    Joined:
    Dec 13, 2015
    Posts:
    30
    Spent the last few hours trying to get Text Mesh Pro to work with our localization, but haven't found anything online that addresses this problem in particular.

    Difference.JPG
    1: is Text mesh pro
    2: is the normal text component

    the font does NOT include any chinese glyphs yet the normal text component seems to generate them just fine, while the Text Mesh Pro component doesn't generate anything despite having its Atlas Population Mode set to Dynamic.

    Any help or explanation would be greatly appreciated
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The white box (square) is the missing glyph symbol which is displayed when the font you are using does not contain the characters you are trying to display.

    In order to display CJK characters for instance, you will need to select another source font file that has the desired glyph coverage and either switch to that new font file or set it up as fallback.

    The following two videos cover this topic and will help guide you through this process.



     
  3. Warmacha

    Warmacha

    Joined:
    Dec 13, 2015
    Posts:
    30
    Yes, we ended up doing this for all of the TextMeshPro components

    But why does the normal text component handle the glyphs so well? Does it also have a fallback font that conveniently looks like the font we are using?
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The legacy text system has a hidden hardcoded magic list of potential fallbacks which varies per platform.

    Although this appears convenient at first, this leads to users thinking their selected font has the desired glyph coverage when it doesn't. Users have no control over these fallbacks and what font gets selected or when. This also results in different fonts being selected on different platforms which users usually uncover last in the development cycle.

    An additional problem with these magic lists is that is doesn't account for font styles or weight either. For instance, if you selected a fairly heavy font like Impact as your primary, you would need your CJK font to have a similar style and weight which is something that is such magic fallback doesn't handle correctly. With the legacy text system or even Microsoft Word, you would go from heavy font like Impact to a skinny CJK font.

    When using TextMeshPro, you do have to know the glyph coverage of the various fonts you are choosing and although this requires more time to setup, it enables you to structure these local and global fallbacks exactly as you need them. As a user, you have full control over all of it and no surprises.

    P.S. In a future release of the TMP package, I would like to provide a basic fallback structure which handles Cyrillic and CJK when using the default Liberation Sans - Regular font asset. This will be there as an example to help guide / show users how to setup their own fallback structure for their own specific needs and based on whatever font they may have selected.
     
    Last edited: Jul 11, 2022
    Warmacha likes this.
  5. Warmacha

    Warmacha

    Joined:
    Dec 13, 2015
    Posts:
    30
    Ah I see, really appreciate the explanation!
     
    Stephan_B likes this.