31 March 2008

Bitograph

I had to put the box2d integration on hold for a while, because of more urgent projects. However, this weekend I had a sudden inspiration to improve and expand the bitmap font support a bit. The current bitmap-font feature in Opioid2D (and pygext) is pretty primitive and doesn't let you fine tune things like kerning or have smart support for accented characters. The new one is the Ultimate Bitmap Font Engine(tm), with every possible fine tuning parameter you can think of, in order to have professional looking typography.

Creating a new bitmap font begins with a template file. This is automatically generated by Bitograph (the new library) according to the template parameters defined in the font project file. The generated template with the linked project file looks like this:



You can then load up the template file to your favorite graphics software and decorate the font as you see fit. The library also contains some stock effects (like Outline and DropShadow in the above example) that can be used by us non-artist programmers.

The linked project file might seem a bit daunting with the sheer amount of metadata, but choosing proper values is done very iteratively. You begin with nothing but the basic values (like line_height etc.) and then just add small adjustments according to how the font looks. This is made easier by the included Font Viewer:



You can tweak the kerning etc. values in the property file, and instantly see the changes in the Font Viewer (no restart needed).

The rendering code supports automatic text wrapping and will eventually support various text alignment and justification options. You can also compile long strings into bytecode-objects for the rendering engine, which makes line-wrapping and rendering a lot faster.

Expect to see the first release version of Bitograph soon.