Author Topic: Upgrading from 3.0.1. Questions about UIFont, UILabel changes  (Read 5631 times)

Tiktaalik

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 0
  • Posts: 39
    • View Profile
Upgrading from 3.0.1. Questions about UIFont, UILabel changes
« on: February 17, 2014, 07:41:48 PM »
I'm looking at the implications of upgrading our project from 3.0.1 to the latest version. I upgraded and noticed that all our text was super small. I believe this is because previously we had one UIFont size and were scaling the UILabels (ie. 0.5, 0.25) to get smaller text, but now NGUI has a separate font size field and so these two notions are making things doubly small. It seems like setting the scale to 1 makes things the right size. Would this be correct? At this place in the project I'm a bit hesitant to make this change, because setting the UILabels scale to 1 fixes the text size but changes the label box size. That might create a lot of knock on work. Are there any downsides to the current approach of scaling text via scaling UILabel?

I'm a bit confused by the new UILabel Inspector. There's a drop down saying "NGUI" and one for "Unity" but I haven't found anywhere in the documentation or release notes that explains what this is about. If I select Unity I have the option to directly input typefaces, but if I select NGUI I can drop in a UIFont prefab. In either I still have the option to set font size. Are these both making use of dynamic fonts? What's the concept here?

One thing I'd like to know more about is UIFont.pixelSize. I've read in a number of places on the forum that the correct approach for retina devices should be to have a UIFont with pixelSize to 0.5f. Is the idea to create this, save as a prefab and use with the "NGUI" setting? In this situation can I just use one UIFont prefab, and set text dynamically?

Anything else I should be aware of with regard to fonts with this upgrade?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgrading from 3.0.1. Questions about UIFont, UILabel changes
« Reply #1 on: February 18, 2014, 10:00:06 AM »
Yup, leave the scale at 1 and change the font size field instead.

NGUI = Bitmap font, part of an atlas.
Unity = Dynamic font.

Pixel size is something you'd use if you were creating HD / SD atlases. One would have half the pixel size of the other. It's not something you should worry about if you're not doing dynamic atlas swapping based on the resolution.

Tiktaalik

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 0
  • Posts: 39
    • View Profile
Re: Upgrading from 3.0.1. Questions about UIFont, UILabel changes
« Reply #2 on: February 18, 2014, 02:33:45 PM »
Pixel size is something you'd use if you were creating HD / SD atlases. One would have half the pixel size of the other. It's not something you should worry about if you're not doing dynamic atlas swapping based on the resolution.

Now that UILabels can accept dynamic fonts directly, what would the approach be for creating a retina resolution game? My assumption is that if the mock ups with retina quality art are using a 32 sized typeface, when setting the font size in the UILabel it needs to be half (16) to look right?

Edit: I must be doing something wrong, because my text looks blurry now, but it was crisp with the old method we were using.

Edit Edit: Got everything looking crisp again by setting the font to be double (retina) sized, the same size as the artist makes it, but then by scaling the UILabel to 0.5. The problem with this of course is that you have to fiddle with the UILabel dimensions, and it feels there should be a way to bake this in.

What's the best way of doing this? Should I go back to using a bitmap font where I can set the PixelSize? Is there some other way of setting the pixel size to 0.5 across the board for all UILabels?
« Last Edit: February 18, 2014, 07:11:25 PM by Tiktaalik »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Upgrading from 3.0.1. Questions about UIFont, UILabel changes
« Reply #3 on: February 19, 2014, 12:11:36 PM »
Labels have a "keep crisp" option that would automatically use pixel-perfect size for dynamic fonts whenever possible.

There is also currently an option to use reference fonts even with dynamic fonts, but I don't remember if it's a 3.5.0 feature or not.