Author Topic: Word wrapping in UILabel breaks at last character  (Read 7448 times)

Dalediko

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Word wrapping in UILabel breaks at last character
« on: June 18, 2014, 09:49:10 AM »
Hey everyone,

I've been struggling with this for a while. Found some posts here on similar issues, but none of them solved my prob.
We're using NGUI 3.6.1, developing an app for mobile (Android & iOS) which contains tons of dynamic texts.
Our customer is in Germany, meaning... lots of long German words :-)

On multiline UILabels with "ResizeHeight", when the last word in the line is just a bit too long, sometimes the last character
is broken into a new separate line.
It doesn't even "join" the following line - it's much worse - the last character appears in a separate line of its own,
then another line break, and only then the rest of the text continues...

I've tried to dig into the UILabel code and NGUIText.WrapText(), but gave up pretty quickly :-)
Maybe someone has already found a solution for this?

TNX

Daled.

BTW, I'm using bitmap fonts

Yukichu

  • Full Member
  • ***
  • Thank You
  • -Given: 3
  • -Receive: 8
  • Posts: 101
    • View Profile
Re: Word wrapping in UILabel breaks at last character
« Reply #1 on: June 18, 2014, 11:32:46 AM »
I had issues where if I had two spaces between the end/start of sentences, I'd get the same issue sometimes (not all the time).

Not sure if it's related, but worth a check.  I just remember to use a single space between sentences now.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Word wrapping in UILabel breaks at last character
« Reply #2 on: June 18, 2014, 04:35:45 PM »
I'm not sure what this would be caused by, but if you can create a repro case for me, I'd love to have a look.

kittikun

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 46
    • View Profile
Re: Word wrapping in UILabel breaks at last character
« Reply #3 on: August 21, 2014, 10:22:35 PM »
I am experiencing a similar bug with the following setup on 3.7.0

label set to resize freely with all anchors set except the left one, so it expanding on the left as expected.

Sometimes, when add characters to the text, a new line will be added for the last characters

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Word wrapping in UILabel breaks at last character
« Reply #4 on: August 22, 2014, 03:56:00 AM »
I looked into this and fixed it yesterday. Repro cases are a wonderful thing. :P