O'Reilly logo

Lua Game Development Cookbook by Mário Kašuba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying the text

Text rendering if often the base part of any graphical engine. The text rendering engine can be divided into two groups:

  • The bitmap font rendering engine
  • The TrueType font rendering engine

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.

Getting ready ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required