Author Topic: User-Selected Font?  (Read 2702 times)

sintua

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 0
  • Posts: 63
    • View Profile
User-Selected Font?
« on: February 04, 2014, 02:10:04 PM »
Hi, I was wondering what the best way to implement a custom font selection on the user side with NGUI would be. This would entail changing the font selection in every label already in the scene, as well as the fonts on the prefabs (or at least, change them as soon as they're instantiated).

I don't know if this is something where I should be putting a script on everything with a label and have it check or subscribe to some FontSelectionChanged event, or have one script that finds all the labels and changes them (in the prefabs as well, or modify the prefab create methods to load the current font of choice).

Has anyone built something similar?

(Side note: It's hard to find useful posts about fonts, because most search terms just pull up the tons of dynamic and bitmap font problem threads, so sorry if this was asked before and I didn't see the thread)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: User-Selected Font?
« Reply #1 on: February 04, 2014, 06:58:06 PM »
Make a Reference Font and change what's in there. It's a dropdown in the UIFont's inspector.

Make all your relevant labels use that reference font (which points to a different actual UIFont), then you only have to change one place. It's the same you can use when making fonts for multiple resolutions, although it's not really needed for that anymore.

JSorrentino

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 30
    • View Profile
Re: User-Selected Font?
« Reply #2 on: February 05, 2014, 12:51:52 PM »
This method does not support Dynamic fonts.

sintua

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 0
  • Posts: 63
    • View Profile
Re: User-Selected Font?
« Reply #3 on: February 05, 2014, 01:54:30 PM »
This method does not support Dynamic fonts.
Yeah that's the problem... Can't seem to make a reference font for/with my dynamic font.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: User-Selected Font?
« Reply #4 on: February 05, 2014, 02:02:33 PM »
The idea behind using a dynamic font is that it pulls in only the characters needed at any given time, but in reality there are a lot of issues with dynamic fonts in general that I would prefer to avoid. I have an idea for a third font type that would pull in dynamic font characters as needed, but would then cache them in an atlas as if it was a bitmap font, but at this time it's in prototype stages as there are quite a few hurdles to overcome first.