Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Proper RTL Support

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

  1. hk1ll3r

    hk1ll3r

    Joined:
    Sep 13, 2018
    Posts:
    69
    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.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,092
    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.
     
  3. hk1ll3r

    hk1ll3r

    Joined:
    Sep 13, 2018
    Posts:
    69
    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.
     
    adamhill likes this.
  4. Morphus74

    Morphus74

    Joined:
    Jun 12, 2018
    Posts:
    129
    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
     
unityunity