Author Topic: How to unify label's text size when the text is dynamic?  (Read 2139 times)

Nubeh

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 41
    • View Profile
How to unify label's text size when the text is dynamic?
« on: August 20, 2014, 03:00:39 AM »
I have 3 labels with a fixed width and height where I change the text (always one word only) dynamically. Because I don't know the length of the word beforehand I set the label to ShrinkContent. The problem now is that when a word in label 1 is short and the one in label 2 is long then the dimensions of the font for the two labels is different.
Is there a way to set the smallest font size among all 3 labels so that the text inside them looks all the same size?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to unify label's text size when the text is dynamic?
« Reply #1 on: August 20, 2014, 03:56:40 PM »
You can set the font size on the label itself. Change it to your desired font size. There is no "min" value with shrink to fit.

Nubeh

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 41
    • View Profile
Re: How to unify label's text size when the text is dynamic?
« Reply #2 on: August 21, 2014, 01:28:45 AM »
the problem with using a fixed font size is that I don't know anything about the length of the text coming from the server (also because I have translations so a short word in English can become a long word in Italian, German or French). In my GUI I want to allow only for a maximum width of the text so that it doesn't overlap with other gui elements. That's why I wanted to let the text shrink and then use the minimum font among the labels.