Search Unity

TextMesh Pro Arabic Support

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by Zilk, Jul 28, 2019.

  1. Zilk

    Zilk

    Joined:
    May 10, 2014
    Posts:
    266
    I've been adding Arabic support to my game lately through Text Mesh Pro and I must say that the support currently available is.. terrible.

    TMPro has support to enable RightToLeft which is good. However it also flips latin numbers which isn't correct. It also doesn't correct the font for Arabic so it is unreadable. There are some great open-source plugins out there but those require changing all components away from Unitys default TMProLabels which isn't ideal.

    What would be needed to get great Arabic support:
    • Automatic recognition of Arabic characters and if found, enable RightToLeft and a manual bool to force RightToLeft.
    • Automatic correction of character offsets (similar to how Easy Alphabet Arabic plugin has a function to correct it).
    • No flipping of latin numbers. Also Easy Alphabet Arabic has a nice feature to convert latin to arabic numbers.
    • All this above handled whenever text in the label changes so developers don't need to worry about it.

    My current solution to handle this is so terribly hacked to get it working with TMPro that I want to cry.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,335
    I do plan on improving / adding proper support for Arabic text in TextMesh Pro but that is a longer term undertaking.

    In the meantime, I do recommend taking a look at the following free plugin. As per your point, this requires using another component but that is something that I am discussing with the author of the plugin to try to avoid. I'll try to provide an update on this later this week.
     
  3. Zilk

    Zilk

    Joined:
    May 10, 2014
    Posts:
    266
    TMPro is amazing so I really look forward to it. And yes, the free plugin handles it brilliantly but requires swapping components and I know from experience that this always ends up biting one in the ass sooner or later :D

    Something that could go a long way in TMPro would be a callback for when text is being changed (with the changed text in the callback) so one could format it however one wanted. Then it would be easy to say input Easy Arabic or something similar to fix most issues.

    Right now I ended up in a race condition thing where things weren't updated after I tried to fix the arabic characters etc :D
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,335
    That is something that I am considering in the short term.
     
  5. Zilk

    Zilk

    Joined:
    May 10, 2014
    Posts:
    266
    That would be awesome. Then one could just pass the text through the RTLTMPro open source code functions if the current language is Arabic, even handle the setting of the RightToLeft bool there with help from RTLTMPro functions.

    Do it! I'll give you a gold star.