I have python code. "کم" is a string, consisting of two alphabets ک and م . but they are combined in arabic. i am giving this word to PIL library function. But it is saving image separately both alphabets. How can i combine them.?
data2= "کم"
draw.text(((W-w)/2,(H-h)/2),data2,(0,0,0),font=font)
draw = ImageDraw.Draw(img)
img.save("abc"+".png")
output: that is ک and م .
You can use the python_arabic_reshaper library in order to get the text correctly written. This is the github repo for this library.
Install the library:
pip install --upgrade arabic-reshaper
Then import it like this:
import arabic_reshaper
Then you can use it like this:
text_to_be_reshaped = 'اللغة العربية رائعة'
reshaped_text = arabic_reshaper.reshape(text_to_be_reshaped)