0

I'm using Unity's Text Mesh Pro (TMP) component to display text in my project. The text is loaded from a JSON file, and some of the "i" characters are displaying with two dots.

This is how it looks:

I'm using default TMP Font LiberationSans SDF. The problem does not occur when I manually type the word in the script or in the inspector. It displays as it should. The dot at the right one comes from TMP submesh created by itself.

When I deactivate the submesh object, the second dot above the i disappears, but the correctly displayed "ç,ğ,ö,ş,ü" characters (Turkish) are also affected.

Here is my json file and how I use it:

Json sample:

[
    {
        "word": "At Gözlüğü",
        "tabooWords": [ "Sabi̇t Fi̇kirli̇", "Düşünmek", "Bakmak", "Dar", "Tutucu" ]
    }
]

Deserialize the local json string:


#if UNITY_EDITOR_WIN
            GameManager.jsonString = (Resources.Load("words-tr") as TextAsset).text;
#endif

#if UNITY_ANDROID
            GameManager.jsonString = File.ReadAllText(jsonLocalPath);
#endif

        // Deserialize jsonString to TabooData class.
        GameManager.tabooData = JsonConvert.DeserializeObject<List<GameManager.TabooData>>(GameManager.jsonString);

Sample of usage:

mainWordText.text = tabooData[index].Word;

If you want to have a look at all the code, the github repository of the project: https://github.com/FarukKayaduman/taboo-word-game

What could be causing this issue, and how can I fix it? Is there a way to force TMP to use the correct "i" character, or do I need to modify the JSON file or font asset?

Any help or advice would be greatly appreciated. Thank you.

  • 1
    Are you using a FONT that is compatible with the language? The issue is either the Font or the Encoding that is wrong. If the encoding is UTF-8, than it is the Font. – jdweng Feb 26 '23 at 17:28
  • @jdweng the font is compatible. I tested it by assigning special characters from the script. As encoding, in Visual Studio I selected "Unicode (UTF-8 with signature) - Codepage 65001". – farukkayaduman Feb 26 '23 at 18:01
  • See following for an example of a SDF font and how you need to modify for additional characters : https://stackoverflow.com/questions/72086036/cyrillic-is-not-displayed-in-textmeshpro – jdweng Feb 26 '23 at 19:48

1 Answers1

0

"Sabi̇t Fi̇kirli̇" - those i's do include a second dot, even here in this answer (I copied it from your json example). So my guess is your source json file is to blame here. Fix the json and your problem should be gone.

frankhermes
  • 4,720
  • 1
  • 22
  • 39
  • I used the online tool to capitalize the words in json. It looks like the problem was because of that. I solved it by rewriting words to a new .json file. – farukkayaduman Mar 16 '23 at 20:57