Share via


Don't mix ClearType with your game fonts

The ClearType text rendering hint (option: -trh ct-grid) tells BMFontGen to apply ClearType anti-aliasing when rendering the font into the bitmap. ClearType is a sub-pixel font rendering technique that takes advantage of the fact that each pixel on an LCD display is actually 3 smaller "sub-pixels" arranged as red, green, blue. So, to smooth out the left side of a character, the blue component of the left neighbor pixel is adjusted. To smooth out the right, the red component of the right neighbor is adjusted.

This effect can be seen in the following image:

Now, there are a number of problems with this:

  • The font is no longer a grayscale alpha channel that can simply be tinted with color, and it doesn't render easily over arbitrary backgrounds.
  • If the font is rotated, or applied as a texture to a 3D object, the ClearType anti-aliasing doesn't work.
  • Some (very few apparently) LCD screens arrange their subpixels in BGR (little endian?) order.

So, the ct-grid option is on the chopping block. I'll be removing it for the next version. In the meantime, don't use it!