Text rendering if often the base part of any graphical engine. The text rendering engine can be divided into two groups:
The main difference is that bitmap fonts are usually proportional and glyph placement is quite easy as each glyph uses the same spacing and all glyphs use the texture of the same size. On the other hand, TrueType font rendering is more complex as it uses glyphs of different sizes. Each glyph has its own characteristics and you can't easily determine how much space will be taken by text.
This recipe will cover the second case with TrueType font rendering. Bitmap font rendering can be easily derived from this recipe with a few changes.