Unity TMP text displays "ï" or "İ" with two dots in some cases in Turkish words

huangapple go评论70阅读模式
英文:

Unity TMP text displays "ï" or "İ" with two dots in some cases in Turkish words

问题

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:

Unity TMP text displays "ï" or "İ" with two dots in some cases in Turkish words

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": [ "Sabit Fikirli", "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.

英文:

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:

Unity TMP text displays "ï" or "İ" with two dots in some cases in Turkish words

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:

[
    {
        &quot;word&quot;: &quot;At G&#246;zl&#252;ğ&#252;&quot;,
        &quot;tabooWords&quot;: [ &quot;Sabi̇t Fi̇kirli̇&quot;, &quot;D&#252;ş&#252;nmek&quot;, &quot;Bakmak&quot;, &quot;Dar&quot;, &quot;Tutucu&quot; ]
    }
]

Deserialize the local json string:


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

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

        // Deserialize jsonString to TabooData class.
        GameManager.tabooData = JsonConvert.DeserializeObject&lt;List&lt;GameManager.TabooData&gt;&gt;(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

得分: 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.

英文:

"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.

huangapple
  • 本文由 发表于 2023年2月27日 01:25:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75573773.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定