Search code examples
pythonpython-3.xinstallationdependenciespython-imaging-library

Installing Raqm (Libraqm) Windows 10


I'm trying to change the direction of text on an image using pil on python3, but I am unable to do so, because the dependency libraqm isn't installed. I can't find a way to install libraqm.


I tried to install it through pip, but it didnt work.

I also tried to find it, and I did but there are no instructions on how to install it on Windows 10; only on Mac OS and Linux. The link is: https://github.com/HOST-Oman/libraqm/


from PIL import Image, ImageDraw, ImageFont, ImageTk, features


Coords = [0,0]
Text = 'Hello World'
colour = '#225643'
Font = ImageFont.truetype("Font/GentiumBasic-Regular.ttf", 40, 
                                 encoding="unic"))

direction = 'rtl' #Right to Left
Alignment= 'right'

til = Image.new("RGBA", (800, 500))
draw = ImageDraw.Draw(til)
draw.text(Coords, Text, colour, font=Fonts, 
                  align=Alignment, direction=direction)
til.show()

Raises:

File "C:\Users\Yousef\AppData\Roaming\Python\Python37\site-packages\PIL\ImageFont.py", line 185, in getmask2

size, offset = self.font.getsize(text, direction, features, language)

KeyError: 'setting text direction, language or font features is not supported without libraqm'.


from PIL import Image, ImageDraw, ImageFont, ImageTk, features
print (features.check('raqm'))
print (Image.PILLOW_VERSION)

Returns:

False

6.0.0

I'm just wondering on how I should install it? Any help would be much appreciated, thank you :)


Solution

  • Libraqm also has its own dependencies that need to be installed. The easiest way to install Libraqm and its dependencies is to use vcpkg link

    Here's a video that explains to to use vcpkg video