Search Unity

Proper RTL Support

Discussion in 'UGUI & TextMesh Pro' started by hk1ll3r, Mar 18, 2021.

  1. hk1ll3r

    hk1ll3r

    Joined:
    Sep 13, 2018
    Posts:
    88
    Currently RTL support in TextMeshPro does not handle mixing RTL and LTR text. This makes basic RTL use cases like having numbers or english words in middle of RTL text impossible.

    Are there any plans for fixing this? For TextMeshPro developers it should be a straightforward fix.

    I am a contributor to the current RTL version of TextMeshPro (available here https://github.com/mnarimani/RTLTMPro) and this issue cannot be fixed outside of TextMeshPro source code because reversing order of characters depends on the layout and word wrapping.
     
    VCT136 and gilthlorien like this.
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Adding full support for RTL is planned but I don't have a firm ETA on this yet.

    Full support will first require full OpenType support which is what I am working on amongst other things.

    Could there be some shorter term interim solution... to handle bidirectional text (bidi) I would need to add support for detecting when the text changes direction which in turn would require adding support for breaking up the text into runs.

    Breaking up the text into runs (text that have the same properties) is a requirement for proper RTL support and perhaps something I could add in the shorter term. This would not provide full RTL support as we would still be missing OpenType support but it could make it possible to support bidi text sooner.

    I'll give this some thoughts and follow up as soon as I have more information.
     
    firebird721 likes this.
  3. hk1ll3r

    hk1ll3r

    Joined:
    Sep 13, 2018
    Posts:
    88
    Thanks for the reply Stephen. I think OpenType fonts and runs are independent. I've had a look at TextMeshPro's source code. The logic for detecting RTL runs exists in our repo along with some character / glyph transformations in Arabic / Persian fonts which can be integrated into TextMeshPro.
    You are right, there needs to be info about runs to complement the internal character info arrays in TMP_Text and related classes. I suspect if you exclude the OpenType fonts, the runs and fixing the character ordering and layout can be done.
    Let me know if there is anything I can do to help.
     
    VCT136 and adamhill like this.
  4. Morphus74

    Morphus74

    Joined:
    Jun 12, 2018
    Posts:
    174
    Hi @Stephan_B ,

    I know the RLT/LTR support is an issue since a long time... hk1ller have done an incredible job, at covering lot of situation, and someone else MRKDaGods fix some LTR/RTL mixing issue, but seem there is more to fix for line breaking.

    Is it possible to have a look at what would be needed for that, RTL language is a must have in 2021, I understand that your priority is different, but it's really a big feature missing in TMP if you do a multi-lingual game.

    Thank
     
    unity_VvCODKknmBJQGw likes this.
  5. firebird721

    firebird721

    Joined:
    Jun 8, 2022
    Posts:
    101
    i understand that today it is possiple to work with rtl in current setting?(not bidi)

    how can i do it? thx
     
  6. pablo_leban

    pablo_leban

    Joined:
    Sep 19, 2013
    Posts:
    68
    2 years have passed now. Is there any ETA or plans to include it in the upcoming updates?
     
  7. imanirajdoost

    imanirajdoost

    Joined:
    Jun 8, 2022
    Posts:
    6
    Still no support?