Posted by jgiors on 2006-08-08
Although it has been slow-going, I have managed to make significant progress on SDL_pfont. The font rendering works, and the tool can process a bmp to generate an output image and an SDL_pfont data file.
There are a few more things I want to do before releasing it, though, for example:
- Verify that all code is ANSI C.
- Add command-line args for:
- minimal spacing between glyphs in the output bmp, and
- whitespace width
- Write some overview documentation (the source code is documented, but tool command-line parameters and basic do’s and don’ts should be covered).
- Create a decent sample font.
So, hopefully it won’t be that much longer before I have something that is ready for release…
Posted in Game programming, Open Source, SDL, SDL_pfont | Leave a Comment »
Posted by jgiors on 2006-04-18
INTRO
If you haven't heard of it yet, SDL is a cross-platform 2D graphics library, which also includes a few other features, like mouse/keyboard input.
WHY MAKE ANOTHER SDL FONT SYSTEM?
There are many libraries that run on top of SDL. Among them are several font libraries. I have taken a look at all the ones I could find, but they seem to share the following drawbacks:
- They include other libraries. Typically, they will at minimum require SDL_image , which then includes Zlib. It is also common to require some other special library (e.g., SDL_ttf requires FreeType).
- The format is not very efficient to draw. Most font formats require pixel-by-pixel processing. It would be nice to just make one rectangular blit per glyph.
Please don't get me wrong. I'm not criticizing these libraries. Several of them are very good at what they do, e.g., SDL_ttf is good at letting you write code that uses TrueType fonts quickly and easily. But there should be a better option for games programming, where simplicity and speed take precedence.
That is why I'm beginning work on SDL_pfont. It addresses both of the above issues by splitting the project into:
- A simple proportional font rendering system.
- A tool that processes a source image to produce a font.
I plan to release SDL_pfont as open source (assuming I feel comfortable with the resulting code). Here are the requirements I'd like SDL_pfont to meet:
FONT RENDERING SYSTEM REQUIREMENTS
- ANSI C interface
- Simple data structures
- Does not require any libraries except SDL (and a few standard C routines).
- Uses BMP format for texel data (since SDL supports BMP natively)
- Font is stored in a disk format matching the memory format
TOOL REQUIREMENTS
- ANSI C preferred (I might use some simple "C++ is better C" constructs).
- Command-line utility
- A plain-text configuration file defines the expected actions
- Process a source BMP image to produce:
- An output image containing the font glyphs
- An output file containing the font data (in the target's native format)
CONCLUSION
And, that's it for now. I'll post updates as the project continues.
Posted in Open Source, Programming, SDL, SDL_pfont, Shareware | Leave a Comment »