[Tux4kids-tuxtype-dev] SDL_ttf and SDL_Pango

David Bruce davidstuartbruce at gmail.com
Sun Mar 1 13:25:43 UTC 2009

Hi Tim,

It seems to me that we could clean things up in tuxmath (and tuxtype)
by keeping the whole SDL_ttf/SDL_Pango issue encapsulated within
SDL_extras.c/h, so the rest of tuxmath's and tuxtype's code wouldn't
have to worry (or even know) which is being used.

In tuxmath, we almost do this already - all of the text drawing is
done through BlackOutline() or your newer SimpleText().  The other
code (say titlescreen.c) loads fonts, but they are only used through
these functions.  Plus, if SDL_Pango is used, the font argument is
completely ignored.

My thought is to change BlackOutline() and friends to take an int size
argument instead of the TTF_Font* argument.  At setup time, the
program would either initialize the pango context or load any needed
fonts, depending on what library is being used.  The only code with
"#include SDL_ttf" would be SDL_extras.

I have this partially implemented on my local machine, but wanted to
get everyone's thoughts before making this change.

The big advantage is that the linux programs would no longer have any
font dependencies.  This is particularly an issue for tuxtype, which
now has eleven bundled fonts.

Any thoughts?


More information about the Tux4kids-tuxtype-dev mailing list