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

Loading and using TrueType fonts

TrueType fonts present a higher quality font rendering with the use of font outlines. Each font character is called a glyph. TTF files contain not only outlines but also the glyph's information. Glyph rendering from outlines is much slower than drawing bitmap font characters on screen. This is mainly because these glyphs are being drawn on-the-run and font rendering may be enhanced with antialiasing, which is costly. Because of this, applications using TrueType fonts often cache font glyphs into textures.

The SDL_ttf library manages the loading of the TrueType font files. Everything you need to use these files is included in the LuaSDL library.

This recipe will deal with loading font glyph in surface object, which ...

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