Sfoglia il codice sorgente

* method Canvas.put_char now handle utf8 char.

tags/v0.99.beta18
Alex Foulon alxf 14 anni fa
parent
commit
83c34c42ae
1 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. +7
    -2
      python/caca/canvas.py

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

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

import ctypes

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

class _Canvas(object):
@@ -161,7 +161,12 @@ class Canvas(_Canvas):
]
_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):
""" Get the Unicode character at the given coordinates.


Caricamento…
Annulla
Salva