I'll happily chip in my word-wrap code, if you want it as a starting point for pygame. It's not beautiful, but it does have a very nice property:
orig_string[x] -> "".join(wrapped_string)[x] They're not always equal, because it converts some spaces to a zero-width character for alignment purposes. (The char was originally \x00, hence strip_to_null, but that caused issues elsewhere, presumably with C strings.) http://code.google.com/p/endgame-singularity/source/browse/trunk/code/graphics/text.py?r=892 -FM On 9/17/08, pymike <[EMAIL PROTECTED]> wrote: > Yeah pygame.font needs support for \n. :P > > On Wed, Sep 17, 2008 at 2:31 PM, Charlie Nolan > <[EMAIL PROTECTED]>wrote: > >> Hmm, I've written this too. Given that it seems pretty common, >> wouldn't this be a good candidate for adding to pygame.font.Font? >> >> -FM >> >> On 9/16/08, Marius Gedminas <[EMAIL PROTECTED]> wrote: >> > On Tue, Sep 16, 2008 at 12:11:45PM +1000, René Dudfield wrote: >> >> The cookbook has this entry, but it doesn't work with new lines. >> >> http://www.pygame.org/wiki/TextWrapping >> >> >> >> Anyone have any code like this that supports new lines? >> > >> > http://mg.pov.lt/pyspacewar/trac/browser/trunk/src/pyspacewar/ui.py#L466 >> > >> > Output example: http://mg.pov.lt/pyspacewar/pyspacewar-help-screen.png >> > >> > It's GPL-ed, feel free to use or ask me for a licence change if that's >> > not suitable. >> > >> > Marius Gedminas >> > -- >> > If you are smart enough to know that you're not smart enough to be an >> > Engineer, then you're in Business. >> > >> > > > > -- > - pymike (http://pymike.4rensics.org/) >