Author Topic: UILabel: Shrink content with a font with no spaces  (Read 2271 times)

Sobraj

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 11
    • View Profile
UILabel: Shrink content with a font with no spaces
« on: June 01, 2015, 08:39:43 AM »
Hi,

I have a UILabel with a custom font with only 2 "characters" (2 type of stars) that are mapped to a and b. I have no spaces in my font.
I use the UILabel Shrink Content so that it always fits a certain width. The shrinking works, but it does not use multiple lines, it shrinks so it fits on one line.
Is there a way to make it split? I tried to just add spaces between the a's and b's but that does not work.

Font:
info face="StarFont" size=22 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0
common lineHeight=128 base=22 scaleW=256 scaleH=128 pages=1 packed=0
page id=0
chars count=2

char id=97 x=0 y=0 width=128 height=128 xoffset=0 yoffset=0 xadvance=128 page=0 chnl=0
char id=98 x=128 y=0 width=128 height=128 xoffset=0 yoffset=0 xadvance=128 page=0 chnl=0

Screens:
http://gyazo.com/c203050083819d178dc7e1fc45dbc2fa
http://gyazo.com/4797bbf121fd62d86e2a99cc6fffc950
http://gyazo.com/18c43a6b79e7db3b9e1a917727c6479d

r.pedra

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 20
  • Posts: 131
    • View Profile
Re: UILabel: Shrink content with a font with no spaces
« Reply #1 on: June 01, 2015, 09:02:32 AM »
I had the same problem today. If I enter random things with my keyboard, it doesn't go to the next line but if I write words, sentences etc... then it goes to the next line.
Weird behaviour.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UILabel: Shrink content with a font with no spaces
« Reply #2 on: June 01, 2015, 09:19:58 PM »
You need to add a space there if you want it to split, or just split it yourself using new line chars.

Sobraj

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 11
    • View Profile
Re: UILabel: Shrink content with a font with no spaces
« Reply #3 on: June 04, 2015, 04:33:42 AM »
So I have to add spaces to my font, correct?

I added the space to the font and it now works. Thanks for the help.
« Last Edit: June 04, 2015, 04:41:49 AM by Sobraj »