Browse Source

* method Canvas.put_char now handle utf8 char.

tags/v0.99.beta18
Alex Foulon alxf 13 years ago
parent
commit
83c34c42ae
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      python/caca/canvas.py

+ 7
- 2
python/caca/canvas.py View File

@@ -16,7 +16,7 @@


import ctypes import ctypes


from caca import _lib
from caca import _lib, utf8_to_utf32
from caca.font import _Font from caca.font import _Font


class _Canvas(object): class _Canvas(object):
@@ -161,7 +161,12 @@ class Canvas(_Canvas):
] ]
_lib.caca_put_char.restype = ctypes.c_int _lib.caca_put_char.restype = ctypes.c_int


return _lib.caca_put_char(self, x, y, ord(ch))
try:
ch = ord(ch)
except TypeError:
ch = utf8_to_utf32(ch)

return _lib.caca_put_char(self, x, y, ch)


def get_char(self, x, y): def get_char(self, x, y):
""" Get the Unicode character at the given coordinates. """ Get the Unicode character at the given coordinates.


Loading…
Cancel
Save