Re: [pygame] Rendering Text By Line

2007-07-11 Thread space coyote
Or you can do word wrapping according to a specified maximum pixel width. I made a few functions for this in a project. Here's the code, its pretty self-explanatory. def truncline(text, font, maxwidth): Truncates a single line of text to given pixel size. real=len(text)

[pygame] Rendering Text By Line

2007-07-10 Thread kschnee
It's pretty simple to split your string on carriage returns (and/or line feeds), create surfaces for each line of text, and blit those surfaces to the destination surface. I'm doing something like that. I haven't yet gotten word-wrapping to work, but the following out-of-context code does