Many of you have GUI, but seeing the screenhots topic it seems to me that displaying fonts is usually problematic for most of you. Let me help you with a small and portable font renderer. It was written in a single ANSI C/C++ header file and licensed under MIT, has minimal dependencies, so it's very easy to integrate into your OS. It's API has two modes:
ssfn_putc(unicode)
Is a very simple version, which can display proportional but unscaled bitmap fonts. For this limitation in return it does not allocate memory or call any functions, therefore it is completely dependency free, and compiles into less than a kilobyte. It was designed to be used for OS kernel consoles.
ssfn_render(ctx, unicode)
Is a fully blown version, which needs libc (memset(), memcmp(), realloc() and free()). It can scale glyphs, handles bitmap, pixel and vector based fonts. It's very easy on memory (usually allocates no more than 32 kilobytes), simple to use and compiles about to 21 kilobytes. It was designed to be used by applications, but you can easily integrate it into your kernel if you provide realloc() and free() with some defines. Despite of it's small size, it can do everything that other renderers, and in some respect even more:
- UTF-8 support
- scaling
- antialiasing
- automatic hinting
- kerning
The font library uses it's own font format I designed, which uses compression on fonts. For vector based fonts you can set the compression level, so you can choose between font quality and file size to your needs. With the same quality as an OpenType, my format usually takes half the file size. Converters (small command line tools also written in ANSI C) are provided to import the following font formats:
- PostScript Type 1 (eps)
- TrueType (ttf)
- OpenType (otf)
- X11 Bitmap Distribution Format (bdf)
- Linux Console's PC Screen Font (psfu)
- GNU unifont (hex)
- TARGA (tga, to import pixel fonts)
Cheers,
bzt