コード例 #1
0
ファイル: letter_tests.py プロジェクト: nomad-vino/open-tamil
 def test_fcns(self):
     self.assertEqual( utf8.mei(0), u"க்" )
     self.assertEqual( utf8.uyir(0), u"அ" )
     self.assertEqual( utf8.uyirmei_constructed(1,1), u"\u0b9a\u0bbe" )
     self.assertEqual( utf8.agaram(0), u"க" )
     self.assertEqual( utf8.istamil_prefix(u"not a tamil word"),False)
     karuppan = utf8.uyirmei_constructed(1,1)+u"nottamil"
     self.assertEqual( utf8.istamil_prefix(karuppan),True)
コード例 #2
0
 def test_fcns(self):
     self.assertEqual(utf8.mei(0), u"க்")
     self.assertEqual(utf8.uyir(0), u"அ")
     self.assertEqual(utf8.uyirmei_constructed(1, 1), u"\u0b9a\u0bbe")
     self.assertEqual(utf8.agaram(0), u"க")
     self.assertEqual(utf8.istamil_prefix(u"not a tamil word"), False)
     karuppan = utf8.uyirmei_constructed(1, 1) + u"nottamil"
     self.assertEqual(utf8.istamil_prefix(karuppan), True)
コード例 #3
0
#   print(font_name)
if True:
    fobj = get_font_like("InaiMathi")
    #font_name = font32
    size = list(map(int, paper.canvas()))
    size[0] //= 2
    size[1] //= 2
    print(size)
    #size=(64*4,64*4)
    image = Image.new('RGBA', size, (255, 255, 255))
    draw = ImageDraw.Draw(image)
    kwargs = {'font': fobj.L, 'fill': (0, 0, 0, 255)}
    W = size[0]
    H = size[1]
    dW = size[0] // 3
    dH = size[1] // 8
    offW = dW / 2 * 0.65
    offH = dH / 2 * 0.25
    for row in range(8):
        for col in range(3):
            idx = (row) * 3 + col
            letter = utf8.uyir(idx % 12)
            x, y = col * dW, row * dH
            draw.line((x, 0, x, H), fill=(0, 255, 0, 255))
            draw.line((0, y, W, y), fill=(0, 0, 255, 255))
            draw.text((x + offW, y + offH), letter, **kwargs)
    image.save("demo.png")
    image.show()
    time.sleep(2)
    #break