0

Wondering if there's a simple solution for this; I'm rendering some text with a sprite batch and a bitmap font in a libGDX Android project. Text renders fine, but end up with a few subtle grey spots after some letters, which I want to clear up. A bit more context; I'm loading in a bold comic sans font (for now), generated using Hiero, I've set the minfilter and magfilter of the font's texture to linear. Also, I'm not scaling the font up or down at any point in my code, but may want to later. Here's a screenshot for reference: http://i824.photobucket.com/albums/zz161/9bjames/Screenshot_zpseac8c515.png (you might need to zoom in a bit).

I've looked it up, and found this: BitmapFont rendering artifacts, but I was wondering if there was a quicker fix... or at least one that's less "hacky". For example, would using a distance field font, or custom shaders help any? Thanks, let me know if ya need any more info to go on. I'll continue looking into it in the meantime.

-Quick edit: found that using default texture filters (nearest) helps with the grey spots, so long as I'm not scaling up. Seems like the quality also drops in general using TextureFilter.Nearest... but it'll do for now, whilst I get more important parts working. Any recommendations would still be appreciated.

Community
  • 1
  • 1
9bjames
  • 31
  • 8
  • If you want to use linear filtering, you need to add padding around the letters. Without padding, when the font scales, it might be sampling in between pixels on the edge of a letter and so pick up some of the next letter in the atlas. I don't remember the settings in Heiro, but it's probably there. I have found that BMFont produces nicer looking fonts than Heiro, at least for certain scales and fonts I've tried. – Tenfour04 Oct 01 '14 at 17:19
  • Distance field fonts would be helpful if you have fairly big text on screen, because it allows a large font to fit in a small png file. But that won't get you around the need for padding. Distance field fonts cannot produce sharp corners, but that's mostly OK for a font like Comic Sans. – Tenfour04 Oct 01 '14 at 17:21
  • Thanks, sounds like a simple enough fix. I always seem to be one key word away from avoiding splitting hairs over these things... ._. – 9bjames Oct 07 '14 at 20:45

0 Answers0