Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: wsycarlos on January 07, 2013, 10:54:01 PM

Title: Dynamic font support for NGUI
Post by: wsycarlos on January 07, 2013, 10:54:01 PM
We have change some code in UIFont to make the dynamic font work in NGUI
and also compatible with old NGUI version.
Now we are fixing some problems. and once we have done that, we will provide our new UIFont.cs and UIFontInspector.cs to everyone for free!
Title: Re: Dynamic font support for NGUI
Post by: wsycarlos on January 07, 2013, 11:07:38 PM
Here is the pic!
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1153;image)

(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1155;image)

(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1157;image)

(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1159;image)

(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1161;image)

(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1163;image)

(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1165;image)

(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1167;image)
Title: Re: Dynamic font support for NGUI
Post by: Cripple on January 08, 2013, 01:55:43 AM
I would have bought this feature for 1000$




 ;D
Title: Re: Dynamic font support for NGUI
Post by: Nicki on January 08, 2013, 03:41:09 AM
(http://i.imgur.com/SD5D8.gif)
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 08, 2013, 07:29:30 AM
You're awesome!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!great work!!!!!!!!!!!!!!!!!
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 08, 2013, 07:31:10 AM
I have some can't wait for.....
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on January 08, 2013, 09:23:06 AM
So... all the dynamic font solutions (this is what, 3rd one in 2 days now? :)) are limited by the same clause -- that is the font must be in a separate texture and can't be using the atlas texture, right?
Title: Re: Dynamic font support for NGUI
Post by: zh4ox on January 08, 2013, 09:40:14 AM
So... all the dynamic font solutions (this is what, 3rd one in 2 days now? :)) are limited by the same clause -- that is the font must be in a separate texture and can't be using the atlas texture, right?
yep, it uses the dynamic font texture, the amount of texture is decided by how many fonts we use
Title: Re: Dynamic font support for NGUI
Post by: Ferazel on January 08, 2013, 12:27:20 PM
I'm really looking forward to testing this out. The only downside to dynamic fonts is the lack of concrete memory management of this font texture, but the nature of being able to put only the characters that we use in the texture at the specific time is really appealing.

Did you by chance get it to work with the UIPanel clipping as well?
Title: Re: Dynamic font support for NGUI
Post by: ryan on January 08, 2013, 12:29:46 PM
So... all the dynamic font solutions (this is what, 3rd one in 2 days now? :)) are limited by the same clause -- that is the font must be in a separate texture and can't be using the atlas texture, right?

For what it's worth, that doesn't bother me at all.  We have some atlases that are big enough already that trying to squeeze a font into it, even a dynamic one, would be tricky.  I split our font out into its own atlas long ago in anticipation of something like this feature for when we localize.  Limiting draw calls is all well and good, but getting hung up on the whole single draw call thing and passing over this feature because it doesn't achieve that would be a mistake.  (Not that you've said you're passing on it.)
Title: Re: Dynamic font support for NGUI
Post by: wsycarlos on January 08, 2013, 01:13:15 PM
This is made by zh4ox above ::). And now he is dealing with different size of same font.
Let's wait for his final version.
And BTW, Aren,
So... all the dynamic font solutions (this is what, 3rd one in 2 days now? :)) are limited by the same clause -- that is the font must be in a separate texture and can't be using the atlas texture, right?
Unity create the font texture dynamically according to the list of chars u used with this font, so is that possible to add a texture dynamically into an atlas(as i remember, it's quite difficult), and then change it every time when u use a new char(like the chat window, who knows every players?)?
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 08, 2013, 01:19:14 PM
Regarding memory management, the beauty of it is that the texture tends to use only the characters that are in use at a given moment. That is, suppose you have a font texture that holds a lot of 72px characters because you are showing a splashscreen GUI, for instance, next when you move on to another screen, like for instance an inventory menu, if you start using smaller characters of the same font, say 16px for titles and 12px for subtitles, whenever the texture is full it will be rebuilt, but without the 72px characters since they are nolonger in use on screen.

I've got my own integration mostly working and I am happy to share it too for free. At first I considered putting a price on it, but I'm happy to share it freely as every one seems excited about this. As long as I don't have to answer zillions of questions about it, I'm happy to share.

Eventually, ArenMook, I really think you should get down to integrating this in NGUI. It's not a lot of code, and what worries me about my own solution or any solution I could pick up on this forum is maintainance --> since I basically modified some of your source code, everytime you submit an update in assetstore, it's still going to be a bit clumsy to apply my patch on top of it.
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 08, 2013, 01:22:22 PM
Btw, WSYCARLOS, since you guys are working on this too, if you are interested to take a look at my shot at it, feel free to ask. As far as I could test, I have everything working properly (some code cleaning would help, but featurewise it's functional). That is, multiple fonts, support for font styles, multiple font sizes, colors, font refresh when the font texture can't hold all the characters, etc...
Title: Re: Dynamic font support for NGUI
Post by: BeShifty on January 08, 2013, 01:43:31 PM
If you can set the font size at runtime, could we add a size encoding 'tag' like the color one [FFFFFF]? Maybe [size=18]? Unfortunately the encoding would have to move towards an HTML style This is colored[size=18]This is colored and size 18[-color]This is size 18[-size]
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 08, 2013, 02:22:52 PM
Mmm, that's more work, actually, if you want to mix font sizes in the same UILabel --> additional code changes to recompute all things related to text alignment, etc... Not trivial
Title: Re: Dynamic font support for NGUI
Post by: zh4ox on January 08, 2013, 09:49:05 PM
Unisip, u are awesome, I stiil have much work to do
Title: Re: Dynamic font support for NGUI
Post by: wsycarlos on January 08, 2013, 09:55:01 PM
Hi Unisip,
I have a question, if your font is used in multiple situation, such as GUIText, 3D Text and NGUI's UIFont, how could that be possible to get every string that used with that font, is there any API about this? Otherwise, if you create a GUIText, and enter something, and the texture is like 256*256, and full of chars, and then now u create a 3D Text contains different chars, so the font texture will rebuilt as you request many new characters. And now, the font didn't know the old GUIText right? So it rebuilt the texture without old characters? And the old GUIText get the callback, and request his chars again, makes the font texture rebuilt again... how to solve this? Or any things I mentioned is wrong? Am I considered too much?
Title: Re: Dynamic font support for NGUI
Post by: wuming0108 on January 08, 2013, 11:13:07 PM
awesome!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!great work!!!!!!!!!!!!!!!!!
Title: Re: Dynamic font support for NGUI
Post by: realblues on January 08, 2013, 11:48:04 PM
reallllly Great!!
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 09, 2013, 03:38:12 AM
The Unity APIs do all the work for you.
Basically, there is a delegate that alerts you when the font texture has to be rebuilt from scratch (that is, when there is no more room for a new character). All you need to do is make sure that all your assets using the font get notified so they can take action.
In the case of UILabels, when a font texture is rebuilt, call 'MarkAsChanged' on every UILabel that uses the font does the job.

Again, for anyone programmer who wants to play around with that code, I'm happy to share it "as is".
Title: Re: Dynamic font support for NGUI
Post by: zh4ox on January 09, 2013, 06:15:41 AM
the work slows down because of multiple font sizes in one font texture --- it's very hard to place the text correctly,  but finally it solved, though I don't think myself's solution is perfect :( (u must first set the TTF's font size to ONE), btw, anyone have a better way to solve the problem?
Here is the pic, all text with different sizes (16, 24, 30, 36, 100) are got from the same one dynamic font texture, and their offsetX, offsetY is approximatively correct, all inside the box.
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1171;image)
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1174;image)
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1175;image)
Title: Re: Dynamic font support for NGUI
Post by: sk8er123 on January 09, 2013, 10:42:17 AM
how download source code ???????????
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 09, 2013, 12:11:35 PM
@zh4ox
Mmm, I'm not sure I am following you on this one. Why would you have to change any settings in the font asset, like the size? In my implementation, I never had to worry about this, neither did I have to bother much about text placement, it's all handled by the CharacterInfo class in Unity.
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 09, 2013, 08:52:49 PM
all size font in single texture?
Title: Re: Dynamic font support for NGUI
Post by: zh4ox on January 09, 2013, 10:02:09 PM
@sk8er123
Please take patience, when the work is done, I'll upload the code.
@jarjin
Yes, all size font in single texture, because I want the draw call as few as possible
@Unisip
I've ever try not change the size setting in the font asset, but failed. May I know how u calculate the v0.y to make all text inside the box?  e.g. the font asset's name is YouYuan, with size 16, the characterInfo.vert.y of 国 with size 16 is correct, it's -0.125f, so just set v0.y=(y - 0.125f)*scale.y is OK, but the characterInfo.vert.y of 国 with size 64 is 35.88f, and then what's the correct v0.y?
Title: Re: Dynamic font support for NGUI
Post by: wsycarlos on January 09, 2013, 10:33:10 PM
Regarding memory management, the beauty of it is that the texture tends to use only the characters that are in use at a given moment. That is, suppose you have a font texture that holds a lot of 72px characters because you are showing a splashscreen GUI, for instance, next when you move on to another screen, like for instance an inventory menu, if you start using smaller characters of the same font, say 16px for titles and 12px for subtitles, whenever the texture is full it will be rebuilt, but without the 72px characters since they are nolonger in use on screen.

I've got my own integration mostly working and I am happy to share it too for free. At first I considered putting a price on it, but I'm happy to share it freely as every one seems excited about this. As long as I don't have to answer zillions of questions about it, I'm happy to share.

Eventually, ArenMook, I really think you should get down to integrating this in NGUI. It's not a lot of code, and what worries me about my own solution or any solution I could pick up on this forum is maintainance --> since I basically modified some of your source code, everytime you submit an update in assetstore, it's still going to be a bit clumsy to apply my patch on top of it.

BTW, Unisip, thank you for your answer,but you didn't get my point.
You mentioned about "whenever the texture is full it will be rebuilt, but without the 72px characters since they are no longer in use on screen", but zh4ox have tested that, the texture will rebuild when it is full, but Unity won't remove unused characters from the texture, and I didn't find any API about this. What did you do to remove old characters?
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 09, 2013, 11:25:00 PM
@zh4ox @wsycarlos Thank you for your work. If you can remove unused characters from the texture, The perfect solution!!~~~
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 10, 2013, 03:04:31 AM
Hi all,

With permission from ArenMook, I'm releasing this code that adds support for Unity 4 dynamic fonts in NGUI.
This code is provided "as is", it hasn't been fully tested on all platforms, and there might be bugs. Feel free to modify it as needed, and to integrate it in your own products, as long as you have an NGUI source licence.

Please look at the readme file for help.

@wsicarlos: what I found in my tests was the following:
- when you add new chars to the font texture, if the texture has to be rebuilt (to change its size), it will only be rebuilt with those new chars. All older chars are removed, and the texturerebuilt callbacks are invoked. On callback, you can have other gameobjects displaying text (UILabels, but also text meshes if needed) request their characters to be added to the font texture again. Any object that doesn't request its characters again takes the risk of not finding them in the texture anymore. Anyway, see my code for it, a diff with the original NGUI version will point you to the changes I made.

@zh4ox: you can see in my code how height is handled. The multiline text is displayed properly. The only thing that is not working well in my code yet is the pivot vertical alignment. I'm not sure where the problem is, but I'll try to figure it out too when I have more time (busy finishing another project right now).

Any feedback appreciated...
Title: Re: Dynamic font support for NGUI
Post by: zh4ox on January 10, 2013, 03:48:04 AM
Quote
@Unisip
I've ever try not change the size setting in the font asset, but failed. May I know how u calculate the v0.y to make all text inside the box?  e.g. the font asset's name is YouYuan, with size 16, the characterInfo.vert.y of 国 with size 16 is correct, it's -0.125f, so just set v0.y=(y - 0.125f)*scale.y is OK, but the characterInfo.vert.y of 国 with size 64 is 35.88f, and then what's the correct v0.y?
Nice job, man. I've read your code and test it. But the problem what I have mentioned seems not solved. Here is ur program's result -- all the text is above the top corner.
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1191)
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1193)
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1195)
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 10, 2013, 03:58:20 AM
Thank you ever so much!!!!!!!!!!!!!!!!!!!!!!
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 10, 2013, 04:07:59 AM
yeah there's this weird thing with vertical offsets. Frankly I haven't bothered too much about it since I was testing with smaller fonts like 12 to 18px, but I agree that this is problematic.
I'll try to have another look at this issue too. It seems we don't fully understand the values that the CharacterInfo class gives us for positioning fonts. In fact it might make sens to try to figure that out even outside of the NGUI context
Title: Re: Dynamic font support for NGUI
Post by: zh4ox on January 10, 2013, 04:18:00 AM
yeah there's this weird thing with vertical offsets. Frankly I haven't bothered too much about it since I was testing with smaller fonts like 12 to 18px, but I agree that this is problematic.
I'll try to have another look at this issue too. It seems we don't fully understand the values that the CharacterInfo class gives us for positioning fonts. In fact it might make sens to try to figure that out even outside of the NGUI context
I've searched the Unity's forum, no answer to it, After many times experiment, I found that when set the font asset's size to ONE, a magic solution come out.
  1.                                         float m = 0.8203215f;
  2.                                         float n = 1.0f - m;
  3.                                         float offsetY = (int)(m * dynamicFontSize) + n;
  4.  
  5.                                         v0.x = scale.x * (charInfo.vert.x + x);
  6.                                         v0.y = scale.y * (y + charInfo.vert.y - offsetY);
  7.  
  8.                                         v1.x = v0.x + scale.x * charInfo.vert.width;
  9.                                         v1.y = v0.y + scale.y * charInfo.vert.height;
  10.  
  11.                                         u0.x = charInfo.uv.xMin;
  12.                                         u0.y = charInfo.uv.yMax;
  13.  
  14.                                         u1.x = charInfo.uv.xMax;
  15.                                         u1.y = charInfo.uv.yMin;
  16.  
  17.                                         x += mSpacingX + (int)charInfo.width;
  18.  
  19.                                         for (int b = 0; b < 4; ++b)
  20.                                                 cols.Add(color);
  21.  
  22.                                         verts.Add(new Vector3(v1.x, v0.y));
  23.                                         verts.Add(new Vector3(v1.x, v1.y));
  24.                                         verts.Add(new Vector3(v0.x, v1.y));
  25.                                         verts.Add(new Vector3(v0.x, v0.y));
  26.  
  27.                                         if (charInfo.flipped)
  28.                                         {
  29.                                                 uvs.Add(new Vector2(u1.x, u0.y));
  30.                                                 uvs.Add(new Vector2(u0.x, u0.y));
  31.                                                 uvs.Add(new Vector2(u0.x, u1.y));
  32.                                                 uvs.Add(new Vector2(u1.x, u1.y));
  33.                                         }
  34.                                         else
  35.                                         {
  36.                                                 uvs.Add(new Vector2(u1.x, u0.y));
  37.                                                 uvs.Add(new Vector2(u1.x, u1.y));
  38.                                                 uvs.Add(new Vector2(u0.x, u1.y));
  39.                                                 uvs.Add(new Vector2(u0.x, u0.y));
  40.                                         }
set the font asset's size to 1, and add the offset to vert.y calculation, then it fits all font sizes, here is my program's result
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 10, 2013, 04:45:43 AM
Cool, I'll try this out too!
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 10, 2013, 05:23:27 AM
@Unisip Can I reset Font Texture to empty??????????????? how ?
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 10, 2013, 06:41:31 AM
Why would you want to do that?
As far as I can tell, you can't. Unity manages the font and clears it up only when needed.
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 10, 2013, 09:17:10 AM
@zh4ox, it sort of works, but I'm not really into magic numbers. I'd rather have an explanation of how that Y value is supposed to work. I guess I'll post on the Unity forums to see if someone figured it out
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 10, 2013, 10:07:09 AM
Ok I *think* I might have something that makes more sense.
No more magic number, it relies on the font import size (which unfortunately can't be accessed from code, it seems, so I set the value to a constant 16, since when you import a font, its size is set to 16.
zh4ox, can you test this and tell me what you think?
Title: Re: Dynamic font support for NGUI
Post by: zh4ox on January 10, 2013, 10:18:21 PM
Ok I *think* I might have something that makes more sense.
No more magic number, it relies on the font import size (which unfortunately can't be accessed from code, it seems, so I set the value to a constant 16, since when you import a font, its size is set to 16.
zh4ox, can you test this and tell me what you think?
it still works not perfectily, I use YouYuan font, size 16 and test UILabel with char size 16, 64. Here is the result.
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1208)
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1210)
All the text is above the baseline, btw, 0.8203215f is not real magic number, it' seems the baseline of font size 1, and I have modified ur code, as u wish, now there r no limitation on font asset's size. Here is my result
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1212)
(http://www.tasharen.com/forum/index.php?action=dlattach;topic=2707.0;attach=1214)
U can test the modification on your machine
Title: Re: Dynamic font support for NGUI
Post by: wsycarlos on January 10, 2013, 11:04:15 PM
@wsicarlos: what I found in my tests was the following:
- when you add new chars to the font texture, if the texture has to be rebuilt (to change its size), it will only be rebuilt with those new chars. All older chars are removed, and the texturerebuilt callbacks are invoked. On callback, you can have other gameobjects displaying text (UILabels, but also text meshes if needed) request their characters to be added to the font texture again. Any object that doesn't request its characters again takes the risk of not finding them in the texture anymore. Anyway, see my code for it, a diff with the original NGUI version will point you to the changes I made.

@Unisip
Thank you for your answer, your test is correct, but that's why i think is a problem.
The first time you mentioned about removing the unused chars, i am very confused about that, and considered that might be a problem.
After last night's testing, i finally solve this problem and now shows to everyone. You can check my test scene to see what happened when the unity rebuild the texture when it is full.
You didn't get this problem because you request the new chars at the same time when you get the callback, and unity collect all the request in this circle, and rebuilt the texture.

Anyone want to fully understand how the dynamic font works can use my test demo, and btw, unity's documentation is quite "easy" to understand with just few things on it!

And anyone want to use dynamic font in your own code should request the new character info just at the moment when you get the callback.
Title: Re: Dynamic font support for NGUI
Post by: zhangjiq1983 on January 11, 2013, 01:48:50 AM
Very useful. Thank you.
Title: Re: Dynamic font support for NGUI
Post by: anangigi on January 11, 2013, 03:05:25 AM
very nice ,thanx
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 11, 2013, 08:45:59 AM
@wsycarlos can i remove unuse character now?
Title: Re: Dynamic font support for NGUI
Post by: Unisip on January 11, 2013, 10:49:10 AM
The unity dynamic font API doesn't let you remove unused characters, as far as i can tell. But it's not clear to me why you would want to do that clean up work anyway, is it for video memory usage reasons?
Title: Re: Dynamic font support for NGUI
Post by: Ferazel on January 11, 2013, 05:45:50 PM
I just want to say nice work everyone. I spent a lot of time today just grinding through the UIFont class myself to see if I could figure out what the problem was in regards to the original vertical spacing and why there was such a discrepancy especially as the font got larger.

The best I could gauge was that it seemed to work if you approximated the .ttf asset import size to be in POINT and the UIFontInspector size to be in the asset's PIXEL value (24pt-30px, 30pt-40px) for example. This would place the text MUCH better in the vertical bounding area of the widget. However, I found out there is still a problem with letters that go below the baseline such as a q, y, or p interfering with the next line's characters.

I spent way too much time, but I ended up just adding a 10px Y spacing to the UIFont and it appears to work better. However, wow, what a pain in the butt. I really hope that we can maybe figure out an elegant solution to handle these types of below baseline characters.
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 11, 2013, 09:10:59 PM
@Unisip yes!! Thank you for your answer. I want to reduce video memory usage.
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 11, 2013, 09:15:22 PM
@Unisip Chinese character can lead to memory usage is very large. Continuously increase.
Title: Re: Dynamic font support for NGUI
Post by: Ferazel on January 11, 2013, 10:38:51 PM
Jarjin
In doing some tests today it seems that the character atlas will continue to grow until it can fit all the characters that it needs to. The dynamic font system will then start reusing areas of glyphs that are no longer needed for new glyphs. However, there is no way to "cap" the texture area. The good news though is that the dynamic texture is only a 8-bit alpha channel texture meaning that the textures are 1/2 the size of a 16-bit color bitmapped font of the same size. Unless you're displaying every character at once it should have better RAM usage than a bitmapped font atlas by a good margin.
Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 11, 2013, 11:33:59 PM
@Ferazel Thank you very much for your test, I think it is good. And that is enough. I had hoped that when each time the user entering the game before, be able to rebuild font texture, such memory usage is also will be more smaller.
Title: Re: Dynamic font support for NGUI
Post by: PoN on January 13, 2013, 10:27:47 PM
I would like to test this plugin, where can i get plugin?or buy. thx
Title: Re: Dynamic font support for NGUI
Post by: liuyi on January 14, 2013, 02:19:10 AM
Thanks, guys.
This is a amazing plug.  You saved my life!!!!
Title: Re: Dynamic font support for NGUI
Post by: blueskined on January 14, 2013, 10:57:15 AM
this is something I have been looking for for 1 year! Thanks man!
Title: Re: Dynamic font support for NGUI
Post by: PoN on January 14, 2013, 10:55:20 PM
UP UP UP
Title: Re: Dynamic font support for NGUI
Post by: ink on January 15, 2013, 09:56:31 AM
Hi,

first, thanks A LOT for this code, it really works well and saves me a lot of trouble. I discovered an issue, maybe I just don't have the newest sources downloaded (maybe create a pinned thread for it with the newest sources like the nGUI version thread?).

When saving and reloading the scene, the font is always set back to font type "normal". This is caused due to mFont.dynamicFont inside UIFontInspector.OnInspectorGUI being null after loading the project. I fixed it by inserting the last line of this code:

  1.            
  2. if (changed)
  3. {
  4.   //force access to material property as it refreshes the texture assignment
  5.   Debug.Log("font changed...");
  6.   Material fontMat = mFont.material;
  7.   if (fontMat.mainTexture == null)
  8.     Debug.Log("font material texture issue...");
  9.   UIFont.OnFontRebuilt(mFont);
  10.   EditorUtility.SetDirty(mFont); //make sure the object is saved
  11. }
  12.  

Did I miss something? It seems to fix the problem, but maybe, it causes new ones?
Title: Re: Dynamic font support for NGUI
Post by: mavriel on January 16, 2013, 02:49:38 AM
Shader Name need space.

Unlit/Transparent Colored (DynamicFont)(SoftClip)     --> Unlit/Transparent Colored (DynamicFont) (SoftClip)
Unlit/Transparent Colored (DynamicFont)(HardClip)    --> Unlit/Transparent Colored (DynamicFont) (HardClip)
Unlit/Transparent Colored (DynamicFont)(AlphaClip)   --> Unlit/Transparent Colored (DynamicFont) (AlphaClip)
Title: Re: Dynamic font support for NGUI
Post by: xiaohaozi on January 17, 2013, 10:11:16 AM
Unisip, u are awesome, I stiil have much work to do

You're awesome^_^

Recently I was also working on Dynamic font support for NGUI.I used a similar mothed just as you offered. A problem puzzled me.You know,I just used the Panel Clipping(Soft Clip) to make a Scrool List.But it did not work normally,I mean the clipping bounder could not clip the Lables.I have tried some shaders,including the Shaders you offered  (specified shaders for dynamic font such as "Unlit - Transparent Colored (DynamicFont)"....).

Then I used the  "Unlit - Transparent Colored (Packed)" shader offered in Ngui's new edition and It really worked.Unfortunately,The color of Lables chaged and became another color that was similar to the original color.

Have you ever encountered such problem.Please give me some help,3Q O(∩_∩)O~

 
Title: Re: Dynamic font support for NGUI
Post by: xiaohaozi on January 17, 2013, 10:31:37 AM
Shader Name need space.

Unlit/Transparent Colored (DynamicFont)(SoftClip)     --> Unlit/Transparent Colored (DynamicFont) (SoftClip)
Unlit/Transparent Colored (DynamicFont)(HardClip)    --> Unlit/Transparent Colored (DynamicFont) (HardClip)
Unlit/Transparent Colored (DynamicFont)(AlphaClip)   --> Unlit/Transparent Colored (DynamicFont) (AlphaClip)

thanks for ink‘s help, I know the solution of my problem mentioned before.

New problem!!!!The Character became thin.It indeedly became thin.(It seems the all the shaders for dynamic font will make the printed character thin)
Please help me!Any help will be appreciated^_^

Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 18, 2013, 11:03:53 AM
thanks for ink‘s help, I know the solution of my problem mentioned before.

New problem!!!!The Character became thin.It indeedly became thin.(It seems the all the shaders for dynamic font will make the printed character thin)
Please help me!Any help will be appreciated^_^



I also meet the same problem, can you tell me how to solve? Thank you very much!!!!!
Title: Re: Dynamic font support for NGUI
Post by: N3uRo on January 20, 2013, 02:01:51 PM
Really good work!!

Can you pin it to the first post (and keep updated) of this thread? It's really hard to find the latest version.

Thanks!!
Title: Re: Dynamic font support for NGUI
Post by: PoN on January 21, 2013, 02:35:47 AM
You're awesome^_^

Recently I was also working on Dynamic font support for NGUI.I used a similar mothed just as you offered. A problem puzzled me.You know,I just used the Panel Clipping(Soft Clip) to make a Scrool List.But it did not work normally,I mean the clipping bounder could not clip the Lables.I have tried some shaders,including the Shaders you offered  (specified shaders for dynamic font such as "Unlit - Transparent Colored (DynamicFont)"....).

Then I used the  "Unlit - Transparent Colored (Packed)" shader offered in Ngui's new edition and It really worked.Unfortunately,The color of Lables chaged and became another color that was similar to the original color.

Have you ever encountered such problem.Please give me some help,3Q O(∩_∩)O~

+1
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on January 21, 2013, 10:44:14 AM
Correct me if I'm wrong, but this would help for Scaling Fonts without pixelating them?
Title: Re: Dynamic font support for NGUI
Post by: mavriel on January 21, 2013, 11:28:28 PM
thanks for ink‘s help, I know the solution of my problem mentioned before.

New problem!!!!The Character became thin.It indeedly became thin.(It seems the all the shaders for dynamic font will make the printed character thin)
Please help me!Any help will be appreciated^_^

I think shade code has some problem.
If use this shader, font's edge is black.
In dark background, text is thin. In light background, text seems strange.


I fix it as follows. But i don't know this is right.


tex2D(_MainTex, IN.texcoord).a * IN.color;
-->
half4 col = IN.color;
col.a *= tex2D(_MainTex, IN.texcoord).a;


Title: Re: Dynamic font support for NGUI
Post by: jarjin on January 23, 2013, 07:09:21 AM
For Chinese character no effect, still thin.
Title: Re: Dynamic font support for NGUI
Post by: schuberbia on January 25, 2013, 03:28:51 PM
Here's an evil question, anyone have any idea if we can get kerning with this dynamic font solution?
Title: Re: Dynamic font support for NGUI
Post by: PoN on January 28, 2013, 02:20:48 AM
after update NGUI to 2.3.1 ,working not properly.
Title: Re: Dynamic font support for NGUI
Post by: fantast_xu on January 28, 2013, 10:26:29 PM
Yeap, after updated to 2.3.1, there are some compile error when I import DynamicFont.unitypackage
Title: Re: Dynamic font support for NGUI
Post by: realblues on January 28, 2013, 10:36:31 PM
Yeap, after updated to 2.3.1, there are some compile error when I import DynamicFont.unitypackage
Is the Package Released?
Title: Re: Dynamic font support for NGUI
Post by: fantast_xu on January 28, 2013, 10:43:01 PM
You can download from this thread. Second page by unisip  8)
Title: Re: Dynamic font support for NGUI
Post by: Hidden on January 29, 2013, 10:43:24 AM
Could this also be used to generate non dynamic fonts directly in unity? Save out the font texture to use as a sprite and the kerning info so it can be put into the Atlas like a normal font out of BMFont?

The font textures seem crisp (better than the results I've had with BMFont) and it would be great to be able to do it all within unity and only use 1 atlas.
Title: Re: Dynamic font support for NGUI
Post by: Kichang Kim on January 29, 2013, 07:48:21 PM
Is this patch support NGUI 2.3.1 ? It seems to does not work in 2.3.1.
Title: Re: Dynamic font support for NGUI
Post by: lingying on January 30, 2013, 09:55:19 PM
Thanks author very much!
And I modify the source files for NGUI 2.3.1.
Just try it
Title: Re: Dynamic font support for NGUI
Post by: minevr on January 31, 2013, 04:42:42 AM
你好,lingying,欢迎加入UnityQQ群:2453819
Title: Re: Dynamic font support for NGUI
Post by: fgame on February 01, 2013, 03:07:02 AM
Assets/NGUI/Scripts/UI/UIFont.cs(28,30): error CS1061: Type `UnityEngine.Font' does not contain a definition for `textureRebuildCallback' and no extension method `textureRebuildCallback' of type `UnityEngine.Font' could be found (are you missing a using directive or an assembly reference?)

"Assets/NGUI/Scripts/UI/UIFont.cs(499,13): error CS0246: The type or namespace name `CharacterInfo' could not be found. Are you missing a using directive or an assembly reference?"



有错误哇, 我用的是 Unity3.5.5

Got Error!! I am using Unity3.5.5
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 01, 2013, 04:05:26 AM
fgame: use unity 4.0.1.
Title: Re: Dynamic font support for NGUI
Post by: iamslash on February 05, 2013, 01:07:58 AM
I made somehing using ngui dynamic font patch.
I could find out that it worked well on SAMSUNG galaxy S3.
But In case of LG optimus LTE it didn't work well.
It was rendered half on LG optimus LTE.

So I made some code using dynamic font without NGUI.
It worked well on LG optimus LTE.
But It didn't worked well with UILabel of NGUI.
In case of SKY Vega racer it didn't worked well like LG optimus LTE.
I found out that the cpus of those devices are made by qualcomm.

Qualcomm Snapdragon S4 Plus MSM8960
Qualcomm MSM8260

They all use adreno GPU.
It seems that NGUI dynamic font is not rendered well on the mobile device which has adreno GPU.

How can I start to modify the code ?
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 05, 2013, 04:52:19 AM
Adreno also had problems with Hard Clipping - it just crashed on that. Maybe, the dynamic text is using something similar as the hard clip shader did? If I recall it was the Clip function.
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 05, 2013, 08:17:18 AM
I just want to verify; none of you guys can do clipping with the dynamic fonts right? I'm trying to make a shader to handle it, but I'm a complete nub in shaders. :S
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 06, 2013, 05:24:18 AM
After hacking at it most of yesterday I got some shaders that cover dynamic fonts with alpha clipping and without clipping. I think maybe Unisip made something similar or even identical earlier in the thread, but I didn't see it until now and banged my head against these shaders for a while.

Anyways, here take take.
Title: Re: Dynamic font support for NGUI
Post by: adam718 on February 13, 2013, 10:00:45 PM
Wow, Great WORK!!!
I will also test it in several cases, and will contribute as possible as I can.

Otherwise, I hope Aren consider this feature as NGUI is widely used in many countries.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on February 15, 2013, 09:55:24 AM
I'm having this issue now:

Assets/NGUI/Scripts/UI/UIFont.cs(921,64): error CS1501: No overload for method `ParseSymbol' takes `3' arguments

I just update NGUI to version 2.3.3b and Unity v 4.0.0f7 and applied the Dynamic Font package.

Anyone knows?
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 15, 2013, 12:24:42 PM
Probably just something in the newest version of NGUI breaks it. I'll take a look on monday, since I'm using it in a new project as well.

I would have been nice if it was built in to NGUI by default..hint hint nudge nudge.  8)
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on February 15, 2013, 12:28:29 PM
I would have been nice if it was built in to NGUI by default..hint hint nudge nudge.  8)
Yeahh, this should be into NGUI!

Thanks Nicki!
I would really appreciate the help.

Regards,
Emilio
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 18, 2013, 04:22:58 PM
I did take a look and got it sorta integrated, but it's offsetting the text right now, so I have to mess with it some more.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on February 18, 2013, 05:20:00 PM
Wow, thanks Nicki!
Waiting for your solution.

PS: I checked out your Subway Surfers game and I've already spend hours playing it, great work!
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 19, 2013, 04:00:42 AM
So this was made for 2.3.3f and we've since moved to 2.3.3h, but I don't think anything has changed in fonts since then. In any case, these files work properly.

ArenMook, if I were to clean it up a little and made a pull request, would you consider letting it into the mainline?
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on February 19, 2013, 08:55:05 AM
Thanks a lot Nicki!
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on February 19, 2013, 09:10:45 AM
@Nicki: You have Pro, so you can submit pull requests at your leisure. But yeah, make sure it's all proper-ish  :)
Title: Re: Dynamic font support for NGUI
Post by: adam718 on February 21, 2013, 02:39:47 AM
So this was made for 2.3.3f and we've since moved to 2.3.3h, but I don't think anything has changed in fonts since then. In any case, these files work properly.

ArenMook, if I were to clean it up a little and made a pull request, would you consider letting it into the mainline?

Hi Thank you.
I replaced UIFont.cs and other 3 files.
I tested it in Chat Window. but when I was typing chinese or korean, text was not displayed immediately, only shown after the character is completed.
And this problem happens when I use BMFont and TTF(dynamic font) (it works well in NGUI ordinary version)

ngui 2.3.3,
unity 4.0.1.

dynamic font function is not suitable for typing?

Thank you.
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 21, 2013, 03:29:59 AM
Ooh, if I remember correctly, the sign in Chinese is put together pressing multiple characters in a row right? It MAY be that it only writes a character to the texture once it's completely finished. In the regular bitmap version, it changes between characters on the way to the final one.
Title: Re: Dynamic font support for NGUI
Post by: XeNoTimE on February 21, 2013, 05:18:45 AM
You're awesome^_^

Recently I was also working on Dynamic font support for NGUI.I used a similar mothed just as you offered. A problem puzzled me.You know,I just used the Panel Clipping(Soft Clip) to make a Scrool List.But it did not work normally,I mean the clipping bounder could not clip the Lables.I have tried some shaders,including the Shaders you offered  (specified shaders for dynamic font such as "Unlit - Transparent Colored (DynamicFont)"....).

Then I used the  "Unlit - Transparent Colored (Packed)" shader offered in Ngui's new edition and It really worked.Unfortunately,The color of Lables chaged and became another color that was similar to the original color.

Have you ever encountered such problem.Please give me some help,3Q O(∩_∩)O~

+1. I have the same problem (Soft clipped panel with UIGrid and UILabel elements). Whichever shader I use from Unlit - Transparent Colored (DynamicFont) serie, I have either a clipping problem or simply the text not shown. The others UILabel work good. I'm using NGUI 2.3.3 with the last modified UIFont, UIFontInspector and associated shaders.
Any ideas on how to correct this problem ?
Thanks in advance.
Title: Re: Dynamic font support for NGUI
Post by: wr01r on February 22, 2013, 07:42:07 AM
Hello.
I found this problem.

UIFont.RegisterFont(UIFont font) was not call from anywhere in the UIFont.cs at February 19.
So I can see "character not found in font" message on rebuild the Texture.
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 22, 2013, 10:04:48 AM
Hmm, I've seen that too, but it hasn't had any problems; all the characters are shown. Odd.
Title: Re: Dynamic font support for NGUI
Post by: fredxxx123 on February 22, 2013, 09:42:54 PM
Hmm, I've seen that too, but it hasn't had any problems; all the characters are shown. Odd.

I had problem for that, issued when dynamic font rebuild texture.
In previous version, 'RegisterFont' was called before 'RequestCharactersInTexture'.

  1.             //JUDIVA, include symbols in font
  2.             RegisterFont(this);
  3.             if (UseDynamicFont)
  4.                 dynamicFont.RequestCharactersInTexture(text, dynamicFontSize, dynamicFontStyle);
  5.  

Before add 'UIFont.RegisterFont(UIFont font)', that can't make 'UILabel' changed flag(content will be incorrect) when font rebuild in my case.
thanks you  ;)
Title: Re: Dynamic font support for NGUI
Post by: wr01r on February 24, 2013, 09:32:06 PM
I can see this problem when using UILabels 2 or more.
If texture rebuild by updating label.text, Other labels didn't call RequestCharactersInTexture().
Other labels collapsed.
Because didn't call textureRebuildCallback, and others label didn't call MarkAsChanged().
Title: Re: Dynamic font support for NGUI
Post by: XeNoTimE on February 25, 2013, 09:08:42 AM
I post a video link showing the problem so that everybody understands it.
http://youtu.be/2-kKQyFGzo8 (http://youtu.be/2-kKQyFGzo8)
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 25, 2013, 10:55:17 AM
Xeno: You need a soft clipping shader made for the dynamic font. I'll see if I can manufacture one. :)
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 26, 2013, 05:18:37 AM
This should work, although I'm not a shader expert, so please check my work and fix anything broken. ;)
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 26, 2013, 10:13:19 AM
I'm working on a pull request to push this into the mainline of NGUI, but it's tricky, because NGUI has to support unity 3.5 as well, so everything has to be done delicately. Hopefully, it will be included soontm. ;)
Title: Re: Dynamic font support for NGUI
Post by: XeNoTimE on February 26, 2013, 01:14:38 PM
Hi Nicki.
Thank you for your fast and efficient work !  :)
It works great on my list with soft clipping but not with standard unclipped UILabel which do not show.
So I think I must use for these labels another dynamic font with normal "Unlit - Transparent Colored (DynamicFont)" shader, if I am not mistaken.  ;)
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 26, 2013, 03:33:37 PM
You should be able to use the DynamicFontShader I provided higher up for that. You should always use that on your materials, then UIPanel will switch to the other ones when needed.
Title: Re: Dynamic font support for NGUI
Post by: Nicki on February 26, 2013, 03:34:34 PM
Do remember that since they use their own material, you have to move the Label forward on the Z position, or it will likely be hidden behind other widgets. I usually keep my labels at -1, while the rest is at 0.
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on February 26, 2013, 07:27:24 PM
I've received the pull request, Nicki -- and I will check it out soon-ish. Caught up in some things atm.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on February 27, 2013, 08:12:21 AM
Do remember that since they use their own material, you have to move the Label forward on the Z position, or it will likely be hidden behind other widgets. I usually keep my labels at -1, while the rest is at 0.

I usually have this issue.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on February 28, 2013, 08:29:54 AM
hey, I'm the only who see little black pixels around the font sometimes? Mainly when it's a small label.
I really want to use dynamic fonts in my project because I have to localize them into EFIS more Japanese and Korean, and it's going to be a lot of textures if I do it the old way (BmFont), but this issue how it looks I don't know how to fix it. Somebody knows?
Title: Re: Dynamic font support for NGUI
Post by: rockafnan on March 01, 2013, 05:58:40 AM
Hi, I've this odd issue coming... the font size set in font is 60 and if make the UIFont prefab with same size (60) is looks fine but If I set the font size in prefab to 30, it looks like in the attached screenshot.
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 01, 2013, 06:41:58 AM
You also have to set the font size on the ttf file.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 04, 2013, 03:17:53 PM
You also have to set the font size on the ttf file.
How is that Nicki? There is a difference between changing the font size on the Dynamic Font (prefab) against the Font itself?
I have my prefab on 100 size and I use the same prefab for smaller text, I just made it smaller. Should I create a new prefab with smaller size for that?

Thanks!
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 04, 2013, 05:13:43 PM
Yeah you should. Unity generates the bitmap texture from the size set directly on the font, while NGUI sets up the localscale based on the size set in the UIFont.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 04, 2013, 05:43:49 PM
Ok, thanks a lot!
Probably that's going to solve some issues I have.

 ;D
Title: Re: Dynamic font support for NGUI
Post by: deathguide on March 04, 2013, 10:41:16 PM
hello,
     
   when font texture rebuild, we have to update all labels.  Is there any solve else?

but how can I update labels disabled,  call MarkAsChanged() when OnEnable?

thanks!
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 05, 2013, 04:06:49 AM
If you update any label, it should update them all.
Title: Re: Dynamic font support for NGUI
Post by: fredxxx123 on March 05, 2013, 05:32:29 AM
hello,
     
   when font texture rebuild, we have to update all labels.  Is there any solve else?

but how can I update labels disabled,  call MarkAsChanged() when OnEnable?

thanks!

Hi, I had the same problem before.
It's my way to solve that.

  1. private static void OnFontRebuilt()
  2. {
  3.         UIRoot[] roots = GameObject.FindObjectsOfType(typeof(UIRoot)) as UIRoot[];
  4.  
  5.         foreach (var r in roots)
  6.         {
  7.             UILabel[] labels = r.GetComponentsInChildren<UILabel>(true);
  8.             foreach (UILabel label in labels)
  9.             {
  10.                 if (label.font != null)  // here you can check more to make this correct.
  11.                 { label.MarkAsChanged(); }
  12.             }
  13.             // just check
  14.             //Debug.LogWarning(string.Format("{0} has {1} UILabel.", r.name, ((labels != null && labels.Length > 0) ? (labels.Length) : (0))));
  15.         }
  16. }
  17.  

I hope it will be helpful to you  :)
Title: Re: Dynamic font support for NGUI
Post by: deathguide on March 05, 2013, 06:09:46 AM
Hi, I had the same problem before.
It's my way to solve that.

  1. private static void OnFontRebuilt()
  2. {
  3.         UIRoot[] roots = GameObject.FindObjectsOfType(typeof(UIRoot)) as UIRoot[];
  4.  
  5.         foreach (var r in roots)
  6.         {
  7.             UILabel[] labels = r.GetComponentsInChildren<UILabel>(true);
  8.             foreach (UILabel label in labels)
  9.             {
  10.                 if (label.font != null)  // here you can check more to make this correct.
  11.                 { label.MarkAsChanged(); }
  12.             }
  13.             // just check
  14.             //Debug.LogWarning(string.Format("{0} has {1} UILabel.", r.name, ((labels != null && labels.Length > 0) ? (labels.Length) : (0))));
  15.         }
  16. }
  17.  

I hope it will be helpful to you  :)


   Thanks for reply!      bellow is my resolution, modify UILabel, I think there should be a better resolution......
  1.         protected override void OnEnable()
  2.         {
  3.                 base.OnEnable();
  4.                 MarkAsChanged();
  5.         }
  6.  

Title: Re: Dynamic font support for NGUI
Post by: hexart on March 05, 2013, 07:08:30 PM
Can anyone pack a full dynamic font package for NGUI2.3.4 & Unity4.0.1?
Title: Re: Dynamic font support for NGUI
Post by: 148423658 on March 05, 2013, 08:37:40 PM
hwo to do this?
Title: Re: Dynamic font support for NGUI
Post by: pengyingh on March 06, 2013, 02:03:04 AM
It also acts in new version of NGUI after making some changes in UIFont and FontInspector class.Then new a material, set it 's shader to unlit/transparent(packed), link the new material to font prefeb, thus the dynamic font can be clipped by UIPanel, it 's awesome! Hopeing this feature could be joined in new version of NGUI.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 06, 2013, 07:35:31 AM
Can anyone pack a full dynamic font package for NGUI2.3.4 & Unity4.0.1?
+1 ;D
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 07, 2013, 09:18:49 AM
So this was made for 2.3.3f and we've since moved to 2.3.3h, but I don't think anything has changed in fonts since then. In any case, these files work properly.

ArenMook, if I were to clean it up a little and made a pull request, would you consider letting it into the mainline?
I just update to NGUI 2.3.4 with this Dynamic Font files and all the labels 'move up' like 50 pixels.

It's just me?
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 07, 2013, 09:43:00 AM
Hmm, I have 2.3.4 and it works fine for me. I'll make a package for it a little later and put here.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 07, 2013, 10:32:05 AM
Ok, thanks Nicki!
Anyway I remember saw this issue also in the early versions too.
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on March 09, 2013, 05:12:23 AM
This package's addition is one of two important modifications that will be hitting the Pro version of NGUI in a short while. I am very hesitant about both, so I will most likely keep them Pro-only for a few weeks until I make sure that there are no adverse side-effects (the other feature is the potential fix for the Z vs depth distinction, in case you're curious).
Title: Re: Dynamic font support for NGUI
Post by: hexart on March 09, 2013, 07:08:48 AM
Hmm, I have 2.3.4 and it works fine for me. I'll make a package for it a little later and put here.
How about prepared for NGUI 2.3.6?
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 09, 2013, 08:29:36 AM
This package's addition is one of two important modifications that will be hitting the Pro version of NGUI in a short while. I am very hesitant about both, so I will most likely keep them Pro-only for a few weeks until I make sure that there are no adverse side-effects (the other feature is the potential fix for the Z vs depth distinction, in case you're curious).
That sounds like a really good features and fixes. This are in the 2.3.6 Pro version?
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on March 09, 2013, 11:59:01 AM
No. 2.3.6 is out already. Those will be in a coming version
Title: Re: Dynamic font support for NGUI
Post by: jarjin on March 11, 2013, 09:20:06 PM
+1 ;D
2.3.6 Version
+1
Title: Re: Dynamic font support for NGUI
Post by: jarjin on March 13, 2013, 06:32:01 AM
Can anyone pack a full dynamic font package for NGUI2.3.6 & Unity4.0.1?
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 13, 2013, 06:43:32 AM
Sorry, I haven't had time to take a look at it yet. I hope to do it this week or at least this weekend.

Heart of the Swarm sorta took all my time. ;D
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 15, 2013, 09:48:00 AM
There's a way to add glow on a Dynamic Font?
Because in a texture font, you just add it to the texture, but here?
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 15, 2013, 10:24:33 AM
You would have to do it in the shader then.
Title: Re: Dynamic font support for NGUI
Post by: GaVaR on March 15, 2013, 09:49:20 PM
You would have to do it in the shader then.

you can use UILabel option Effect -> "outline" to add glow to your dynamic font
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 16, 2013, 07:40:21 AM
That's less of a glow and more of an.. outline. :)

If you want a proper glow in a photoshop sense, then it should have an alpha dropoff and that can't be done with the existing UILabel effects. You can add that in your own shader if you want it though.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 18, 2013, 07:34:26 AM
You can add that in your own shader if you want it though.
That should be the material I'm using for the Dynamic Font? or the the texture or material inside TTF?
Title: Re: Dynamic font support for NGUI
Post by: Nicki on March 18, 2013, 07:39:21 AM
The material you use for the dynamic font. It has a shader attached - you would have to mess with your own in there.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 18, 2013, 08:00:26 AM
Ok, thanks!
I'm going to tell to the technical artist.
Title: Re: Dynamic font support for NGUI
Post by: pahe on March 19, 2013, 06:32:06 AM
No. 2.3.6 is out already. Those will be in a coming version

Any estimation about when dynamic font will be in, Aren? We think about changing all uilabels to textmeshes for dynamic fonts, but hope that we could avoid it.
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on March 19, 2013, 07:19:07 AM
After GDC. I am crazy busy right now -- have two talks to prepare for among other things.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 19, 2013, 09:37:59 AM
I have some issues when using fonts on 3D cameras, sometimes when I add more assets they just disappear and if I move 1 of the labels on the Z-axis (ie: -45) appears all the labels again. Which could be the problem?
Title: Re: Dynamic font support for NGUI
Post by: GaVaR on March 20, 2013, 08:47:40 AM
I have some issues when using fonts on 3D cameras, sometimes when I add more assets they just disappear and if I move 1 of the labels on the Z-axis (ie: -45) appears all the labels again. Which could be the problem?

This appears because dynamic fonts use own material, so you need to adjust Z-axis as it's done with different atlases.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 20, 2013, 09:33:49 AM
This appears because dynamic fonts use own material, so you need to adjust Z-axis as it's done with different atlases.
And there's no fixes for this?
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 20, 2013, 03:52:03 PM
New version (2.5.0) and no Dynamic Font, that's a shame... anyways a lot of cool things.
Title: Re: Dynamic font support for NGUI
Post by: Ferazel on March 20, 2013, 07:02:31 PM
New version (2.5.0) and no Dynamic Font, that's a shame... anyways a lot of cool things.

It sounds like it is on the list for ArenMook to get implemented into NGUI after GDC. I'm really looking forward to this feature being officially integrated as well.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 21, 2013, 12:15:49 PM
It sounds like it is on the list for ArenMook to get implemented into NGUI after GDC. I'm really looking forward to this feature being officially integrated as well.


Yeah, I can wait.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on March 28, 2013, 12:52:41 PM
I just update (2.3.4) and the texts look corrupt.
The "funny" part it's looks good until I press play. What could be?

Title: Re: Dynamic font support for NGUI
Post by: GaVaR on March 30, 2013, 11:00:47 AM
And there's no fixes for this?

Currently you can do nothing instead of adjust Z-axis. This requires refactoring in NGUI drawing system, so that objects draw order will depend on Depth independently of Z-axis.
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on April 02, 2013, 05:26:50 PM
New update (2.5.0) and have and issue in UIFont.cs:

Assets/NGUI/Scripts/UI/UIFont.cs(584,113): error CS1061: Type `BMFont' does not contain a definition for `MatchSymbol' and no extension method `MatchSymbol' of type `BMFont' could be found (are you missing a using directive or an assembly reference?)

I tried to merge both scripts, but are really different.

Did someone do a new UIFont.cs version for 2.5.0?

Thanks in advance!
Title: Re: Dynamic font support for NGUI
Post by: Amitloaf on April 03, 2013, 10:31:34 AM
Another update (2.5.1) and still no dynamic fonts. Any ETA to when it would be officially ready?
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on April 03, 2013, 02:46:50 PM
Dynamic font support will be in 2.6.0. I was busy with GDC for the past 2 weeks.
Title: Re: Dynamic font support for NGUI
Post by: N3uRo on April 03, 2013, 03:29:43 PM
Dynamic font support will be in 2.6.0. I was busy with GDC for the past 2 weeks.

Great news!!

Thanks Aren!!
Title: Re: Dynamic font support for NGUI
Post by: adam718 on April 05, 2013, 02:26:17 AM
Great, Aren,
You're lifesaver for Asian developers.
Thank you,
And thank to Niki.
Title: Re: Dynamic font support for NGUI
Post by: Mudwiz on April 05, 2013, 03:24:58 AM
Maybe yoffset issue is outdated, but I couldn't find any comment that it is solved, so I hope this helps someone.
I use a function below to calculate yoffset.
It is related with the imported font size as Unisip mentioned before (see page 2 of this thread).
So I changed inspector code to get it from the user, designer in my case, as variable 'TTFSize', and added to vert's y value.
Lowercase y or g is still printed below the bottom line, but other letters are in the box.

   private float CalculateYOffset()
   {
      float yoffset = ((dynamicFontSize / (float)TTFSize) - 1.0f);
      int lineHeight = (charSize + mSpacingY);
      yoffset += lineHeight * (TTFSize / (float)dynamicFontSize);
      yoffset -= lineHeight;

      return yoffset;
   }


Hope 2.6.0 comes soon!
Title: Re: Dynamic font support for NGUI
Post by: jarjin on April 05, 2013, 05:07:42 AM
Great news!! thank goodness!!! thank ArenMook!!!!!!!!!!!!!
Title: Re: Dynamic font support for NGUI
Post by: DarkMagicCK on April 07, 2013, 07:23:49 AM
Dynamic font support will be in 2.6.0. I was busy with GDC for the past 2 weeks.

Great news! Thanks!  BTW when will it be released?
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on April 08, 2013, 09:33:59 AM
Great news! Thanks!  BTW when will it be released?
There's any ETA?
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on April 08, 2013, 02:10:37 PM
When I get a few hours of coding time to focus on it, pretty much.

Also, http://www.tasharen.com/forum/index.php?topic=3749.0
Title: Re: Dynamic font support for NGUI
Post by: Nicki on April 08, 2013, 02:21:40 PM
You heard it here folks, in just a few hours.

(http://i.imgur.com/qifo2n3.png)
Title: Re: Dynamic font support for NGUI
Post by: ArenMook on April 08, 2013, 02:24:22 PM
@Nicki:

(http://www.gather-network.com/downloads/gallery/fun%20pictures/5884915-faithhA-celebrity-pictures-homer-simpson-facepalm-copy.jpg)
Title: Re: Dynamic font support for NGUI
Post by: jeldrez on April 08, 2013, 02:25:30 PM


 :o
jajajjajajajjajaj
Title: Re: Dynamic font support for NGUI
Post by: Forest_San on January 05, 2014, 08:56:14 AM
.....!!