Reputation: 23
I was wondering how to get the backwords E or the There Exists symbol to show in pygame. I am having a text string move around and I need the there exists symbol to show. Whenever I try to it wont show correctly. Thanks in advance.
Upvotes: 2
Views: 1529
Reputation: 8010
Pygame has no problem whatsoever rendering special characters, as long as your font supports it.
Gui programs often simply swap the font for special characters when the primary font doesn't contain them. Pygame isn't that smart, you need to make sure the font you use contains every character you try to render, or they will be replaced by ugly squares. An example of a font that contains the ∃ is DejaVu sans.
If you use python 2.x, you might have some problems on the python side of things. Python strings are 8 bits, so they can't contain special characters. Your string that contains the ∃ will need to be a Unicode string. A Unicode string is simply a string that has a u before the quote, like u"this". The default encoding for a python 2 file is also not Unicode, so you can either include a encoding header, or use a escape sequence, like u"\u2203" to refer to ∃. Python 3 has no problems with special characters right out of the box. (for more info, go to https://docs.python.org/2/howto/unicode.html)
Upvotes: 2