• HomeBoards
  • RulesRules
  • HelpHelp
  • WikiWiki
  • Donate

Author Topic: Displaying text in SDL  (Read 1974 times)

clach04 (OP)

  • Posts: 257
Displaying text in SDL
« on: February 02, 2011, 05:25:36 am »
Poligrafowicz kicked off a mini discussion on IRC on how text can be displayed in SDL. There are way too many options to discuss but the big options are:

SFont a bitmap based font renderer - http://www.linux-games.com/sfont/ (source code available at https://bitbucket.org/karlb/sfont/) - SFont is ideal for ASCII only. It can also be used for latin1 (e.g. http://en.wikipedia.org/wiki/Windows-1252) or other single byte character sets. gmenu2x uses a modified version of SFont that can display Latin1, see bottom of page http://mtorromeo.github.com/gmenu2x/documentation/). There is a fork http://www.zlurp.com/irq/ that claims to handle Unicode too, if that is needed (I've not used the Unicode fork). There are tools that can convert TTF into bitmaps in the contrib directory).

The other option is SDL_ttf, this can support Unicode. One issue is that Unicode fonts can be MASSIVE, e.g. 20Mb to support the common languages such as; Japanese, Chinese, English, Spainish/French/German, Russian, Polish, etc.
The goomba menu system uses this http://www.gp32x.com/board/index.php?/topic/54213-generic-guimenufile-selector/page__p__876346&#entry876346 and http://sources.cosam.org/cgi-bin/viewvc.cgi/goomba/

I've used both, I've a slight preference for SFont.

If you want other examples of SFont usage see the native SDk demo; http://code.google.com/p/dingoo-sdk/source/browse/#svn%2Ftrunk%2Fdingoo_sdk%2Fsamples%2Fsdl_hello_world or OhBoy. OhBoy has build options for libTTF (not SDL_ttf) or SFont.

Disclaimer; I have commit access to SFont so I may be biased  ;).

[edit goomba link corrected]
« Last Edit: February 02, 2011, 05:30:17 am by clach04 »

 

Post a new topic