Product Home Class IndexDownload

CK_BitmapFont

CK_Font
    |
    +----CK_BitmapFont

This is a font created from a specially formatted bitmap containing the character set. An example of the first part of a font bitmap is shown below:

The bitmap should contain each character of the font in a horizontal row. Each character should be separated by a 1-pixel wide vertical bar. The color of the separator bars is determined by the pixel at position 0,0 in the bitmap. The characters in the bitmap can be different widths, but all are the same height. Any color can be used as the transparent color, and the bitmap can be any pixel depth (palette, 16-bit high color, or 24-bit true color).

The first character in the bitmap should be the space character. The first 32 non-printable characters in the ASCII character set are not used. There shouldn't be more than 224 characters in the font, but there can be less if the characters are not used. Most applications use font sets that end with the '~' character, which is ASCII code 126.

See Example 6 for an example program that uses CK_BitmapFont.


Constructors

CK_BitmapFont(const CK_StaticBitmap &bitmap)
Construct a CK_BitmapFont from a bitmap containing the character set.

The constructor does not own the bitmap. This means that it holds a reference to the bitmap, but it is not responsible for deleting it when the CK_BitmapFont is destructed. If a CK_BitmapFont is created from a bitmap, the bitmap should not be deleted as long as the font is in use.