Author Topic: Dynamic Font Size Question  (Read 6889 times)

FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Dynamic Font Size Question
« on: July 20, 2013, 01:24:06 PM »
I am a little confused on the proper way to do multiple sizes using same TTF.  I notice that when using NGUI font maker and pointing to a TTF, it then uses the material/texture of the TTF.  If I need multiple sizes though of same font, do I need to import multiple TTF's with different names or can I point them all to the same TTF & Material?  Or do I need to make separate materials for each NGUI Font but still point to same TTF?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic Font Size Question
« Reply #1 on: July 20, 2013, 03:12:02 PM »
Create multiple UIFonts pointing to the same TTF.

FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Re: Dynamic Font Size Question
« Reply #2 on: July 20, 2013, 03:13:40 PM »
Ok thanks!  Is there any issue with changing size of the dynamic UIFont at run-time to account for lower resolution devices?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic Font Size Question
« Reply #3 on: July 20, 2013, 03:20:41 PM »
Aside from the system itself being pretty broken within Unity, nope!

FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Re: Dynamic Font Size Question
« Reply #4 on: July 20, 2013, 03:21:50 PM »
Ha, care to elaborate on that? I am switching our app completely to dynamic fonts right now, something I should be aware of or hold off on?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic Font Size Question
« Reply #5 on: July 21, 2013, 04:34:57 AM »
There are quite a few threads on that in this forum. The TLDR version is that in some situations when the texture gets resized by adding extra glyphs, labels become broken and draw random stuff. If you pre-load all the characters you need upfront (request characters in texture on the font itself in your script's Start function), it works fine.

FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Re: Dynamic Font Size Question
« Reply #6 on: July 21, 2013, 10:11:03 AM »
I see, that would be quite difficult since our app uses lots of dynamic content that is downloaded at run-time.  So far I have noticed no issues though.  Maybe it's because I am using Unity 4.2?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic Font Size Question
« Reply #7 on: July 22, 2013, 04:50:29 AM »
Most likely because you haven't run into a case where the texture gets resized past its initial 512x512 size.

FizzPow

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 83
    • View Profile
    • FizzPow Games
Re: Dynamic Font Size Question
« Reply #8 on: July 24, 2013, 01:18:42 PM »
I sometimes see text look garbled for a quarter-second on some screens then fixes itself quickly.  Is this what you are talking about?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic Font Size Question
« Reply #9 on: July 24, 2013, 02:22:31 PM »
It's related, yeah.