SDL_FreeType
-
Intro
SDL_FreeType is alternative true-type font rendering library for SDL. You can via this library draw text on SDL surfaces using true-type fonts. It`s written in C and shall be compilable under Linux and Win32 (mingw), others platforms are not tested.
Main focus in developing this library is given on speed of code.
This code was initially part of ParaGUI project but for it`s more general use i decided to make separate library.
-
Description
As the font engine FreeType2 is used. This famous piece of code brings support of many true type font formats you can use. For details see FreeType pages.
Text you drawn is described by this parameters : font`s file name, font`s index in the file, size, color, style and alpha. By special tag in the string (that`s is fully C string compatible) you can change one or more of this parameter in the middle of the rendered text and after that make step back to the previous font parameters. This ability is fully recursive and you can use it as many times in the text as you wish (there is only few rules similar to XML/HTML tagging).
Rendered text is anti-aliased correctly considering context of the target surface. (very nice)
SDL_FreeType includes glypth and face cache engine for improve text rendering performance.
Font file is loaded via function, that`s compatible with SDL_RWops (so you can easily add loading from zipped file for example).
SDL_FreeType currently supports ASCII, UNICODE and wide characters text codings. In near future i want to add support for UTF8.
-
Downloads
Development HQ at SourceForge
-
SDL_ttf vs. SDL_FreeType
SDL_FreeType is inspired by SDL_ttf, but it is using different API logic.
Main difference is that SDL_ttf creates special surface for every use of text-rendering. SDL_FreeType renders text directly into user-given surface (like SDL_FillRect()).
This way is more useful in classical text drawing operations.
My tests show that SDL_FreeType is much more (10x and more) faster than SDL_ttf - but who believes in tests ;)).
-
Author (this project is one-man-show)
Ales Teska
-
Licence
This project is under GNU Lesser General Public License (LGPL)
Design by Gorth <gorth@volny.cz>