Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity screws up some fonts? (Testing Tamil)

Discussion in 'Editor & General Support' started by WorkingsUK, Oct 2, 2013.

  1. WorkingsUK

    WorkingsUK

    Joined:
    Sep 11, 2012
    Posts:
    12
    Hiya,
    Trying to do a Tamil conversion of one of our games, but some of the characters are coming out wrongly. When pasting certain words into Unity (e.g. நேர), Unity reverses some of the letters. If you copy and paste them back into a standard text editor they come out fine. Just seems to be a bug of how Unity is treating the letters.
    Any help would be greatly appreciated as a bit of a show stopper!
    Cheers,
    Chris
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    So, I copied that string and pasted it into a text file. I saved that text file as UTF-16. If I do a hex dump of that file I get:

    graham$ od -x tamil.txt
    0000000 fffe a80b c70b b00b


    Ignore the byte-order-mark, and look at the last 3 columns. These tell me that the sequence of glyphs starts with U+0x0BA8, which is the ந character in Tamil. Now, in your forum post, this glyph appears in the middle of the string. So, there must be some rules about Tamil language that changes the order in which glyphs are displayed. I don't know what these rules are, but guess they are encoded in the font's GSUB or GPOS tables. GSUB controls the way sequences of glyphs are displayed, so, the f-followed-by-i sequence in some fonts can be swapped out for a single fi ligature (U+FB01). GPOS controls the spacing of glyphs, so can move sequences together/apart, so is another way to display fi using two glyphs. Some fonts display accented characters by rendering the character, and then the accent having moved the accent backwards to appear over the character. Anyways, this is just "knowledge sharing". Unity does not process the GPOS or GSUB tables, which is why the order of your string in Unity is the order of the glyphs in the string. You may need to implement some string munging code, either offline, or in your script that takes strings, and orders the characters correctly knowing that Unity will display them in the order they are in the string. (Ashkan did this for Farsi, which has complex rules for the casing of characters. In Farsi there are different glyphs used when a letter appears at the start, end, or middle of a word. The GSUB table usually handles this.)
     
  3. abusaadp

    abusaadp

    Joined:
    Aug 16, 2014
    Posts:
    2
    Hi,
    I had a similar problem with hindi and have worked out a solution given in this link. You can use a similar approach for tamil and share the results with us.
     
  4. hessel_mm

    hessel_mm

    Joined:
    Mar 12, 2014
    Posts:
    44
    I'm running into this exact problem, has anyone created/found a solution for this?

    And, while we're at it, why hasn't unity fixed this yet?
     
  5. nareshkumaryakkala

    nareshkumaryakkala

    Joined:
    Jan 26, 2013
    Posts:
    3
  6. vasanthbalaji

    vasanthbalaji

    Joined:
    Nov 15, 2014
    Posts:
    34
  7. legendarysoulbow

    legendarysoulbow

    Joined:
    Sep 9, 2022
    Posts:
    3