Author Topic: Dynamic font support for NGUI  (Read 127127 times)

jarjin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 28
    • View Profile
Re: Dynamic font support for NGUI
« Reply #45 on: January 11, 2013, 09:15:22 PM »
@Unisip Chinese character can lead to memory usage is very large. Continuously increase.

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: Dynamic font support for NGUI
« Reply #46 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.
« Last Edit: January 11, 2013, 10:42:05 PM by Ferazel »

jarjin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 28
    • View Profile
Re: Dynamic font support for NGUI
« Reply #47 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.

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: Dynamic font support for NGUI
« Reply #48 on: January 13, 2013, 10:27:47 PM »
I would like to test this plugin, where can i get plugin?or buy. thx
« Last Edit: January 14, 2013, 10:54:31 PM by PoN »
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

liuyi

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Dynamic font support for NGUI
« Reply #49 on: January 14, 2013, 02:19:10 AM »
Thanks, guys.
This is a amazing plug.  You saved my life!!!!

blueskined

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Dynamic font support for NGUI
« Reply #50 on: January 14, 2013, 10:57:15 AM »
this is something I have been looking for for 1 year! Thanks man!

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: Dynamic font support for NGUI
« Reply #51 on: January 14, 2013, 10:55:20 PM »
UP UP UP
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

ink

  • Guest
Re: Dynamic font support for NGUI
« Reply #52 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?
« Last Edit: January 15, 2013, 10:05:47 AM by ink »

mavriel

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Dynamic font support for NGUI
« Reply #53 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)

xiaohaozi

  • Guest
Re: Dynamic font support for NGUI
« Reply #54 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~

 

xiaohaozi

  • Guest
Re: Dynamic font support for NGUI
« Reply #55 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^_^


jarjin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 28
    • View Profile
Re: Dynamic font support for NGUI
« Reply #56 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!!!!!

N3uRo

  • Guest
Re: Dynamic font support for NGUI
« Reply #57 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!!

PoN

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 111
    • View Profile
Re: Dynamic font support for NGUI
« Reply #58 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
Worked on Doc&DogAge Of Fury 3D. Actually working on WarMach.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Dynamic font support for NGUI
« Reply #59 on: January 21, 2013, 10:44:14 AM »
Correct me if I'm wrong, but this would help for Scaling Fonts without pixelating them?
« Last Edit: January 21, 2013, 01:30:30 PM by jeldrez »