Author Topic: Script | Scale text to fit in max size  (Read 2581 times)

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Script | Scale text to fit in max size
« on: February 14, 2013, 03:14:29 PM »
Guys, we are making one game here, and it's for some languages.

So, we have some UILabels, and some of then can't fit the same text, and this bring a big problem in some points to us.
So I made this script, that scale the text to fit some other text keeping the same size, like these:



simple but really usefull to us.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Script | Scale text to fit in max size
« Reply #1 on: February 14, 2013, 09:16:41 PM »
That's useful, thanks for sharing.

PabloAM

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 58
    • View Profile
Re: Script | Scale text to fit in max size
« Reply #2 on: April 30, 2013, 03:13:26 AM »
Hello, thanks for sharing!

Could be used with multi line text?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Script | Scale text to fit in max size
« Reply #3 on: April 30, 2013, 07:35:59 AM »
This is a part of NGUI now. Check the settings on your UILabel.

AtomicBob

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 69
    • View Profile
Re: Script | Scale text to fit in max size
« Reply #4 on: May 13, 2013, 12:20:27 PM »
This is a great addition. However, I'd like to point out that it doesn't seem to work with multiline text. It just shrinks everything on the first line, rather than breaking to a new line and filling it up before trying to scale.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Script | Scale text to fit in max size
« Reply #5 on: May 13, 2013, 12:53:57 PM »
It's designed to work with single line labels.