没有连接图像的草书字

时间:2017-11-30 21:46:46

标签: python numpy python-imaging-library itertools python-unicode

OutPut Image / Expected Image

我通过字体及其unicode为草书脚本生成图像,但是输出图像字符是单独的未连接。我需要加入与预期图像相同的字符。 请问问题是否不清楚。 图片链接在上面。

unicode_text = u"\u0627\u0628\u062A\u062B"
list_of_letters = list (unicode_text)
folder = 1
n=3
for i in range(1,n+1):
    for word in itertools.permutations( list_of_letters,i):
   char = ''.join(word)
   verdana_font = ImageFont.truetype("Nafees Naskh v2.01.ttf", 30, encoding="unic")
   text_width, text_height = verdana_font.getsize(''.join(word))
   canvas = Image.new('RGBA', (100, 100), (255, 255, 255),)
   draw = ImageDraw.Draw(canvas)
   canvas.save(path + '\\' + char[::-1]+'.png', "PNG")
   folder += 1

1 个答案:

答案 0 :(得分:0)

文档说你应该指定功能。见http://pillow.readthedocs.io/en/4.2.x/reference/ImageDraw.html#PIL.ImageDraw.PIL.ImageDraw.Draw.text

PIL.ImageDraw.Draw.text(xy, text, fill=None, font=None, anchor=None,
    spacing=0, align="left", direction=None, features=None)

features应该是一个列表,其中包含负责链接此字符的功能。关于arbic脚本,我不太了解。但它可能是一些连字,定位和/或替换功能。

有关功能列表,请参阅: https://www.microsoft.com/typography/otspec/featurelist.htm

文档还提到这需要安装libraqm