0.4 - July 9, 2005
A simple class to render text to the display using Direct3D8 or Direct3D9. Rather than supporting Fonts directly, it supports the bitmap font files generated by Bitmap Font Builder by LMNOpc. The DirectX9 version is completely stand-alone and does not require, nor support, the dhEngine (which is DX8 only).
Example Use

Generate a bitmap of the full ASCII character set using Bitmap Font Builder. Set the alignment to Left and save it as a 32-bit TGA. Any format supported by D3DX can be used, but the 32-bit TGA has the necessary alpha info. You can convert the file to something else (like a PNG) as long as you don't lose the alpha channel.

If you want the text to be variable width (which looks MUCH nicer) also save a Font Widths (BYTE format) file. It contains the width of each character

There are 2 drawing methods: Draw and DrawFast.The 'Fast' method requires a little extra management on your part, but not much. In the attached archive each method has a demo to show how it is used.

The remainder of this section applies only to the DX8 version of the library

This 'library' has support for my dhEngine, but it is not required. To use dhEngine support include the dhEngine header, and define DHFF_USE_DHENGINE before you include the dhFastFont header. This is illustrated in the examples.

Here are some quick benchmarks. You'll notice that the dhEngine support has a significant impact on the Draw & DrawPretty methods, this is due to it's Renderstate caching. These test were run on a K6III-400, with a Matrox G400Max on Windows 2000. An 800x600x16 window was used, since full-screen would cap the FPS at the refresh rate. Values shown are the frames per second (FPS).

MethodWith dhEngineNo dhEngine

ID3DX Note:While ID3DXFont is a LOT slower it has many formatting options which give it a lot of power and flexibility. As always, choose the right tool for the job.

CD3DFont Note:If you prefer to not use a pre-defined font bitmap, as you can see CD3DFont is fast, so it's a good choice. At large font size I noticed some visual artifacts. Click here to see them. Also, the font sizing used by CD3DFont is larger than ID3DXFont. I used the same font sizing for dhFastFont and ID3DXFont and they looked the same while CD3DFont was much larger, this is neither a pro or a con, just something to note when choosing a font size.