Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: shokinhan on May 30, 2013, 01:34:42 AM

Title: Dynamic font don't support '\n' ??
Post by: shokinhan on May 30, 2013, 01:34:42 AM
Why Dynamic font don't support '\n' ?
It's trouble with me.
How to implement it ?
Title: Re: Dynamic font don't support '\n' ??
Post by: dlewis on May 30, 2013, 03:01:38 AM
The logic of \n has nothing to do with dynamic fonts, the code that controls it just so happened to change at the same time (completely unrelated). I haven't looked into it myself so I can't help any further.
Title: Re: Dynamic font don't support '\n' ??
Post by: Nicki on May 30, 2013, 05:48:59 AM
The labels used to filter \\n into \n every time it update. It doesn't do this anymore, so make sure that you don't pass \\n instead of an actual \n. Either pre-filter it or input correctly. :)
Title: Re: Dynamic font don't support '\n' ??
Post by: ivomarel on May 30, 2013, 05:51:36 AM
Depending on how you define your label-text, if you do it in the UILabel itself, \n will just display as \n. Instead, you can add enters yourself. Can't imagine that's rly the problem but sometimes the simplest things cause the biggest trouble.
Title: Re: Dynamic font don't support '\n' ??
Post by: shokinhan on May 30, 2013, 10:52:54 AM
Because of that early NGUI's UIlabel can analyse '\n', so a lot of configure text contain '\n'. If I use the dynamicfont, the text configure designer must be changed!

eg:

"This is a good game,\n welcome to the game". This text configure has '\n'. If I used the dynamic  font , this text would not make a newline!  So I must change a lot of text confugre.



Title: Re: Dynamic font don't support '\n' ??
Post by: Nicki on May 30, 2013, 03:38:00 PM
Alternatively, you can modify the UILabel to do it for you when it's drawn the first time.
Title: Re: Dynamic font don't support '\n' ??
Post by: ArenMook on May 30, 2013, 04:00:52 PM
Dynamic font works exactly the same as regular font in this regard. Dynamic vs bitmap's only difference is in what they draw.

Two character sequence '\' followed by 'n' is two characters and is not interpreted the same as a new line character '\n'.
Title: Re: Dynamic font don't support '\n' ??
Post by: shokinhan on May 31, 2013, 01:03:46 AM
I have reslove this probleam
add code :
    mProcessedText = mText.Replace("\\n","\n");

Title: Re: Dynamic font don't support '\n' ??
Post by: shokinhan on May 31, 2013, 02:23:05 AM
I use the early version about NGUI, now use the new version. Now UIlabel support dynamic font, should I  change the label to dynamic font ?

Because my project has a lot of code, some changes will make some trouble!

I don't know hot to select.