Search Unity

Question How to create font assets for Arabic for displaying underlines

Discussion in 'UGUI & TextMesh Pro' started by TCYeh, Jan 22, 2024.

  1. TCYeh

    TCYeh

    Joined:
    Jul 25, 2022
    Posts:
    55
    I'm encountering an issue: the underlines are not fully displayed while setting up Arabic fonts.

    I've tried using segoeui SDF Arabic from RTLTMPro and NotoSansArabic fonts, but unfortunately, both fail to display underlines properly, with some pixels appearing incomplete as in the below image.
    segoeui:
    segoeui.png
    NotoSans:
    notaSans.png

    Despite adjusting the sampling point size and atlas resolution of the font assets, and the underline offset and thickness, the issue persists.

    Could this be related to font asset settings? How can I determine the correct settings for each font to address this problem?

    Appreciate any advice in advance.
     
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    499
    Hi @TCYeh!

    Unfortunately, the RTL - TMP is not officially supported and is currently in maintenance mode. We are currently focusing our efforts on a built-in solution to support RTL and many other scripts and languages.
     
  3. TCYeh

    TCYeh

    Joined:
    Jul 25, 2022
    Posts:
    55
    @HugoBD-Unity Thank you for the reply.
    Does this imply that full RTL support will be included in TextMeshPro in future releases?
    Is there a specific version scheduled to incorporate this feature, perhaps in 4.0.0?
     
  4. TCYeh

    TCYeh

    Joined:
    Jul 25, 2022
    Posts:
    55
    I've devised a workaround for the issue.
    Essentially, the problem doesn't stem from RTLTMPro but arises when utilizing `
    TMP_Text.m_isRightToLeft
    ` to reverse the text order. (TMPro version: 3.0.7)
    The underline display problem occurs when enabling "Enable RTL Editor," irrespective of the font asset.

    Though I'm uncertain about the root cause, I addressed it by abstaining from using TMPro's RTL feature.

    Here's a summary of my approach for anyone facing the same issue to refer to:

    1. In RTLTextMeshPro.cs, removed all lines setting
    isRightToLeftText
    and added a
    enableRTL
    boolean member to replace it.
    2. In RTLTextMeshProEditor.cs, rewrote
    DrawTextInput()
    to handle RTL text without setting values for
    m_IsRightToLeftProp
    and
    m_RtlText
    .
    3. Deleted line 130
    finalText.Reverse()
    in RTLTestMeshPro.cs since TMPro no longer reverses the text.
    4. Rewrote the
    RichTextFixer.Fix(output)
    method to correct the order of RichTextTags by swapping the positions of <tag> and </tag>.

    While the solution I implemented is somewhat complex, I would greatly appreciate any guidance or suggestions for potentially improving it.
     
    Last edited: Jan 30, 2024