Search Unity

Font.GetCharacterInfo bug in WP8 Win8 for non-latin character

Discussion in 'Windows' started by AlfredL, Sep 15, 2013.

  1. AlfredL

    AlfredL

    Joined:
    Sep 10, 2013
    Posts:
    27
    Recently when I use NGUI with Unity 4.2, I found non-latin character (like Chinese or Russian) cannot be displayed in UILabel on WP8 and Win8 build. After further debugging, I found Font.GetCharacterInfo always return false for non-latin characters although they are already in font texture. The repro is very simple, just put a UILabel with non-latin character, deploy the build to a Win8 or WP8 device and the character won't show up.

    With Font.characterInfo, I am able to workaround this bug by re-implement Font.GetCharacterInfo. However, it will be great if Unity can confirm it's a bug for WP8 and Win8 platforms and get it fixed soon.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Hello,

    it is indeed a known bug.
     
  3. AlfredL

    AlfredL

    Joined:
    Sep 10, 2013
    Posts:
    27
    Will this issue be fixed with Unity 4.3 release?
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
  5. AlfredL

    AlfredL

    Joined:
    Sep 10, 2013
    Posts:
    27
    Thanks for the confirmation. It's awesome. Looking forward to it.
     
  6. Helical

    Helical

    Joined:
    Mar 2, 2014
    Posts:
    50
    I can't get it to work. It always returns false on the 'a' character???


    char A = 'a';
    Debug.Log(style.font.GetCharacterInfo(A, out info));
     
  7. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,900
    What Unity version are you using?
     
  8. Helical

    Helical

    Joined:
    Mar 2, 2014
    Posts:
    50
    4.5.3f3

    I worked around my problem. dont have to get down to the dirty level yet.
     
  9. demented_hedgehog

    demented_hedgehog

    Joined:
    Nov 14, 2014
    Posts:
    8
    @Helical Maybe you could give us a clue as to how you worked around the problem?
     
  10. Helical

    Helical

    Joined:
    Mar 2, 2014
    Posts:
    50
    Well originally I needed to know the size of the text in order to set the bounding box around it. well there is an article I found http://docs.unity3d.com/Manual/HOWTO-UIFitContentSize.html that helped me with my problem.

    For another problem I wanted to have text being typed it by a script already in its best fit. But to know the best fit of a string inside a given bounding box you could use text.cachedTextGenerator.fontSizeUsedForBestFit But I believe you need to give it an Update or something to calculate, as I'm not sure it happenes immediately every time the text changes.

    For the life of me, I tried to get the low level information about fonts but couldn't. Just gonna have to work around font issues is all I'm saying.