Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved unicode handling #16

Open
joerick opened this issue Apr 25, 2016 · 3 comments
Open

Improved unicode handling #16

joerick opened this issue Apr 25, 2016 · 3 comments

Comments

@joerick
Copy link
Member

joerick commented Apr 25, 2016

Some unicode characters are supported (if they're in the font), but some cause the renderer to crash, for example:

screen.text(u'πŸ•ˆβ˜Ÿβš πŸ’§βœŒβœ‹πŸ‘Ž βœ‘βšπŸ•† πŸ•ˆβ˜œβ˜Όβ˜œ βœ‹β˜  πŸ‘βšβ˜ β„β˜Όβšβ˜Ήβœ ☟☜☟☜☟☜')
Traceback (most recent call last):
  File "main.py", line 33, in <module>
    screen.text(u'πŸ•ˆβ˜Ÿβš πŸ’§βœŒβœ‹πŸ‘Ž βœ‘βšπŸ•† πŸ•ˆβ˜œβ˜Όβ˜œ βœ‹β˜  πŸ‘βšβ˜ β„β˜Όβšβ˜Ήβœ ☟☜☟☜☟☜')
  File "/Applications/Tide.app/Contents/Resources/tingbot/graphics.py", line 208, in text
    super(Screen, self).text(*args, **kwargs)
  File "/Applications/Tide.app/Contents/Resources/tingbot/graphics.py", line 150, in text
    text_image = Image(surface=font.render(string, antialias, _color(color)))
UnicodeError: A Unicode character above '\uFFFF' was found; not supported
@joerick
Copy link
Member Author

joerick commented Apr 25, 2016

Looks like a pygame issue, may be fixable by moving to the freetype backend

@furbrain
Copy link
Contributor

I'm trying to reproduce this in linux, but it doesn't seem to cause any problems for me. However, I've only cut and pasted from the above link - not sure how well the unicode has come across.
I've also tried screen.text(u'\U00010143') - which should print a gamma sign but gives me a capital N with a tilde - but no crash.

@joerick
Copy link
Member Author

joerick commented Apr 29, 2016

Interesting. Probably pygame.font uses a different backend on the different platforms. I'd really like emojis to work as well, maybe pygame.freetype would provide that? We'd also have to bundle an emoji font and a unicode font with a good number of glyphs for fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants