Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: cheyilin on May 27, 2014, 11:00:26 PM

Title: NGUI appending extra space if the line contains double-space
Post by: cheyilin on May 27, 2014, 11:00:26 PM
Hi,

I found NGUI appending extra space if the line contains double-space after upgrading from 3.5.8 to 3.5.9.

NGUI 3.5.8
(http://goo.gl/6Mo5uN)

NGUI 3.5.9
(http://goo.gl/0r1VGN)

Is this issue caused by "FIX: Text printing issue if the line begins with a double space." in 3.5.9 changelog ?

Thanks
Title: Re: NGUI appending extra space if the line contains double-space
Post by: ArenMook on May 28, 2014, 05:51:28 AM
Hmm yeah, something funky is going on there. I will look into this, thanks.

Edit: Replacing that entire section with this seems to do the trick:
  1.                         // If this marks the end of a word, add it to the final string.
  2.                         if (IsSpace(ch) && !eastern && start < offset)
  3.                         {
  4.                                 int end = offset - start + 1;
  5.  
  6.                                 // Last word on the last line should not include an invisible character
  7.                                 if (lineCount == maxLineCount && remainingWidth <= 0f && offset < textLength)
  8.                                 {
  9.                                         char cho = text[offset];
  10.                                         if (cho < ' ' || IsSpace(cho)) --end;
  11.                                 }
  12.  
  13.                                 sb.Append(text.Substring(start, end));
  14.                                 lineIsEmpty = false;
  15.                                 start = offset + 1;
  16.                                 prev = ch;
  17.                         }
(line 922 of NGUIText.cs)
Title: Re: NGUI appending extra space if the line contains double-space
Post by: cheyilin on May 29, 2014, 12:39:35 AM
Hi ArenMook,

The patch works perfectly (NGUI 3.6.1c), thanks.