Author Topic: Custom glyphs in Font coming out odd sizes & shapes  (Read 4116 times)

PompeyBlue

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 8
    • View Profile
Custom glyphs in Font coming out odd sizes & shapes
« on: October 05, 2016, 10:21:17 AM »
Hello

I've used TexturePacker to add some custom emoticons to my font and these are appearing in game. However they are scaling to odd sizes, and also offseting in strange ways. The 3 test lines I have are shown:

In the first one the glyph is larger than the font.
In the second it's a bit to small & floating in the air
The final one is the test font that is provided with NGUI as a test.

I'm wondering if there's anything I need to do, any care I need, with regard to importing my glyphs? When I edit the sprite in the font I can see that padding etc is set to 0. The sprite takes up it's full space. It's 82x82 pixels where as the built in sprite is 20x20 pixels. Is there any magic thing I need to look out for?

PompeyBlue

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Custom glyphs in Font coming out odd sizes & shapes
« Reply #1 on: October 05, 2016, 11:55:13 AM »
I got to the bottom of this. The glyph has to be the same height as the point size of the font. You can't throw any old point size and it resizes. Also if you atlas has multiple fonts, with multiple sizes, then you need to include multiple size glyphs to go with those fonts

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Custom glyphs in Font coming out odd sizes & shapes
« Reply #2 on: October 06, 2016, 06:03:10 AM »
You can adjust the height offset of your symbols by tweaking the sprite's padding value -- just be aware it will affect all fonts using this sprite symbol.