Author Topic: Dynamic font + emoticon in NGUI 3?  (Read 7944 times)

maul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Dynamic font + emoticon in NGUI 3?
« 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic font + emoticon in NGUI 3?
« Reply #1 on: March 22, 2015, 08:27:32 AM »
No, there isn't. NGUI does not support emoticons with dynamic fonts. Just bitmap fonts.

maul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Dynamic font + emoticon in NGUI 3?
« Reply #2 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic font + emoticon in NGUI 3?
« Reply #3 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.

maul

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Dynamic font + emoticon in NGUI 3?
« Reply #4 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.
« Last Edit: March 26, 2015, 10:22:05 AM by maul »

Markov

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 27
    • View Profile
Re: Dynamic font + emoticon in NGUI 3?
« Reply #5 on: August 26, 2015, 10:59:18 AM »
Just got the same target. How did you solve the issue about big atlas size?