[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] tab rendering in text?



Lee Harr wrote:
Is there a way to make pygame render the tabs in text properly?

How about just replacing them with spaces before rendering?

a = 'some\tstring\twith tabs and spaces'
b = a.replace('\t', ' '*4)
I worked out a function to let me render text with tabs so it acts like I expect tabs to act. Mostly it just tracks tab offsets and aligns to those and renders each text fragment in the proper place on the surface which is then returned.

The only problem is that I can't seem to make the surface I'm rendering to transparent in the way font.render () does. I can make the surface color transparent but then it looks bad (I get speckles of the color around the font edges).. I guess because of the anti-aliasing. Any suggestions?

--
"When Government fears the people, it's liberty. When people fear the
Government, it's tyranny." -- Benjamin Franklin

Michael <mogmios@mlug.missouri.edu>
http://kavlon.org