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

Norwegian language character not showing proper in UNITY

Discussion in 'Editor & General Support' started by evaz, Sep 11, 2014.

  1. evaz

    evaz

    Joined:
    Jul 10, 2012
    Posts:
    2
    void OnGUI()
    {
    style=new GUIStyle();
    style.fontSize=30;
    GUI.Label(new Rect(0,0,Screen.width,Screen.height),"gjøre seg klar Nr du har ",style);

    }



    The top dot of first character is not proper ...
    How to solve this issue?
     
  2. Kaspar-Daugaard

    Kaspar-Daugaard

    Unity Technologies

    Joined:
    Jan 3, 2011
    Posts:
    150
    Hmm, which Unity version are you using? We have a lot of Danish developers so å rendering should be one of our key strengths.
     
  3. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    Works for me, with different fonts. ÆØÅ at all sizes, and Ö+Ä too.
     
  4. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    I'd guess that your font is using font features that are not present in Unity. Probably the string you are rendering is actually treated as an A character followed by the o-accent. (Don't know what that's called.) The font will have a table called GSUB, which says if you get that combination, render it as the accent super-imposed above the A. (Probably worth reading http://fontforge.org/gposgsub.html since I have a sneaky feeling I am missing some details.) Unity doesn't support these font tables, so you're getting these glyphs rendered one after the other.

    Put another way, whilst U+00C5 is the character you are trying to render, your font doesn't have this unicode character. Instead, it has capital A (U+0041) and the dot-accent (U+030A) and knows to render those together.

    Hmm. Changed my mind. The string you are rendering has these unicode characters:

    $ od -xc ~/Desktop/norwegian.txt
    0000000 4100 0a03 2000 6700 6a00 f800 7200 6500
    \0 A 003 \n \0 \0 g \0 j \0 370 \0 r \0 e


    The contents of that text file is a cut-and-paste of your string from the post above, written into a text file stores as utf-16 with no BOM. So you have u+0041 u+030a which renders as U+00C5 in apps that support GPOS, but as two separate glyphs in Unity. If you (use some magic I can't think of to) edit the string so it contains U+00C5 you'll get it rendered correctly in Unity. If I overwrite the first character in Text Wrangler (my text editor of choice) on my Mac, I then get:

    $ od -xc ~/Desktop/norwegian.txt
    0000000 c500 2000 6700 6a00 f800 7200 6500
    \0 305 \0 \0 g \0 j \0 370 \0 r \0 e


    Note that this is one 16-bit number shorter, since the character to render is just a single unicode character and not two which the font knows to render as one glyph.