Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Support Thai

Discussion in 'UGUI & TextMesh Pro' started by jessicapeon, Apr 28, 2022.

  1. jessicapeon

    jessicapeon

    Joined:
    Nov 28, 2021
    Posts:
    2
    Hi! I have a problem displaying the Thai language in my game.
    I'm using a Thai font and if I check the Glyph Table, it has all the characters I use. But when I write a text in Unity (I'm using TMProUGUI but it's the same with Text), some Diacritical Marks don't appear.

    For example,
    upload_2022-4-28_15-59-49.png
    appears like
    upload_2022-4-28_16-0-39.png

    any help?
    Thanks!
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    The latest release of the TextMesh Pro package (version 3.2.0-pre.3) includes support for Diacritical Marks. However, this data needs to be manually populated until the functionality to extract this data from the GPOS table at runtime lands in some new future version of Unity.

    P.S. Support for OpenType Layout features is what I have been and continue to be working on. I am hoping to have this available in Unity 2020.3 or newer within the next 60 - 90 or less.
     
  3. jessicapeon

    jessicapeon

    Joined:
    Nov 28, 2021
    Posts:
    2
    Thanks for the quick reply!
    So, how can I do to manually populate the functionality? I'm still learning about Unity and this is my first trying a a multilingual game, can you guide me?
     
  4. geo_p

    geo_p

    Joined:
    Jul 24, 2012
    Posts:
    5
    Hello Stephan! Is there any update on when the OpenType Layout features will make it into Unity?

    In the meantime, can you offer some instructions for how to manually populate the layout data so that Indic scripts such as Thai are rendered properly? For reference, here is a good post explaining the issue we currently face in Thai (general summary: some vowels and tone marker diacritics need to change their position slightly depending on what's underneath them).

    Thanks,
    George
     
    Last edited: Aug 23, 2022
  5. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    249
    Nolkeg/AdjustTHWannayuk: Adjust Thai wannayuk position in Unity (github.com)
    I've been using my own solution for this.
    The code is very short. It's just an automated script to populate the Glyph Adjustment Pair list instead of manually typing and adding them yourself.
     
    noptanakhon11 and geo_p like this.
  6. daniel_lochner

    daniel_lochner

    Joined:
    Jun 9, 2016
    Posts:
    168
    Hi there, when using your script, I seem to be getting a
    KeyNotFoundException
    ?
    I'm using the NotoSansThai font. Is there a better font for Thai?
     
  7. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    249
    It looks like the code couldn't find specific TH glyp from the character look up table.

    By the way, this hack is not required anymore in unity 2021.3.16f1 + TMP 3.2 preview 4 because new version of Unity and TMP have the ability to extract kerning data directly out of the font so if you're on newer version just use the official way of doing it and export the TMP font back to your older project (I'm not sure if this is going to work though, but it's worth a try)