Author Topic: Question on Scrambled Text  (Read 2549 times)

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Question on Scrambled Text
« on: May 23, 2014, 03:52:33 AM »
Hello everyone, I'm having a strange problem with some label text seemingly being randomly scrambled (see pic). I would like to note that I have seen a few threads that deal with this type of issue, though the tend to be fairly old and usually end with either NGUI having fixed it with a new version, or Unity fixing it in a new version.

The problem:
For some reason, text may not appear at all, may appear scrambled, or may flash on and off (and be scrambled). I have never seen it happen in editor or on a iOS device (though I haven't done THAT much testing on actual devices). The problem does however seem to happen every time on PC and MAC builds.

In the picture, all 4 labels use the same font, share the same settings, and the font is a .ttf, and I am using version 3.5.7. If anyone knows how to fix it or a workaround I would be grateful to know about it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Question on Scrambled Text
« Reply #1 on: May 23, 2014, 04:11:20 PM »
Dynamic fonts tend to have issues like these, and is the main reason I don't use them. In your case the font size between the labels likely differs, possibly because the text doesn't fit and has to be shrunk. The scrambled label is drawn with a different font height than the non-scrambled one. Try disabling the "keep crisp" option.

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: Question on Scrambled Text
« Reply #2 on: May 23, 2014, 11:11:48 PM »
I tried your suggestion and it worked - thank you. One follow up if you don't mind:

In trying to stay away from dynamic fonts, I understand that bitmap fonts are a type of "non dynamic font" that seem to be quite common around Unity. Are there any other common types? I've tried searching for "non dynamic fonts" / font types and for things like "what is a non dynamic font", but all I get in results is more dynamic font types and dynamic font info. So I'm a little confused on how to get away from dynamic fonts.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Question on Scrambled Text
« Reply #3 on: May 24, 2014, 04:10:40 PM »
Bitmap fonts are NGUI. Dynamic fonts are Unity. Use the NGUI's Font Maker to create a bitmap font.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Question on Scrambled Text
« Reply #4 on: May 25, 2014, 02:14:53 PM »
Bitmap fonts just means that you've pre-rendered the font to a texture file instead of rendering as needed from the TTF. Because it's prerendered, you won't run into problems like this where the texture coordinates haven't updated properly, because the font texture changed after it was set. Turning the label on and off should also make it work again, but obviously you don't want to have to do that.

There are pros and cons to both, of course, and its up to you to figure out which you want to use.