Saturday, September 20, 2008

More font power to come to libtcod 1.4

Trying to push further what can be done with 256 characters, I added two nifty features to an upcoming 1.4.0b2 :
  • support for antialiased fonts from greyscale PNG. Fonts are easier to create and modify on a greyscale picture than on a 32 bit PNG with an alpha channel. You can use either white fonts on black background or black fonts on white background.
  • the mapping of the ascii values to the font can now be changed dynamically. This allows not only to use some more intuitive font layouts than the standard ASCII layout (a simple predefined "TCOD" layout can be used, or you can define your own), but it can also be used to store several fonts in the same bitmap and switch from one to another in the game. You can for example use styled characters for texts and a classic terminal font for dungeons.
Greyscale (antialiased) test font with the more convenient 32x8 "TCOD" layout.
There is still room for lots of special characters.
Note the two different sets of letters than can be used simultaneously in the game.
This font uses 256 characters but the engine can handle up to 1024 different characters, only 256 being mapped
at one time.