Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - atrainedmonkey

Pages: [1]
1
NGUI 3 Support / No linebreaks on Zero Width characters - Possible fix
« on: August 28, 2015, 10:37:51 AM »
Hi,

We've been having issues with Thai languages in our game, as localisation comes back with whole sentences with no breaks.

We need line breaks to be calculated dynamically, so we can't manually inject spaces.

Instead we have the localisation team indicate where the lines can be broken with a token character, and then we substitute this with the Zero Width Space character:
 http://www.fileformat.info/info/unicode/char/200B/index.htm

I thought this might be a bug, and not by design as the function NGUIText.IsSpace() recognises this character.

So I've added a patch file with our changes in-case this is a valid fix that could be applied to NGUI eventually.




2
Hi,

We've got a couple of questions related to UILabel and Text wrapping:

1) If we add line breaks to text in a UILabel where:
 - maxLines is 2
 - overflow is Shrink Content
Then the text won't shrink to fit, and text will be cut-off. However, Reset maxLines to 0 and the text scales to fit as expected.

Is this a bug or a known limitation with NGUI 3.8.1?

2) The line breaking algorithm is currently "greedy" and our client would like more balanced lines, like what you'd get from a "Minimum Raggedness" algorithm
http://en.wikipedia.org/wiki/Line_wrap_and_word_wrap#Minimum_raggedness

It's highlighted best with 2 line UILabels we use in a store menu to display descriptions for the items. Because it is greedy, it will try to fill the first line, even if the second line only has one word (or in Eastern languages, it will often put punctuation on a new line by itself).

We tried a workaround of adding new lines into the text before putting it in the label, but because of the first issue I mentioned, we lose scaling, and so longer text would get cut-off.
So currently I have modified UILabel to use our custom text wrap function.

My question is:
Are there any plans to expand on the functionality here?
 - Adding a minimum raggedness algorithm would be great!
 - Implementing more rules line breaking with Asian Lanugages would be a cheeky bonus to stop punctuation spilling onto other lines - although this issue is much less prevalent when not using a greedy algorithm.
https://msdn.microsoft.com/en-us/goglobal/bb688158.aspx


And if not, (languages are a big complex monster) it would be great for us if text wrapping in NGUI was extensible, so we can modify it to work best for us without having to apply patches to NGUI. As we have many projects that would share this.

Pages: [1]