Bitmap fonts

bitmapfonts

Well, I said my goal was to get bitmapped fonts in today (autogenerated from TrueType fonts), and I snuck it in right under the wire.  Note that while this is all checked into the public trunk of VectorStorm, the code is in a very early state, and the API is liable to change a bit over the coming weeks.. but it’s basically working.

The new vsFont class uses almost exactly the same API as the old vsBuiltInFont class, except that you don’t specify a separate “capSize” for capital letters, as you now have actual, real capital letters available!  Text justification works, you can set the size (irrespective of the size of the font texture), etc.  The only real feature which hasn’t been implemented yet for these new fonts is automatic word-wrap.  Shouldn’t be difficult to do;  just ran out of time in the day.

Also note that if you want to make your own font pages, that’s done by “vsFontMaker” (which is not built by default or included in the prefix file), and that class requires SDL_ttf.  If you’re just going to use data which already exists in VectorStorm font format, then SDL_ttf isn’t required.

Note that in the screenshot above I’m using the bitmapped fonts as though they were vector sources;  they’re drawing additive, exactly like regular VectorStorm graphics.  They’d just as easily draw opaque, though, if that was called for.

And for those international folks who’ve asked about Unicode support for VectorStorm in the past..  this code is about 80% Unicode compatible.  I only need to make a few very minor modifications to get full support.  (Primarily, just modifying the font generation code to actually include the required accented and etc. characters in the font texture map)