Author Topic: text line breaks in UILabel in some condition  (Read 4367 times)

taorui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
text line breaks in UILabel in some condition
« on: November 06, 2015, 08:57:57 AM »
hi, I ran into an issue that text line breaks when ascii characters and some other languages like Japanese mixed together.

Like the pictures attached below, in the first line in UILabel, there is only a space placed between the "(1)" and Japanese characters,
but the line breaks and looks like the Japanese characters start from the second line.
(UILabel is set to resize-height)

This only happens in the first line, as you can see, the "(2)" and the following characters are displayed correctly.

Is there any way to avoid this? If any, please let me know, thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: text line breaks in UILabel in some condition
« Reply #1 on: November 10, 2015, 07:51:25 PM »
This happens because the japanese characters are all treated as one word, so it tries to place the word on a line without any line breaks because it simply doesn't know where the line breaks should be. You can add zero-width spaces in between of your characters, and NGUI will treat them as separate words for the purpose of line breaks.

taorui

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: text line breaks in UILabel in some condition
« Reply #2 on: November 10, 2015, 08:59:12 PM »
Thank you for your reply, I will try it. :)