将库尔德文本(从右到左)添加到图像会返回分隔的字符串

Adding Kurdish text (right to left) to image is returned separated strings

我正在使用 PIT 在图像上放置库尔德语(索拉尼语,类似阿拉伯语)文本,但图像上的文本彼此分离。有谁知道如何解决这个问题?

font_size = 100
img = Image.open("cute cat.jpg")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("./KGoran.ttf", font_size, encoding="unic")

text = "ڕۆژتان باش ئازیزان"
reversed_text = reversed(text)

fill = (0,0,0)
font = font

string_text = ""
for i in reversed_text:
    string_text += i

draw.text((0, 0), string_text, fill, font)
img.save("added text to image.jpg")

PIL 无法处理类似阿拉伯语的字体(除非他们最近修复了它)。我看过一个图书馆,比如 this reshaper library, which will combine characters correctly. Other solutions include using pango or pycairo to deal with the font, see this discussion.