Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing Bidi text to an image

I have some code in Python using PIL, that will print UTF-8 characters to an image.

I've noticed that for joining Bidi scripts like Arabic, the same code fails to connect characters correctly (the initial forms are only chosen, medial and final forms aren't utilized)

Can anyone recommend a method or technique for solving this particular issue?

like image 870
ct_ Avatar asked Nov 15 '22 00:11

ct_


1 Answers

If you want to keep using PIL, use pyarabicshaping with pybidi or you might want to consider switching to pangocairo which uses HarfBuzz for text shaping.

like image 86
Shervin Avatar answered Dec 06 '22 14:12

Shervin