Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: maul on March 22, 2015, 06:17:18 AM

Title: Dynamic font + emoticon in NGUI 3?
Post by: maul on March 22, 2015, 06:17:18 AM
Hi guys, I'm trying to add Chinese localization to a project. The project uses an older, paid version of NGUI - around 3.5 I think but I'm not exactly sure. Since there are a lot of chinese characters, I'm trying to add them as a dynamic font. However the original font contains a lot of references to "emoticons" - gamepad button images, small replacement sprites, etc.

Is there a way to make these work with a dynamic font?
Title: Re: Dynamic font + emoticon in NGUI 3?
Post by: ArenMook on March 22, 2015, 08:27:32 AM
No, there isn't. NGUI does not support emoticons with dynamic fonts. Just bitmap fonts.
Title: Re: Dynamic font + emoticon in NGUI 3?
Post by: maul on March 22, 2015, 05:04:22 PM
Thanks. Is there any way to have similar functionality? Essentially: replace a part of the text with a sprite. Hell, I could probably replace the code with spaces and add a separate sprite renderer to a sub-object in the proper position, couldn't I?
Title: Re: Dynamic font + emoticon in NGUI 3?
Post by: ArenMook on March 23, 2015, 09:43:10 AM
There is no simple way of doing it unfortunately. You can use NGUIText.PrintApproximateCharacterPositions (or PrintExactCharacterPositions) to figure out where the sprite should be and reposition it yourself manually -- but it would be a hack.
Title: Re: Dynamic font + emoticon in NGUI 3?
Post by: maul on March 26, 2015, 07:58:22 AM
Thanks a lot for your suggestions. Afterall, I decided to just pack the chinese font in the atlas - it takes up a lot of space but I'm hoping I can get things done faster this way. I have a question related to this though, and I'm hoping you can help me: why does the font affect how these emoticon sprites are displayed? The size is very different (way larger) than with the English font, and it's also too large to fit into the text itself properly.

EDIT: never mind, solved it. NGUI is pretty darn cool.
Title: Re: Dynamic font + emoticon in NGUI 3?
Post by: Markov on August 26, 2015, 10:59:18 AM
Just got the same target. How did you solve the issue about big atlas size?