Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'UGUI & TextMesh Pro' started by Deleted User, Jun 12, 2018.

  1. Deleted User

    Deleted User

    Guest

    Hi,
    Can you give me an sample text which the plugin doesn't convert properly? (Also include the correct representation)
     
  2. fabioramos8

    fabioramos8

    Joined:
    Jun 23, 2017
    Posts:
    3
    Here's the inputstring:

    input string.png

    And the output in the chatbox.

    chatbox.png

    As you can see the space tag isn't recognized. Also, shouldn't "ASDF" come after the W's? The chatbox has enough space in the second line to accommodate "ASDF" and even if it wouldn't, shouldn't "ASDF" appear in that line by default?
     
  3. AceEX7

    AceEX7

    Joined:
    Feb 2, 2014
    Posts:
    11
    I Read on the TextMeshPro forum that a new release is expected soon, could you please make sure that the text property will be virtual so I could use the cloud build services, much appreciated @Stephan_B
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The iTextProcessor interface won't be in this next preview release but it will be in the subsequent one that should be out the following week. I am currently going through the steps to release the first preview of version 1.5.0 for Unity 2018.4 and 2.1.0 for Unity 2019.x.
     
    kimcatq and AceEX7 like this.
  5. Alpha7Wolf

    Alpha7Wolf

    Joined:
    Oct 20, 2016
    Posts:
    6
    Thanks, @mnarimani, This package is wonderful and amazing.
    but there is an issue with sprite assets.
    I cant use sprite assets in my text, when I put English text it works normal but when I change it to Persian or Arabic it doesn't work at all.
    here is the text: <sprite=3 color=#55FF55FF> امم <sprite="UI 2" index=1>
    and here are the outputs:
    011.PNG
    022.PNG

    again thanks for the package.:)
     
  6. fabioramos8

    fabioramos8

    Joined:
    Jun 23, 2017
    Posts:
    3
    Hey @mnarimani, wondering if you had the opportunity to look into the issue I described in my previous post. Feel free to let me know if you need any additional information that would help debug it.
     
  7. GoldenEagleTech

    GoldenEagleTech

    Joined:
    Jul 28, 2019
    Posts:
    3
    Why hasn't this been added yet in the official TMP? Its 2019 and sir, I just would like to say that you are a legend.
    الله يحفظك ويفتح لك ابواب الرزق ان شاء الله

    Love from Moscow.
     
    YaserDev likes this.
  8. mudibushnaq

    mudibushnaq

    Joined:
    Dec 16, 2012
    Posts:
    55
    Hey, friend at first thanks for the Free RTL plugin.
    شكرا

    I use :
    Unity 2019.2.12f1
    TextMeshPro : 2.0.1

    I get some errors when I first load the font on those line of codes


    and every time I close my editor I got those null errors :


    double-clicking will bring me to this line of code :


    and sometimes I get those errors:


    Regards,
     
    Last edited: Dec 14, 2019
  9. NovaEiz

    NovaEiz

    Joined:
    Sep 6, 2017
    Posts:
    53
    Hi!

    Tell me, please!

    In your plugin, tags don't work with quotes (<color="#000">text</color>), but they work without quotes (<color=#000>text</color>).

    We need to have quotes, because this is the html standard and quotes should be.
    Please tell me how to make tags work with quotes?

    Thanks!
     
  10. NovaEiz

    NovaEiz

    Joined:
    Sep 6, 2017
    Posts:
    53
    Oh no...
    This in TMP doesn't work with quotes, sad...
     
  11. afshin_a_1

    afshin_a_1

    Joined:
    Apr 26, 2015
    Posts:
    49
    tnx @mnarimani . you're a hero. but i have a problem.
    I added a text the size of a page. there is no problem when i use textmesh pro, but with rtltextmesh pro i get this error:
    IndexOutOfRangeException: Index was outside the bounds of the array.

    it refers to this method in FastStringBuilder class:
    Code (CSharp):
    1. public void Append(char ch)
    2. {
    3.            if (capacity < Length)
    4.                EnsureCapacity(Length, true);
    5.  
    6.            array[Length] = ch;  //***it refers to this line of code
    7.            Length++;
    8. }
    it seems like you have declared an array that can store for example 8 elements not 9. why the code isn't in a try/catch block? how to solve this problem?
     
    Last edited: Feb 18, 2020
  12. kimcatq

    kimcatq

    Joined:
    Jun 11, 2019
    Posts:
    9
    Does anyone know if the latest TextMeshPro [1.5.0-preview.5] support Right-to-Left writing like Farsi?

    Stephen_B mentioned ITextPreprocessor, but I can't find any information/tutorial about it.
    Since I don't understand Farsi, it difficult for me to understand how it's rendered. All I know is it looks wrong.
     
  13. Keita-kun

    Keita-kun

    Joined:
    Aug 20, 2017
    Posts:
    36
    Thank you so mush for this plugin you're a life saver ;)
     
  14. Keita-kun

    Keita-kun

    Joined:
    Aug 20, 2017
    Posts:
    36
    Hi, I am using Unity 2019.2.20f1 since I added the RTL TMP plugin to my project replaced regular text with RTL TMP changed modifier on from public string to public virtual string text enabled define override directive I got multiple issues now:
    1 UI element not responding all are simple buttons
    2 I am geeting a wierd msg each time the project is loaded as if my TMP_Text.cs gets overwritten each time project is opened
    3 some RTL TMP text will have a sub item others will not
    can you help me or should I give Up on developing Arabic games for now?
     
  15. e2000

    e2000

    Joined:
    Sep 10, 2016
    Posts:
    7
    Hi @Stephan_B,
    Any news on adding the virtual key to the text field in TMP_Text.cs in TMP release?
    Because TMP_Text.cs gets overwritten each time the project is opened.
     
  16. e2000

    e2000

    Joined:
    Sep 10, 2016
    Posts:
    7
    For anyone who has an issue like this, you can fix overwrite issue by embed TMP library in your project. For that in Unity 2019 just copy com.unity.textmeshpro@#.#.# folder from Library\PackageCache to your project's Packages folder and remove this com.unity.textmeshpro@#.#.# folder from Library\PackageCache.
     
  17. mbrmj

    mbrmj

    Joined:
    May 12, 2020
    Posts:
    8
    Hi @mnarimani,

    Thanks for this great plugin, much much appreciated. I have a question, can I use this plugin on 3D Object TextMeshPro? I can't see this option under GameObject -> 3D Object menu. I want to write Arabic inside 3D space. The plugin is only available under GameObject -> UI which is used inside the Canvas.

    Thanks again.
     
  18. Deleted User

    Deleted User

    Guest

    Hi, Manually add "RTLTextMeshPro3D" to an empty gameobject.
     
  19. mbrmj

    mbrmj

    Joined:
    May 12, 2020
    Posts:
    8
    @mnarimani THANKS it worked. Have a nice day~
     
  20. reza74vi

    reza74vi

    Joined:
    Jan 18, 2020
    Posts:
    1
    @mnarimani
    Does it also work for 2d?
    I'm trying to make some kinda damage pop up prefab without canvas but it seems that it only works with text mesh pro component
    Not the rtl text mesh pro component.
     
    Last edited: May 30, 2020
  21. HappyEle

    HappyEle

    Joined:
    Mar 24, 2020
    Posts:
    1
    hi ,I have a problem. Package version 1.4.1
    I occasionally get an error when I type in Chinese!
    I am very puzzled!
    Please help me to see why!

    IndexOutOfRangeException: Index was outside the bounds of the array.
    TMPro.TMP_InputField.GenerateHightlight (UnityEngine.UI.VertexHelper vbo, UnityEngine.Vector2 roundingOffset) (at Library/PackageCache/com.unity.textmeshpro@1.4.1/Scripts/Runtime/TMP_InputField.cs:3409)
    TMPro.TMP_InputField.OnFillVBO (UnityEngine.Mesh vbo) (at Library/PackageCache/com.unity.textmeshpro@1.4.1/Scripts/Runtime/TMP_InputField.cs:3286)
    TMPro.TMP_InputField.UpdateGeometry () (at Library/PackageCache/com.unity.textmeshpro@1.4.1/Scripts/Runtime/TMP_InputField.cs:3219)
    TMPro.TMP_InputField.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.textmeshpro@1.4.1/Scripts/Runtime/TMP_InputField.cs:3194)
    UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at D:/unity/Extensions/guisystem/UnityEngine.UI/UI/Core/CanvasUpdateRegistry.cs:198)
    UnityEngine.Canvas:SendWillRenderCanvases()
     
  22. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    Hi!
    I have some question about implementing this asset.
    I need to update my text content by code.
    Should i use textmeshpro text component or RTLTextMeshPro and access in my class and update content?
    I just reading documentation but cannot find the way to do it, if i paste my arab text in unity edittor looks fine, but how should i update this content?
     
  23. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    768
    You can use the RTLSupport class FixRTL() function to update the text in code. No need to use the RTLTMPro component.
     
    IndieFist likes this.
  24. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    Then i should reference my normal textmeshpro and after download the string to be used do RTLSupport.FixRTL()¿ so easy i need to check it
    Ok, i need to use this method but i have some problem:
    string resultado =
    Desc2.text = RTLSupport.FixRTL(mystring, RTLTMPro.FastStringBuilder(DefaultBufferSize), farsi: true,preserveNumbers:true);
    I dont know who to pass this value: RTLTMPro.FastStringBuilder(DefaultBufferSize)

    I have working this way:
    Code (CSharp):
    1. protected readonly FastStringBuilder finalText = new FastStringBuilder(RTLSupport.DefaultBufferSize);
    2.         public string GetFixedText(string input)
    3.         {
    4.             if (string.IsNullOrEmpty(input))
    5.                 return input;
    6.  
    7.             finalText.Clear();
    8.             RTLSupport.FixRTL(input, finalText, true, true, true);
    9.             finalText.Reverse();
    10.  
    11.             return finalText.ToString();
    12.         }
    13.  
    14.         void TryText()
    15.         {
    16.             string estaDescripcio = LocalizationManager.GetTranslation("DesBoxErich");
    17.             Desc2.text = estaDescripcio;
    18.             Desc2.text = GetFixedText(estaDescripcio);
    19.         }
    But looks bad
    In the picture i have attached, in left block is how looks trying to do it with code, on right panel is with RTLTextMeshPro plugin and paste in editor the content.

    If i get my string with LocalizationManager.TryGetTranslation("DesBoxErich", out porSiAcaso, FixForRTL: false); then looks better.
     

    Attached Files:

    Last edited: Jul 13, 2020
  25. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    768
    Your code looks right to me - except I set "farsi" to false

    Code (CSharp):
    1. RTLSupport.FixRTL(input, finalText, false, true, true);
    Not sure if that makes a difference or if you need farsi support.

    But don't forget, you also need to set IsRightToLeft to true on the TMP component

    Code (CSharp):
    1. tmpComponent.isRightToLeftText = true;
     
    IndieFist likes this.
  26. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    Well i dont know exactly if text looks fine i have to check with someone that speak arab xD
     
  27. KmUnity3d

    KmUnity3d

    Joined:
    Apr 10, 2016
    Posts:
    4
    thank u for your great work!

    i am using this plugin(version 3.2.4) with unity 2020 and visual studio 2017 15.8.1 . as soon as i import the package in my project i get this error :

    Assets\RTLTMPro\Scripts\Editor\RTLTextMeshProEditor.cs(8,41): error CS0246: The type or namespace name 'TMP_UiEditorPanel' could not be found (are you missing a using directive or an assembly reference?)

    do u have any idea how to solve it?

    Edit : I tested it with two different empty projects , one in unity 2020.1.10 and one in unity 2019.2.15 . it had no error with 2019 (empty project) ,but with unity 2020 (empty project) the error i mentioned above was seen agian.

    Edit : I investigated more and found that TMP_UiEditorPanel class is found under "TMPro.EditorUtilities" namespace of "Unity.TextMeshPro.Editor.dll" in unity 2019, however there is no such class under "TMPro.EditorUtilities" namespace of "Unity.TextMeshPro.Editor.dll" in unity 2020.hope it helps.
     
    Last edited: Oct 31, 2020
  28. Keita-kun

    Keita-kun

    Joined:
    Aug 20, 2017
    Posts:
    36
    Hi there, send me a print screen I'll tell y a if it is correctly written (char joined RTL way)
     
    IndieFist likes this.
  29. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    I just attached both pictures, in english and arab language, english is good, but arab?
     

    Attached Files:

    Keita-kun likes this.
  30. Keita-kun

    Keita-kun

    Joined:
    Aug 20, 2017
    Posts:
    36
    You couldn't be more Arabic ^^ it is 100% correct but the translation is off ie: if translate from Arabic it says the ads will play on game, the security guard can't see you can't hear you and can't see you. It is like reversed version of your original English text where as in Arabic same thing would be NoArabic text allowed.png .

    May I ask in which version of unity did you get it to work, I tried up to 2018.4 and gave Up Arabic text never displays with many font tried also.

    Just a suggestion: I guess your difficulty lvl makes it so that each of these NPC can't see you or hear you try adjusting text according to that and add either the word [each of] "NO ARABIC ALLOWED" or the singular form may help reducing text foot print on the UI.
     
  31. IndieFist

    IndieFist

    Joined:
    Jul 18, 2013
    Posts:
    518
    "but the translation is off" you mean my translation is wrong?
    i got mine working on 2019.4.X and 2019.2x i could share code if you need it.
     
  32. Mask2007

    Mask2007

    Joined:
    Aug 7, 2014
    Posts:
    8
    Your plugin uses the licensed Segoeui.ttf font from Microsoft. I understand correctly? If so, if I release a game to Google Play using this plugin, will I be violating the license?
     
  33. ddadkhah

    ddadkhah

    Joined:
    Nov 6, 2017
    Posts:
    59
    Hi,
    Did you find any solution for it?
     
  34. Keita-kun

    Keita-kun

    Joined:
    Aug 20, 2017
    Posts:
    36
    Sorry for long delay,COVID19 thrown up the wall the hole thing:p. Thank you, Yes I'd apriciate the check the code for or should I say the setup to display Arabic correctly.
    as per the translation it is correct as I said, actually from a semantic or aesthetic point view to change the style a bit ^_^
     
  35. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    507
    Dose this asset still works? I see squares instead of persian characters.
     
    Last edited: Jan 22, 2022
  36. RahmatAli_Noob

    RahmatAli_Noob

    Joined:
    Sep 13, 2022
    Posts:
    74
    I Am Using the RTL pro Package in Unity To Write the Arabic and English Language. The RTL Pro Package is Working perfectly fine and I can Write the Arabic and English. But there is Some Issue.

    When I Try to Write the English Letter First and then Arabic in same Sentence, Like Example: "Hello, غتناب Buddy". This is The Correct Format I required. but in the RTL Pro Package it is not Showing properly. It Appears Like this "Hello ل ايا ي Buddy ". Image:

    My desired result is that: "Hello, غتناب Buddy". Any help Regarding this Issue.
    Is there Anyone Who Who faces this issue.
    Thanks.
     
  37. RahmatAli_Noob

    RahmatAli_Noob

    Joined:
    Sep 13, 2022
    Posts:
    74
    Yes! This works Fine you Have to use the Font that Contain the Persian Letter's.
    Make the Font Asset try and Run.
     
  38. KinanGH

    KinanGH

    Joined:
    Dec 3, 2019
    Posts:
    34
    For anyone that sees gibberish words after concatenating the text like this:
    Code (CSharp):
    1. rtltmp.text += "النص المضاف";
    simply use the
    OriginalText
    property like this:
    Code (CSharp):
    1. rtltmp.text = rtltmp.OriginalText + "النص المضاف";
    That will fix the problem, although I have no idea why the normal way of concatenating didn't work.
    Thanks for the plugin by the way.
     
    GrassWhooper likes this.
  39. jeffdyerSRTMarine

    jeffdyerSRTMarine

    Joined:
    Jan 23, 2019
    Posts:
    12
    Hello - this has stopped working for me in Cloud Build today - is there some issue with the package manager or something?


    [error] [2023-10-25T10:07:00Z - Unity] An error occurred while resolving packages:
    [2023-10-25T10:07:00Z - Unity] One or more packages could not be added to the local file system:
    [2023-10-25T10:07:00Z - Unity] com.nosuchstudio.rtltmpro: 'https://package.openupm.com/com.nosuchstudio.rtltmpro/-/com.nosuchstudio.rtltmpro-3.4.5.tgz' was not found
    [2023-10-25T10:07:00Z - Unity] Exiting without the bug reporter. Application will terminate with return code 1