Search Unity

TextMesh Pro Questions about using Fallbacks in Localization

Discussion in 'UGUI & TextMesh Pro' started by Precache, Jun 7, 2018.

  1. Precache

    Precache

    Joined:
    Jul 30, 2015
    Posts:
    47
    I'm working on a localization system and have a chain of fallback fonts on each of my main fonts. It's even working well for Korean and Japanese.

    However, I'm running into the issue that chinese and japanese (correct me if I'm wrong) share a unicode range and so simple fallbacks won't work. I need to swap out the fonts.

    What I'd like to do is define three placeholder fonts(title, heading, and text) and rather than swapping out the font on each instance of a TMP, swap out the font in the placeholder font's fallback list. So I can change the fonts for the entire game in three easy to find places.

    To make this work, I'll need to create an empty font for each of the placeholders so I can swap in the entire character set.

    Here are my questions:

    Is there a way to do this without creating an additional submesh? (or without creating the initial mesh for a blank font).

    Is there any performance hit to having a blank main mesh on the TMP and rendering everything into the first submesh?

    Also, just out of curiosity, is it possible to create font assets within the game rather than in the editor? (as part of the installation process)
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The only characters that are shared between Chinese, Japanese and Korean are CJK Unified Ideographs but they are designed to do so.

    Since these are common to each of these languages, it would make sense to have those assigned to the general fallback in the TMP Settings file and not to each individual font asset. This suggestion would be the same for symbol fonts like Font Awesome where you want those accessible regardless of what font asset is used.

    Given the above, I would still have a Primary Font Asset for Chinese, Japanese and Korean. Each with their own unique fallbacks but then have the shared CJK Unified Ideographs in its own Font Asset with even potentially its own fallbacks but have this common assigned in the TMP Settings as general fallback which all other primary can access.

    If the geometry of the text object (main mesh) doesn't result in any geometry, there is no real performance impact.

    Not at this time.

    As a side note, you can dynamically (at runtime) change the fallbacks assigned to individual font asset as well as in the TMP Settings. Some users do this when some of the font assets used as fallbacks come from Asset Bundles for instance.
     
    Endahs likes this.
  3. Precache

    Precache

    Joined:
    Jul 30, 2015
    Posts:
    47
    Thanks for the info! CJK being compatible helps a whole lot. I'm already splitting Hangul into low and high frequency fonts, so I might try to figure out how to do that with CJK as well.