Author Topic: 3.5.1 Bitmapped UIFont Corruption  (Read 4621 times)

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
3.5.1 Bitmapped UIFont Corruption
« on: February 25, 2014, 08:07:37 PM »
Thanks for your continued work on NGUI. I updated our in-development project from 3.4.9 to 3.5.1 and we're having a problem.

I'm experiencing what appears to be a bug with bitmapped UIFonts (old school). It appears that when I make a UIFont that appears on the Atlas it will initially work, but when I rebuild the atlas for any reason the bitmapped UIFont will have corrupt UV coordinates. The only way to fix this is to delete the UIFont object and remove it from the atlas and rebuild and recreate the UILabels? Can you see if you can reproduce?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #1 on: February 26, 2014, 03:27:44 PM »
It's a bit hard for me to check right now as I am currently working on 3.5.2 which changes the way font maker and atlas maker work a bit (read: it's all currently horribly broken). I'll see if there are any issues after I put it back together.

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #2 on: February 26, 2014, 08:08:02 PM »
I am having exactly the same problem  :-\

In my case however it was the opposite: When I build the font the first time it looked corrupted (wrong UV offset). I wasted an hour after work trying to figure out what I was doing wrong - but I gave up.
Then this morning when I was booting up the project again it showed up all perfect.

But I was curious so I added some sprites to the sprite sheet and rebuild the atlas in NGUI - and voilĂ  again - the font was broken. I restarted Unity - nothing changed, restarted again and again and eventually it showed up correctly again.

So there seems to be something broken in NGUI - not saving (marking prefabs as dirty) or not proper propagating changes to all related items (sprite sheet update affects fonts etc.). I would really really appreciate if this would be fixed sometime soon because upcoming projects will depend on NGUI and fonts working without issues.

I will post some screenshot the next time it looks broken again.

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #3 on: February 26, 2014, 09:00:35 PM »
We'll just use dynamic fonts until 3.5.2 is ready.

Curious, I haven't used bitmapped UIFonts in awhile, but did you remove the ability to have the font OFF the atlas and on its own material at some point? I think that it still might be useful for some use cases? Was there a reason why it was removed or am I missing the way to do that?

Also just a friendly reminder that UIFont needs a documentation entry in the documentation forum too. So if you're refactoring it, it might be a good time to get that written if there is a new system incoming. :)

Thanks!

mohit

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #4 on: February 26, 2014, 09:43:10 PM »
I am having the same problem. When I use bmGlyph and generate the bitmap, if the font size is 100 the UV coordinates are fine and letters in labels show up fine, however when I change the font size to 200 all the coordinates get corrupted. If I change back the font size to 100, everything goes back to normal.

renderhjs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #5 on: March 07, 2014, 12:46:19 AM »
Bump!

This is still a major bug and I don't know how to avoid it or deal with it. In this screenshot you can see what just happened


All I did was adding one more sprite to the sheet and just like that the font corrupted.

This script from another thread here didn't help either. Anyone got any recipe to fix this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #6 on: March 07, 2014, 09:07:55 AM »
I can see something like this happening when you attempt to add the font to an atlas making the atlas too large to fit on the target device, forcing Unity to shrink the atlas texture. Check the before and after atlas size and how everything looks inside. If not, I'd appreciate a repro case to look at. You can email it to me (support at tasharen.com).

bgdev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #7 on: March 17, 2014, 06:54:05 PM »
I'm also having this exact same bug.

I've been using NGUI for more than six months, and only had had a few minor bugs so far related to fonts. Then two weeks ago, I had to drastically increase the number and size of our fonts. I'm now packing multiple fonts of size ~100 in one atlas, and that's when problems really started.

Multiple times I committed "fixed" font atlases to only see the problem later re-appear. As renderhjs mentioned, it could be an issue with some prefabs not being marked as dirty.

In an attempt to create a repo-case, I segregated all my fonts to a separate project. To my surprise, the problem briefly went away!

dustycakes

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: 3.5.1 Bitmapped UIFont Corruption
« Reply #8 on: May 03, 2014, 01:21:32 PM »
I was having this issue as well. However I found that rebooting Unity fixed the issue.