Author Topic: Randomly garbled fonts when in atlas  (Read 3999 times)

yuriks

  • Guest
Randomly garbled fonts when in atlas
« on: October 17, 2013, 09:35:02 AM »
I'm using NGUI 3.0.2 with Unity 3.5.7f6.

When using fonts that have their corresponding sprites inserted into an atlas, I get random corruption/incorrectness of the font data. This results in labels instead using incorrect locations to display glyphs and showing cut or partial glyphs from random places in the atlas.

When this happens, sometimes re-importing the character definitions or tweaking the spacing will cause the font to correct itself, sometimes nothing seems to work and I just have to work with broken fonts until it eventually fixes itself. The problem is present both in the editor and at runtime.

I have been unable to find a consistent way to reproduce this, but it happens when inserting new fonts into the same atlas as a previous font, or sometimes even just closing and loading the project again. This is a screenshot of what it looks like: (With the font asset that's corrupted selected.)



I tried debugging the problem a bit but didn't find any obvious issues in the code.

EDIT: In this particular instance, re-importing the font definition or changing the spacing didn't work. Changing the Atlas' pixel size from 0.5 to 1 and then back fixed it, for now.
« Last Edit: October 17, 2013, 09:49:49 AM by yuriks »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Randomly garbled fonts when in atlas
« Reply #1 on: October 18, 2013, 04:18:55 PM »
Curious. I will see if I can reproduce it on my end, but if you get some clear repro steps, it would be much appreciated.

EToreo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Randomly garbled fonts when in atlas
« Reply #2 on: October 22, 2013, 10:24:27 AM »
I have a reliable reproduction in this thread:
http://www.tasharen.com/forum/index.php?topic=6237.msg29533