Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Support of Right-to-Left Languages, especially Syriac (Assyrian)

Discussion in 'Editor & General Support' started by theakkadian1, Feb 6, 2015.

  1. theakkadian1

    theakkadian1

    Joined:
    Sep 15, 2014
    Posts:
    7
    I would like to know how can the Unity IDE and Engine support the Right-to-Left languages, especially Syriac (Assyrian/Neo-Aramaic). It does somewhat support Arabic Alphabet, but doesn't even connect the words correctly, but found an extension in the Asset Store that I can use as a workaround, but it has some limitations.

    PLEASE HELP US FIX THIS ISSUE. Let me know if there is any workaround to the problem.

    How can I extend Unity to allow it to accept a new language? I am ready to make it if I know the approach.

    Please let me know if you need any further details. But in a nutshell, if I copy a Syriac text from a word document, and paste it in Unity GuiText or anything else, Unity does NOT decode the language properly. I would like to know if there is a way to do that, or if Unity is planning to support this feature soon.

    Here is an example of a sentence in Syriac: ܫܠܳܡܐ ܘ ܫܝܢܳܐ Here is how it shows: ???? (or blocks or empty spaces)
     

    Attached Files:

  2. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
  3. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    It's possible that the Arial font that Unity is using doesn't have the Syriac glyphs you need. So the GUI displays empty boxes (like Wikipedia and the Forum do). The font handling by Unity doesn't process the GSUB and GPOS tables that modern fonts have. GSUB is the table that explains how sequences of unicode characters need to be replaced with other glyphs. I don't know enough about Syriac to know what processing needs to happen, but your script code will need to do this.

    Unity does assume a left-to-right rendering, so it's possible you need to reverse the string, and right align it when rendering. If you have loaded a font that has Syriac glyphs, I'd assume it will render glyph-by-glyph.
     
  4. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Actually, now I come to think about it, your FixGUITextCS script does show some Syriac characters. So it might be the case that the string pasted into GUIText.text isn't being decoded properly, so might not be in a Unicode format.
     
    Deleted User likes this.
  5. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    When I download a Syriac font, and drop that into the Assets folder, and then choose that as the font for the GUI Text, I get correct rendering when I hit play. Well, I mean the unicode characters from you post above get displayed, they might be missing some processing. I guess substituting points beneath letters will be hard. Not sure how the FixGUITextCS dll does that. Maybe ask them?
     
    theakkadian1 likes this.
  6. theakkadian1

    theakkadian1

    Joined:
    Sep 15, 2014
    Posts:
    7
    Thank you Graham for looking into this.

    The text in the FIXGUITextCS I have in the screenshot is not Syriac, it is actually Arabic. And Arabic is supported by Unity, except it just doesn't align it and connect it right; which is what FIXGuiTxtCS does.

    BUT THANK YOU, it DID actually recognize the Syriac letters once I attached a specific Syriac Font, and ONLY when I set the word in code. See attachment. I will probably have to create a fix similar to "FIXGUITextCS".

    One last question, do you know if Unity will support Arabic and Syriac Naively?
     

    Attached Files:

  7. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
  8. theakkadian1

    theakkadian1

    Joined:
    Sep 15, 2014
    Posts:
    7
    Thank you very much Graham, I will speak to him and see how he could help.

    I appreciate your guidance Graham.
     
    Last edited: Feb 7, 2015
  9. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I love fonts, and learning how non-western languages work. :)
     
    theakkadian1 likes this.
  10. theakkadian1

    theakkadian1

    Joined:
    Sep 15, 2014
    Posts:
    7
    It seems like it is going to be much harder for Syriac than Arabic, as in Arabic there are all states of each letter in Unicode, but in Syriac, they only have the isolated form for each letter. It seems that I might have to use something similar to Uniscribe (By M.S.), which is unmanaged C++. I haven't found any good method yet to just reference the dll and create my own Syriac Library which would link and shape the characters properly.

    This is what I found about Uniscribe:
    http://www.microsoft.com/typography/OpenTypeDev/syriac/intro.htm
     
  11. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I guess all I know about Syriac is that it has lots of glyphs that sit above or below other characters. If that's 99% of the problem, I'd create a new font with the glyphs combined but at different code points. I'd then look through the regular text strings, and work out which sequences to map to the different (new) glyphs. Not sure how the abbreviation mark would be implemented, though.
     
  12. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  13. theakkadian1

    theakkadian1

    Joined:
    Sep 15, 2014
    Posts:
    7
    Thank you hippocoder! I just sent him a message. hopefully he could help.
     
  14. theakkadian1

    theakkadian1

    Joined:
    Sep 15, 2014
    Posts:
    7
    Hi Graham,
    Problem with Syriac is not just the accents (dots and little glyphs above and below the characters), but also that each character could have up to 3-4 different states (glyphs), and according to what type of character it is, and what you are linking to, it will shape differently, and then you add to all this the accents.

    I can't see to seem those different glyphs in Unicode, if I can then I can easily create a dll to handle this for Unity.
    Here is where I found all glyphs supported by Unicode: (Tell me if I am wrong)
    http://unicodelookup.com/#syriac/1

    Thanks
     
  15. theakkadian1

    theakkadian1

    Joined:
    Sep 15, 2014
    Posts:
    7
    Also the Wrap property of the UnityEngine.UI.Text for all Right-to-Left languages doesn't work properly in Unity with the ArabicFix either. I had to write a script to line-break the lines where I wanted (by adding "/n" keyword). So I couldn't use Unity's built in Horizontal overflow = Wrap.

    So for Arabic and Syriac, I did this:
    Code (CSharp):
    1. if (_myMenuManager.UserLanguage == Global.Language.Arabic)
    2.        {
    3.            text.text = ArabicSupport.ArabicFixer.Fix(languageSpecificText, true, false);
    4.            text.horizontalOverflow = HorizontalWrapMode.Overflow;
    5.  
    6.            string[] lines = Regex.Split(text.text, "/n");
    7.  
    8.            text.text = string.Empty;
    9.  
    10.            for (int i = lines.Length - 1; i >= 0; i--)
    11.            {
    12.                text.text += lines + Environment.NewLine;
    13.            }
    14.        }
     
  16. nagaitan

    nagaitan

    Joined:
    Jul 23, 2015
    Posts:
    1
    that's great, may i get your full code? i don't recognize the Regex and Environment.
    Thank's.
     
  17. zulqarnain26

    zulqarnain26

    Joined:
    Feb 12, 2018
    Posts:
    7
    can someone tell me how to write URDU in Unity