[SDL] A question about SDL_ttf
Bill Kendrick
nbs at sonic.net
Sat Sep 8 22:29:46 PDT 2007
On Sun, Sep 09, 2007 at 01:10:28PM +0800, Mine wrote:
> Hi All,
> I'm using SDL_ttf to draw texts. It works perfect, but I don't know how
> to show multiple lines of texts.
> For example, the text is "This is a sample \nJust a test". I expect it
> shows the texts with two lines, but it just shows a blank for the '\n'. Does
> SDL_ttf support showing a string with multiple lines?
> If no, and if I want to do this, what I think I can do is that, split
> the string to several strings, create several SDL_Surface, and draw them at
> the correct position. Is there any better way to implement this?
That's the way to do it. :)
Tux Paint was recently updated to use SDL_Pango for most text rendering,
which handles RtoL, complex scripts (like Arabic), word-wrapping and
multiple lines pretty transparently. If you can afford all of IT'S
dependencies, it might be worth switching (esp. if you plan much in the way
of i18n in your project/product).
Good luck,
--
-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/
More information about the SDL
mailing list