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

TextMesh Pro How do I make word wrap move the correct things to the next line in a RTL language?

Discussion in 'UGUI & TextMesh Pro' started by cquels, Jun 25, 2020.

  1. cquels

    cquels

    Joined:
    Sep 11, 2016
    Posts:
    10
    Please see the attached screenshots. I have a "TextMeshPro - Text (UI)" field. Usually it contains English text, but it has many failover font assets to cover the various languages the game will be localized into. Screenshot 1 shows the TextMesh Pro settings on this field. The i2 Localization plugin swaps out the text at runtime, plugging in the needed translation for the language the player has chosen.
    1_TextMeshProSettings.png

    My question is in regards to Arabic text not behaving as I expect when Word Wrap is enabled.

    Screenshot 2 shows the Arabic text as it ought to look (except for word wrap being disabled). Notice that the right-most word looks like an upside-down 'R' (I'm sorry; I don't know Arabic, so I can't describe it properly). As Arabic goes right-to-left, this is the first word. (In a left-to-right language, the right-most word would be the last word, but Arabic isn't left-to-right.)
    2_WordWrapDisabled.png

    Screenshot 3 shows the same field and same text, but with word wrap enabled. Notice that the upside-down 'R' is now the right-most word on the bottom line, which is not where the first word should be in a right-to-left language. (However, this is where the last word would be in a left-to-right language.)
    3_WordWrapEnabled.png

    When the text is a left-to-right language, the linebreaking moves the words I expect it to to the next line. What should I do to make the linebreaking move the words I expect it to when the text is a right-to-left language?

    (For what it's worth, I tried using this Unity plug-in that has been recommended elsewhere: https://forum.unity.com/threads/rtl...ian-and-arabic-support-to-textmeshpro.535758/ . It did not seem to resolve the problem; the upside-down 'R' still ended up as the right-most character on the second row.)

    Unity version: 2019.3.11f1
    TMPro version: tried with both 2.0.1 and 2.1.0 preview.14
     
    Last edited: Jun 25, 2020
  2. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Looking into fixing this as well. Curious if you found a solution @cquels
     
  3. PedroDuran

    PedroDuran

    Joined:
    Aug 19, 2014
    Posts:
    32
    Up, any ideas on how to fix this?