[SDL] How to draw text in some determined area, doing auto wrap
Gustavo Sverzut Barbieri
gsbarbieri at yahoo.com.br
Thu Sep 5 23:27:01 PDT 2002
--- Charles Wardlaw <kattkieru at yahoo.com> escreveu: > > PS: We use
python+SDL and pygame. So solutions using them are
> > preferable :)
> Well, the only real way to do this is manually by calculating how
> characters can fit into a rectangle. I'll tell you now: skip the TTF
> font stuff and use monospace bitmap fonts. Non-monospace fonts
> a bit more calculation.
> Basically, you step through the string character by character and
> away, then add the width of the font to your current X coordinate.
> you're out of bounds, drop back to the beginning of the line and then
> drop down by adding to the y coordinate. It's a pretty simple thing
> do with a monospace font. A variable-width font requires you to
> the sizes of individual characters.
> Does this help?
> - Charles
Kind of... We must do this work with all type of fonts. It's an
But that was the idea we had before.
O super editor para criação de sites: é grátis, fácil e rápido.
More information about the SDL