Search Unity

TMP 2017 and support for 12 languages

Discussion in 'UGUI & TextMesh Pro' started by justtime, Sep 11, 2019.

  1. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Hi there! i watched tutorial videos and have ridden many posts, but still a little bit confused.
    I have to implement TMP in my Unity 2017.4 project with old TMP system and 12 languages(English, Russian, Spanish,Chinese, Hindi, Portuguese, French, Malay, Italian, German, Japanese, Korean).
    My plan: make extended ascii + cyrillic font, then one for Korean, one for Japanese, one for Chinese + Chinese Simplified, one for RTL langs. Or may be should i use extended ascii and cyrillic for fallback(like in one of post here), but how to be with other?
    Thanks
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The recommended workflow / setup is as follows:

    For each language or groups of languages, you should have a list of all known / used characters in the project. These language files are typically used in the localization / translation process so you should have a list for each language.

    Using these lists, you should create a Primary font asset that includes all the known characters used in the project for that language or group. Since most Latin languages share the same characters, you can have this Latin Primary font asset includes the extended ASCII set.

    For extra coverage for Latin based languages like Cyrillic and Greek, I would create separate font assets which are assigned as fallback to the primary Latin font asset.

    For Chinese, I would create a Primary font asset that only includes the known / used characters in the project. It is usually not that many so you should be able to include both Simplified and Traditional in the same primary. Then create additional fallback font assets to cover the Table of General Standard Chinese Characters. There are a few posts on the forum here with this list already included in text files. So for Chinese you will likely end up with (1) Primary and 3 fallbacks.

    Repeat the process for Korean where the primary will include all the known / used characters and the fallbacks the rest of the Hangul characters.

    Repeat for Japanese in regards to the primary. Not sure how to split up the fallbacks so perhaps some users who have done it can share their insight here.

    I would not use atlas texture larger than 2048 x 2048.

    Your primary font asset for each language group could include or a fallback could include all the characters needed to display the language selection menu which usually have a few characters from all languages. This enables you to display the options in their native language without having to have all languages present in case you want to use AssetBundles which are loaded after the language is selected.

    This process gets much easier with the new Dynamic System available for 2018.4 or newer versions of Unity.
     
    justtime likes this.
  3. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Thanks a lot! I tried to select characters from file (all my app characters) with Roboto font, but it output only 201 / 1912. Is it something wrong with font? Seems that i have to use different font for non Latin, Cyrillic languages?
     
    Last edited: Sep 12, 2019
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Most fonts are typically designed for specific / subset of languages. Roboto does support Latin, Greek and Cyrillic but not East Asian languages or Arabic.

    The NotoSans family of fonts support more languages but these are also broken up in multiple fonts.
     
    justtime likes this.
  5. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Thanks. I have to keep my build as small as possible, so does it possible to use fallback system with asset bundles? I mean i create like you said primary font and a few fallback fonts assigned to primary. How to handle asset bundles properly in this case?

    Also, should i support Traditional Chinese, or like you said only 8150 symbols from simplified table?
     
    Last edited: Sep 16, 2019
  6. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Found i bug today (i think so). After changing font size, alignment property changes too, so i have to change it to desirable via script each time i change font.
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide more details on what you have observed?

    A few screenshots is always good.
     
  8. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    "is aligmentent enum converted" checked in debug view solved this issue.
     
  9. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Also when i try to add new TMP Component i always got this

    Code (CSharp):
    1. UnassignedReferenceException: The variable m_sharedMaterial of TextMeshProUGUI has not been assigned.
    2. You probably need to assign the m_sharedMaterial variable of the TextMeshProUGUI script in the inspector.
    3. TMPro.TextMeshProUGUI.GenerateTextMesh () (at <eb02583e0506474e930bf2dac9e69d51>:0)
    4. TMPro.TextMeshProUGUI.OnPreRenderCanvas () (at <eb02583e0506474e930bf2dac9e69d51>:0)
    5. TMPro.TextMeshProUGUI.Rebuild (UnityEngine.UI.CanvasUpdate update) (at <eb02583e0506474e930bf2dac9e69d51>:0)
    6. UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:150)
    7. UnityEngine.Canvas:SendWillRenderCanvases()
    8.  
    It begins rendering only after enter play mode and stop play mode. Then it reveals some text.