Loading and using bitmap fonts
Bitmap fonts are used mainly with monospaced fonts. Mainly, that's because you can evenly divide bitmap into rectangular areas. Each of these areas contains one font character. Usually, such font characters are sorted by ASCII coding or use a part of this coding. Once you have loaded the image file with the bitmap font, you can easily access each font character finding its rectangular coordinates. These coordinates can be stored in a Lua table which makes character lookup fast. This kind of font is quite popular mainly because each font character has equal spacing between characters, so you don't have to handle problems with font kerning.
The following example shows a bitmap font stored in an image:

This recipe will deal with single glyph rendering.
Getting ready
First you need to load the bitmap font into graphical memory. Let's assume that the font_texture_id
variable contains a valid texture object, which contains the font image. The Font_texture_width
and font_texture_height...