Пример #1
0
 def test_font_rendering(self):
     render_string('ab\u0347\u0305你好|\U0001F601|\U0001F64f|\U0001F63a|')
     text = 'He\u0347\u0305llo\u0341, w\u0302or\u0306l\u0354d!'
     # macOS has no fonts capable of rendering combining chars
     if is_macos:
         text = text.encode('ascii', 'ignore').decode('ascii')
     cells = render_string(text)[-1]
     self.ae(len(cells), len(text.encode('ascii', 'ignore')))
     text = '你好,世界'
     sz = sum(map(lambda x: wcwidth(ord(x)), text))
     cells = render_string(text)[-1]
     self.ae(len(cells), sz)
Пример #2
0
 def w(x):
     return wcwidth(ord(x))