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.

TextMesh Pro Empty squares on certain PCs

Discussion in 'UGUI & TextMesh Pro' started by Efril, Nov 22, 2022.

  1. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    79
    Hello. I'm seeing strange behaviour where the same string is displayed fine on my PC and includes an empty square instead of 'I' on some other PCs. One guy made a video on my game and I see this on his screen:

    (Taken from his video
    )
    And this is on my PC:

    As I understand he has a Turkish version of Windows, but how can this affect my game if there are no Turkish characters in the string and font atlases are precompiled? How can I fix this?
    Thanks in advance.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    The "square" is the symbol for a missing glyph. This means that whatever character is being referenced in the text when the Turkish language is selected is missing from your font asset.

    Most likely your font asset is static and missing this Turkish character and glyph. I would suggest setting your PC to Turkish as well to identify this missing character and to add it to your font asset. Alternatively, you could add a dynamic font asset created from the same font file as local fallback to your primary font asset. Be sure to use the same Sampling Point Size to Padding ration on the fallback and to have Multi Atlas Texture and Clear Dynamic Data on Build enabled.

    There are several posts about these options. Here are also two videos going over some of these options as well.



     
    Efril likes this.
  3. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    79
    Thank you for yor help. Sorry for the late reply. The game had more urgent issues that needed to be fixed. Unfortunately, I was not able to reproduce the issue by setting my Windows to Turkish language. But anyway, I decided to choose the solution with static fonts and dynamic fallbacks. Hope it will work fine on player's PCs.
     
  4. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,574
    Are you manipulating those strings to make them uppercase/lowercase? Because the toLower() and toUpper() are culture-aware and in a system with the culture set to Turkish they will replace "i" with the Turkish variant of that character. You need to use toUpperInvariant/toLowerInvariant instead.
     
  5. Efril

    Efril

    Joined:
    Aug 31, 2013
    Posts:
    79
    Probably it is not my case, because I'm just using auto capitalization feature of TextMeshPro - Text (UI) component.
     
  6. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,574
    That explains it: it's likely TMPro is using toUpper() instead of toUpperInvariant().

    If you're not displaying any Turkish text, you can get around this by setting the default culture when the game starts:

    Code (CSharp):
    1. System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");