Certain Unicode Characters do not work #796

Closed
zeth opened this Issue Nov 15, 2012 · 3 comments

Comments

Projects
None yet
3 participants

zeth commented Nov 15, 2012

If you use Unicode characters above '\uFFFF', i.e. above the first "plane" (the first 65,536 characters), they do not show, and sometimes cause UnicodeErrors.

In my case it was due to using Mathematical_Alphanumeric_Symbols.
http://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols

This may be a limitation in pygame itself.

   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/app.py", line 542, in run
     runTouchApp()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/base.py", line 456, in runTouchApp
     EventLoop.window.mainloop()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 303, in mainloop
     self._mainloop()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/core/window/window_pygame.py", line 213, in _mainloop
     EventLoop.idle()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/base.py", line 312, in idle
     Clock.tick_draw()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/clock.py", line 320, in tick_draw
     self._process_events_before_frame()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/clock.py", line 444, in _process_events_before_frame
     if event.tick(self._last_tick) is False:
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/clock.py", line 232, in tick
     ret = callback(self._dt)
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/uix/label.py", line 187, in texture_update
     self._label.refresh()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/core/text/__init__.py", line 394, in refresh
     self.render(real=True)
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/core/text/markup.py", line 110, in render
     ret = self._real_render()
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/core/text/markup.py", line 294, in _real_render
     r(part, x, y + (lh - ph) / 1.25)
   File "/home/zeth/Sandbox/na/kivytrunk/local/lib/python2.7/site-packages/kivy/core/text/text_pygame.py", line 73, in _render_text
     text = font.render(text, True, color)
 UnicodeError: A Unicode character above '\uFFFF' was found; not supported

zeth commented Nov 15, 2012

Thanks to qua-non for finding it. The cause is here: http://pygame.readthedocs.org/en/latest/ref/font.html

In core/text/text_pygame.py, changing pygame.font.init() to pygame.ftfont.init() seems to stop it crashing at least.

Owner

tshirtman commented Dec 9, 2012

Is it just me or this change makes the produced text ugly?
before:
before.png

after:
after.png

:/

@tito tito closed this in c912895 Oct 20, 2013

Owner

tito commented Oct 20, 2013

@tshirtman I was having the same as you, but when you look at the log, it used PIL instead of pygame for rendering the text. So this is why it changed. Also, pygame.ftfont doesn't seem part of the pygame from ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment