Author Topic: [Request] UILabel - Preferred Font Size  (Read 7044 times)

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
[Request] UILabel - Preferred Font Size
« on: October 25, 2013, 10:20:22 AM »
I am using one 48px font for my whole project Steam Defense. Using it for big and small buttons. The problem begins, when i have button, that needs to support correct multiline, but still has to be not greater, than 32px. Is i use "Height" = 32px, line count is not optimal for my button. It would be great to set "Preferred font size" for label, of 0, if preferred = mFont.size;

Production version of my solution you can see at http://SteamDefense.com - main menu.

Here is my problem, description, and possible solution:


Here are settings for each variant:
1)


2)


3)


4)



Possible changes for code are in attachment
I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Request] UILabel - Preferred Font Size
« Reply #1 on: October 26, 2013, 10:09:54 PM »
This part of the code changed drastically with 3.0.3, so unfortunately your code is not compatible.

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: [Request] UILabel - Preferred Font Size
« Reply #2 on: October 28, 2013, 07:12:40 AM »
Have updated "preferred font size" update to latest NGUI version: 3.0.3

Diff with original UILabel.cs:



Diff with UILabelInspector:


I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Request] UILabel - Preferred Font Size
« Reply #3 on: October 29, 2013, 01:28:24 AM »
In 3.0.3 you can just use a dynamic font and specify the font size on labels.

AGB

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 74
    • View Profile
    • Steam Defense
Re: [Request] UILabel - Preferred Font Size
« Reply #4 on: October 29, 2013, 01:46:15 AM »
ArenMook, dynamic font is not able to use emoticons, uses additional draw calls.
Actually, Preferred Font Size for Bitmap fonts is "same" functionality, as font size for Dynamic Fonts. Why not to implement it?  ::)
I'm a busy man... I have places to go,monsters to kill...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Request] UILabel - Preferred Font Size
« Reply #5 on: October 29, 2013, 05:02:16 PM »
Why not indeed... I'll see to it.