Use non-English fonts with GUIStyle

From Unify Community Wiki
Jump to: navigation, search

HowTo Write with on non English letters

Main idea is create GUIStyle, with proper TTF font and Proper Script Codepage (UTF-16 LE).

1) Open new completely empty Unity3D project

2) Get proper TTF fonts from for this message, extract it from archive and put to "\Assets\TTF_Fonts" in project dir.

3) Create JS script by typing Assets / Create / JavaScript, with name Cyr_test and fill it with this content:

/* Declare a GUI Style */
var customGuiStyle : GUIStyle;

function OnGUI () {
    // Provide the name of the Style as the final argument to use it
    GUILayout.Button ("Cyrillyc Text: -Тест Русского Языка- 1", customGuiStyle);

    // If you do not want to apply the Style, do not provide the name
    GUILayout.Button ("I am a normal UnityGUI Button without custom style -Русский текст без стиля-");

    if (GUI.Button (Rect (10,50,1500,1000), "Other Cyrillyc Text: -Тест Русского Языка Ля Ля- 2.", customGuiStyle)) {
        print ("You clicked the button! Ляляляля");

You can change Russian text to any other text to test it, but i am sure that you will needs proper fonts for this.

4) Get free PSPad Editor ( or any other which can convert files to UTF-16 LE charset.

5) Open in PSPad Editor "\Assets\Cyr_test.js" and save it as UTF-16 LE. In PSPad you can type Format / UTF-16 LE and than File / Save for this.

6) Create Empty object by GameObject / CreateEmpty and assign Cyr_test to it by Components / Scripts / Cyr_test

7) Highlight GameObject and see to Inspector window. Custom Gui Style component will appear. Open it and set Arial to Font row.

Start project and see your text:

Personal tools