Public Domain font loading and other improvements

A couple of days ago, SIEGE has received Public Domain font rendering via the excellent stb_truetype library; other improvements have been added to both the STB and Freetype modules and implementations, however:

  • Kerning has been implemented
  • User-provided DPI setting for glyph rendering (default is 96)
  • Loading fonts from generic streams (SGStream — see the previous post)
  • Major cleanup of text-rendering and related (text size, offset position, …) functions in siege/graphics/font.c
  • Fixed a bug with rendering artefacts on the left-hand side of some glyphs

The new module is named “STB-TrueType” — in order to use it, simply replace “Freetype” in the sgLoadModule() call with “STB-TrueType”.

The changes are spread across multiple commits, but this is the largest:

And finally, a screenshot of the new module in action with all the improvements:

As you may have noticed, the new module does create a bit more “blurry” text, which may be (depending on the situation and the style of the game) a good or a bad thing. If that is a problem, simply use the Freetype module, which is still available (and will be available — I have no intention of removing it). I will probably be changing all the SIEGE examples to use this by default for one very simple reason — no external dependencies, everything is included with the module.

Posted in SIEGE.