Author Topic: Reverse line wrapping  (Read 551 times)

Cyndor

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Reverse line wrapping
« on: May 15, 2017, 01:46:25 AM »
I'm trying to add Arabic as a language in our app. The problem I'm facing now is line wrapping. Something I did already have to change in the NGUIText script is to exclude Arabic characters from being flagged as "eastern". Flagging Arabic as eastern seem to line-break Arabic in the middle of words.

A remaining problem I have now is line wrapping. As you probably already know, Arabic is a Right-to-Left language. For Arabic to show correctly the line wrapping should get the last word from the left side (instead of the right side) of the sentence and place it on a new line. Is this easy to change and if yes, can anyone point me in the right direction to make this work?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,137
  • Toronto, Canada
    • View Profile
Re: Reverse line wrapping
« Reply #1 on: May 19, 2017, 05:00:13 AM »
I'm pretty sure there was another tool that handled RTL languages for NGUI. This one: http://www.inter-illusion.com/tools/i2-localization

I'd say save yourself some trouble and grab it -- it's quite good!

Cyndor

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Reverse line wrapping
« Reply #2 on: May 31, 2017, 01:12:13 AM »
Thanks for the reply. Although the i2 plugin can handle RTL languages, the problem with i2 is that you need to setup a character limit for RTL to work correctly (Max Line Length). So using i2 requires me to add a Max Line Length to every label in our app (and that's alot :) ). So I was wondering if there was an easy (dynamic) way to do the same with by editing the NGUIText script without having to set a character limit for every label.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,137
  • Toronto, Canada
    • View Profile
Re: Reverse line wrapping
« Reply #3 on: June 05, 2017, 03:52:40 AM »
That sounds like an odd requirement... why would the max char setting be needed? Might be a question for that plugin's author.

You could write a script to execute at edit time that would run through all your labels in the scene and set their max char limit to some value, or just the length of the contained text. This would save you from doing it manually, and no NGUI modification would be necessary. Unfortunately there is nothing special in NGUI for RTL handling itself.