Author Topic: Basic Documentation of Dynamic Fonts in NGUI 2.6.1?  (Read 9205 times)

madcalf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Basic Documentation of Dynamic Fonts in NGUI 2.6.1?
« on: May 29, 2013, 08:03:33 PM »
I'm having a heck of a time figuring out how to apply dynamic fonts to a UILabel. There seem to be a bunch of independent workarounds on the forums, but my understanding is that dynamic fonts are now built in to NGUI 2.6.1 without needing any of these previous solutions. Yet i cannot find anything on NGUI's documentation page that specifically explains how to use them.  When I create a Label object in NGUI, the only option in the UILabel component is for a UIFont, which means a font from an atlas.

I noticed some forum posts referring to UIFont.cs, so I tried attaching that to my label. This lets me set font property to dynamic and chose a unity font, but there's no field in the inspector of this component to type any text, (and the UILabel component will not display a text entry field either, unless i specify an atlas based UIFont). So i cannot enter any text to even see if the dynamic font is working.

I tried changing an existing Label in the NGUI Label example scene (Label.unity). I added aUIFont component and set the Font Type to dynamic. But i do not see any change to the text at all.

If you could point me to some basic documentation that steps me thru this, or if none exists yet, just write up a brief explanation here, that would be much appreciated. Apologies if i'm missing something obvious. Thanks!

madcalf

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Basic Documentation of Dynamic Fonts in NGUI 2.6.1?
« Reply #1 on: May 29, 2013, 09:49:45 PM »
Ok, figured it out. The dynamic font needs to be a prefab. You can create that prefab via the NGUI Font Maker tool, selecting Dynamic as the Type. This will create a dynamic font prefab with the UIFont script component attached. Then this prefab can be dragged into the Font slot of a UILabel in the inspector.