Author Topic: Fonts - Best Practice  (Read 10686 times)

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Fonts - Best Practice
« on: April 02, 2014, 12:44:15 AM »
Does anyone have any general advice for getting nice smooth, crisp fonts using NGUI?

I see a lot of games especially on iOS that have tiny fonts which are perfectly defined and readable even on iPhone screens, but I can never get anywhere near that level of clarity.

I build my fonts in GlyphDesigner and then place them all in an atlas like the example below. I then create individual UIFont objects in Unity for each one. I've tried using dynamic fonts too, but they always look a lot worse than this approach (with various sizes of the font in an atlas).

My fonts don't look terrible, but I'd like them to look PERFECT.

Looking for general discussion, tips, tricks, etc :)


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Fonts - Best Practice
« Reply #1 on: April 02, 2014, 03:57:49 PM »
Wait what? You first place the fonts into the atlas and then create UIFont? Why? Use the font maker to create the font and place it into the atlas. You can generate a bitmap font right within Unity and use the modifiers to add a shadow effect, make it more crisp, etc.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Fonts - Best Practice
« Reply #2 on: April 02, 2014, 11:05:35 PM »
Wait what? You first place the fonts into the atlas and then create UIFont? Why? Use the font maker to create the font and place it into the atlas. You can generate a bitmap font right within Unity and use the modifiers to add a shadow effect, make it more crisp, etc.

Was doing it this way to use Glyph Designer as I liked all the extra options it offered. Not a good way to go?

I also get errors when I try to use the Font Maker - FreeType.dylib missing, unable to copy to /usr/local/lib, etc. Probably documented somewhere, but I figured it didn't matter if I was sticking with Glyph Designer.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Fonts - Best Practice
« Reply #3 on: April 02, 2014, 11:13:33 PM »
Okay - sorted out that issue with some forum searching.

I'll try the Font Maker way of doing things then and see if that gives me better results.

MrTact

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: Fonts - Best Practice
« Reply #4 on: April 03, 2014, 11:56:38 AM »
On Star Wars: Assault Team, we used dynamic fonts almost exclusively. (The exception is that we needed justified text for the opening crawl, which wasn't available in NGUI at the time, so we ended up bringing in CCText just for that.) We used Orbitron from The League of Moveable Type because it's available on an open license and it has the right "feel" for our project. I suspect using a quality typeface is a big factor in how good your dynamic fonts look.

renanse

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 1
  • Posts: 14
    • View Profile
Re: Fonts - Best Practice
« Reply #5 on: April 03, 2014, 12:08:44 PM »
Another (perhaps obvious) thing we do on SWAT regarding fonts is try to never apply transform scaling to a label.  Where possible, keep the scale at 1,1,1 at the label and all ancestors (up to the UI Root) and instead use Font Size to get your text appropriately scaled.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Fonts - Best Practice
« Reply #6 on: April 03, 2014, 10:01:44 PM »
Thanks for the advice guys. My fonts look like rubbish at the moment, but I'm using the same method and typeface that I was using in the last project with NGUI 2.7 and they were fine back then. I don't know if I've missed a step or what's going on, but I can't get anything "nice" happening.

I shall keep at it! :)

I'm sure I'll figure it out eventually.

stevej

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Fonts - Best Practice
« Reply #7 on: April 04, 2014, 03:56:24 AM »
Figured out my font problems. For the record, it appears to have been two issues:

1) Working on a Macbook Pro with Retina display. I guess this will change with the Retina compatible Unity Editor that's on the way, but right now, everything looks blurry and just "wrong" when it comes to fonts. I happen to be working on an external monitor tonight, and suddenly everything is much clearer... which has helped me to see the second issue:

2) The "Glyph Padding" setting in GlyphDesigner. I had "Spacing" set to 2, but "Glyph Padding" at the default of 0. Looking really closely at the fonts in Unity, I could see that bits were getting cut off here and there. Increased "Glyph Padding" to 2, rebuild the atlas, and bingo - all looking good.

Anyway, maybe that will help anyone else if they ever get into a similar situation.