Different font rendering between Windows and Amazon Linux wand

51 Views Asked by At

I notice there is a problem while writing on the image on Linux Amazon, the problem is that the diacritics appear in the middle of the words which is incorrect!

BTW, I'm using Wand and Python and have checked versions on the both OS and they are the same and latest

see the images: Windows: Windows Amazon Linux: Amazon linux

My code:

from wand.image import Image as wImage
from wand.display import display as wdiplay
from wand.drawing import Drawing
from wand.color import Color

#artext = get_display(reshaped_text)
artext = "{" + "وَاصْبِرْ لِحُكْمِ رَبِّكَ" + "}"

fonts = ['DroidNaskh-Bold.ttf',
         'UthmanTNB_v2-0.ttf',
         'aa.ttf'     

         ]
draw = Drawing()
img =  wImage(width=1200,height=(len(fonts)+2)*60,background=Color('#ffffff')) 
#draw.fill_color(Color('#000000'))
draw.text_alignment = 'right';
draw.text_antialias = True
draw.text_encoding = 'utf-8'
#draw.text_interline_spacing = 1
#draw.text_interword_spacing = 15.0
draw.text_kerning = 0.0
for i in range(len(fonts)):
    font =  fonts[i]
    draw.font = font
    draw.font_size = 40
    draw.text(int(img.width / 2), int(40+(i*60)),artext)
    print(draw.get_font_metrics(img,artext))
    draw(img)
draw.text(int(img.width / 2), int(40+((i+1)*60)),u'ناصر test')
draw(img)
img.save(filename='arabictest.png')
wdiplay(img)

Any help is appreciated!

Using bidi and Arabic reshaper isn't useful as it's break the whole sentence

Font:KFGQPC Uthman Taha Naskh

0

There are 0 best solutions below