Codehead's Bitmap Font Generator


 

One of the big problems OpenGL runs into after you've got your first few polygons flying around the screen is the lack of a standard method for generating text within the API.
A few techniques have evolved to tackle the problem:

Pre-generated string textures
The simplest and fastest method, but pre-generated text isn't very flexible at run-time.

Polygon glyphs created from outline font definitions
This method produces high quality, scalable text, but this approach is the slowest due to the overhead of generating and rendering the glyph polygons.

WGL and GLUT extensions
These extensions do a great job of text rendering. However, these libraries are not available on all platforms and we want our code to be portable and platform independant.

Bitmapped fonts
Bitmap fonts are fast, flexible and platform independant. However, quality suffers when scaling up and the number of possible characters in a font texture is limited. Extended or Unicode character sets with accents or non-latin symbols are not well supported.

 

A bitmapped font is simply an atlas texture containing a collection of glyphs and symbols.

The characters can then be mapped individually onto polygons to create dynamic strings of text.

Adding width information to the glyphs allows the textured quads to be overlapped to create better looking text with variable character widths.

 

 

There are many bitmap font generators around, but I wanted a few features that the others didn't provide. So I wrote my own.

Codehead's Bitmap Font Generator (CBFG) is now at version 1.43 and supports the following features:

  • DIB rendering of font gives best font output, regardless of users screen settings.
  • Global or per character position and width adjustment.
  • Texture Sizes from 16x16 up to 4096x4096.
  • Zoom up to 400% for accurate tweaking of character positions.
  • Anti-aliasing for smoother looking fonts, Cleartype is available on machines running Windows XP or newer operating systems.
  • Control of font width.
  • Font preview option.
  • TGA export option.
  • BMP output option.
  • BFF output in 8, 24 and 32bit colour depths
  • C++ example source code for loading and rendering BFF files
  • Binary font data export.
  • Font info dump option.
  • User configurable colours and startup parameters

CBFG has been used on the following projects:

  Font Generator Screen Shot

Downloads

 

CBFG Packages

Windows Installer Package

Files only zip

 

BFF Loading Code

C/C++ - included in zip/installer.
Android by Codehead
O'Caml by Einar (local mirror)

The Future

CBFG is still evolving, there are a few features I'd like to add and there are some bugs to be ironed out.

ToDo List

  • State save option.
  • Merge/Extract font image.
  • OpenGL ES port of render code for Android. (See blog for details of progress)

Wish List

  • Export in other font generator formats.
  • Edit font image.
  • Unicode support.

Known Issues

  • Cleartype on XP overrides antialias settings.

 

Problems, ideas, bugs?
Drop me an email on the link below.


Home Email