Author Topic: Poor Custom Font Quality  (Read 5084 times)

crag

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Poor Custom Font Quality
« on: March 17, 2014, 03:05:58 PM »
Hey all,

I have exhaustively searched and attempted many "fixes" to deal with this but I am having no luck.  I am attempting to import some Bitmap fonts (Tahoma and Lucida Sans Unicode).  They look like caca (see attached).

Any input would be greatly appreciated.  Am in a ridiculous rush (aren't we all).

Thanks in advance for any suggestions,
Craig
« Last Edit: March 17, 2014, 04:00:18 PM by crag »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Poor Custom Font Quality
« Reply #1 on: March 18, 2014, 09:37:27 PM »
Did you use the native font size on the UILabel? By default when you create a label it will use the last saved font size, which may or may not match the default font size for that font.

bluescrn

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Poor Custom Font Quality
« Reply #2 on: March 19, 2014, 04:42:55 AM »
I wrote a blog post a while back about bitmap fonts, and how to get them looking decent. Not specific to NGUI, but it applies to NGUI or any similar system where bitmap fonts are used and likely to be scaled:

http://inverseblue.com/?p=268

Basic things to do are:

- Export the font at a larger-than-needed size
- Enable mip mapping and trilinear filtering
- Use a small negative mip bias to keep things sharp

For the mip bias, you'll need a tweaked copy of the NGUI shader, using tex2DBias() (I posted a few notes about that, too: http://inverseblue.com/?p=287 )

crag

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Poor Custom Font Quality
« Reply #3 on: March 19, 2014, 11:27:37 AM »
Did you use the native font size on the UILabel? By default when you create a label it will use the last saved font size, which may or may not match the default font size for that font.

Yes, I did, so when I create a smaller font to import (to hopefully get near my target), its still not sharp enough.  Thoughts?

For the mip bias, you'll need a tweaked copy of the NGUI shader, using tex2DBias() (I posted a few notes about that, too: http://inverseblue.com/?p=287 )

Making a new shader for this label based on your suggestions generates this error:

  1. Shader error in 'Unlit/Transparent Colored LSU': Program 'frag', function "tex2D" not supported in this profile (maybe you want #pragma glsl?) at line 65

That line looks as follows:

  1. fixed4 col = tex2Dbias(_MainTex, half4(i.texcoord.x,i.texcoord.y,0.0,_MainTexBias)) * i.color;

Can you see what I am missing/doing wrong here?

Thanks for your help guys, this is critical stuff as this app is text heavy.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Poor Custom Font Quality
« Reply #4 on: March 20, 2014, 01:38:51 AM »
Keep in mind fonts won't look crisp if your game window is not using dimensions dividable by two. Ie: 1000x500 will be crisp, but 1001x500 won't be.

crag

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Poor Custom Font Quality
« Reply #5 on: March 20, 2014, 05:35:23 PM »
I am fully amazed by all the things Unity can do.
Then there's fonts.
 :'(