Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Don't miss out on the Unite LA Keynote for the latest information from Unity! Set a reminder!
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

TextMesh Pro RTL Text Mesh Pro. Free and Open-Source plugin to add Persian and Arabic support to TextMeshPro

Discussion in 'Unity UI & TextMesh Pro' started by sorencoder, Jun 12, 2018.

  1. sorencoder

    sorencoder

    Joined:
    Mar 27, 2017
    Posts:
    43
    Hi. I finally created a plugin to add Persian and Arabic support to TextMeshPro.

    Github link: https://github.com/sorencoder/RTLTMPro

    Features
    Realtime RTL Text
    You don't need to convert, copy and paste texts. Start writing and texts will be converted right away.



    Rich Text
    All Text Mesh Pro's tags are available in RTL Text Mesh Pro



    RTL InputField (See known issues)
    Realtime InputField is supported.



    Multiline
    Yes, This plugin has no problem with multiline RTL texts.



    AutoSize
    Auto Font Size is fully supported.



    English, Farsi and Arabic digits are supported


    Arabic Tashkeel
    Arabic tashkeel are supported. Also you can turn them off or on for every RTL Text Mesh Pro object.



    To see usage instructions visit github page:
    https://github.com/sorencoder/RTLTMPro

    Known Issues
    • Multiline has issues with English text.
    • InputField (and anything that was designed to work with TextMeshProUGUI script) will not work.
      Why it doesn't work? We need to override the text property of TextMeshProUGUI. But the text property is not defined virtual. You need to manually make the property virtual.
      • Open TMP_Text.cs from TextMeshPro source code
      • add virtual keyword to text property.
      • Open RTLTextMeshPro.cs and uncomment the top line where it says
        //#define RTL_OVERRIDE
      • Now you can use InputFields (and Dropdowns in future)

    @Stephan_B Would you make `text` property virtual in the source code so users don't have to make it virtual everytime they update? Would you gift a "virtual" keyword to all of users that want to use RTL languages?

    Have fun!
     
    Last edited: Jun 12, 2018
  2. GrassWhooper

    GrassWhooper

    Joined:
    Mar 25, 2016
    Posts:
    35
    i am using it for arabic, and i must say, you sir are a legend :) this worked like magic.
     
    sorencoder likes this.
  3. stgs73

    stgs73

    Joined:
    Mar 23, 2015
    Posts:
    42
    would love it if this could get officially incorporated.
     
    sorencoder and GrassWhooper like this.
  4. classicalguss

    classicalguss

    Joined:
    Apr 15, 2018
    Posts:
    5
    Our Input Fields are not working. I followed your steps of making the text virual in TMP_ Text.cs
    And then proceed to enable
    #define RTL_OVERRIDE
    on the file RTLTextMeshPro.cs

    We keep getting this error when we want to write something on the input field.
    IndexOutOfRangeException: Index was outside the bounds of the array.
    TMPro.TMP_InputField.GenerateCaret (UnityEngine.UI.VertexHelper vbo, UnityEngine.Vector2 roundingOffset) (at /Users/ghassanbarghouti/Library/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/TMP_InputField.cs:2817)
    TMPro.TMP_InputField.OnFillVBO (UnityEngine.Mesh vbo) (at /Users/ghassanbarghouti/Library/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/TMP_InputField.cs:2771)
    TMPro.TMP_InputField.UpdateGeometry () (at /Users/ghassanbarghouti/Library/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/TMP_InputField.cs:2716)
    TMPro.TMP_InputField.Rebuild (UnityEngine.UI.CanvasUpdate update) (at /Users/ghassanbarghouti/Library/Unity/cache/packages/packages.unity.com/com.unity.textmeshpro@1.2.4/Scripts/Runtime/TMP_InputField.cs:2670)
    UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:150)
    UnityEngine.Canvas:SendWillRenderCanvases()

    Kindly advise.
     
  5. sorencoder

    sorencoder

    Joined:
    Mar 27, 2017
    Posts:
    43
    Which version of the library are you using?
    Can you please check if the same thing happens with TextMeshPro 1.3 and RTLTMPro 3.1.1?
     
  6. classicalguss

    classicalguss

    Joined:
    Apr 15, 2018
    Posts:
    5
    The newest version of TextMeshPro is 1.2.2 though
     
  7. sorencoder

    sorencoder

    Joined:
    Mar 27, 2017
    Posts:
    43
    I'm referring to the PackageManager version:
    upload_2018-10-9_18-36-41.png
     
  8. classicalguss

    classicalguss

    Joined:
    Apr 15, 2018
    Posts:
    5
    Alright thanks, I'll check it out
     
  9. classicalguss

    classicalguss

    Joined:
    Apr 15, 2018
    Posts:
    5
    Thank you, it's working almost correctly. One problem I'm having is that I want to display the Arabic ي but instead I'm getting this ى (It's probably Persian). The Farsi checkbox can't be turned off, and I'm trying to disable it from the code but it also doesn't work (It only does when I re-click it while on play mode and on the editor).

    Kindly advise.
     
  10. classicalguss

    classicalguss

    Joined:
    Apr 15, 2018
    Posts:
    5
    I forced it to always be false from the Library, and it's working now.
     
  11. LukasA

    LukasA

    Unity Technologies

    Joined:
    Aug 19, 2016
    Posts:
    3
    Hi,

    Thank you for providing a plugin which fixes the issue of certain fonts not working correctly with TextMesh Pro.

    I have created a bug report about these fonts not being rendered out-of-the-box with TextMesh Pro.
    The progress of the report can be followed here: https://issuetracker.unity3d.com/product/unity/issues/guid/1090143/

    Regards,
    Lukas A.
    Unity QA Team
     
    sorencoder likes this.