Search Unity

Font filtering issue

Discussion in 'Scripting' started by Threepwood, Aug 24, 2011.

  1. Threepwood

    Threepwood

    Joined:
    Jul 23, 2009
    Posts:
    95
    I've imported a random .ttf into Unity.

    Under the TTF, there is a directory with a font material and a font texture.

    My issue is - the font texture is bilinear filtered and I want the filtering to be "Point" so there is no filtering. When I set that it works and I can see the crisp font, until I save the Unity project, then the Fliter Mode flips back to "Bilinear" and the fonts are blurry again.

    Any ideas?
     
  2. Threepwood

    Threepwood

    Joined:
    Jul 23, 2009
    Posts:
    95
    Basically it looks like I can't alter the font texture that's generated as you import the TTF into Unity.
     
  3. Threepwood

    Threepwood

    Joined:
    Jul 23, 2009
    Posts:
    95
    Found a solution that may help others:

    Since you cannot alter the material/texture of the imported TTF, I just sort of hacked it.

    I took a screenshot of the font texture, loaded it into Photoshop and cut out the letters and re-saved it to the proper size (128x256) and imported it into Unity and set the filtering like I wanted. Then you just create a new font material, apply that texture, and apply the material to your gui text or whatever and it all just works.
     
  4. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    There is a SaveFontTexture script on the Unify wiki that will export the texture. Much easier than the route you took.
     
  5. bdev

    bdev

    Joined:
    Jan 4, 2011
    Posts:
    656
    I've posted this as a bug back in 3.2 and its annoying to see that you can definitely change the value to point, like you've mentioned but it sneakily changes back. They should either allow for it and serialize the choice or don't allow for any modification of the texture at all. Annoying
     
  6. apocriva

    apocriva

    Joined:
    Nov 3, 2011
    Posts:
    25
    This has been irking me as well. What I ended up doing was to expose a font variable in one of my common scripts, and toss in something like this in Start():

    font.material.mainTexture.filterMode = FilterMode.Point;

    Seems to have done the trick.