在Windows 10上安装Raqm(Libraqm)

5
我正在尝试使用Python3中的PIL更改图像上文本的方向,但由于未安装依赖项libraqm,因此无法实现。我找不到安装libraqm的方法。请注意,需要保留HTML标签。
我尝试通过pip安装它,但是失败了。
我也试图找到它,我找到了,但没有关于如何在Windows 10上安装的说明;只有在Mac OS和Linux上的安装说明。链接是: 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()

错误提示:

文件 "C:\Users\Yousef\AppData\Roaming\Python\Python37\site-packages\PIL\ImageFont.py",第185行,函数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)

返回:

False

6.0.0

我想知道该如何安装它?非常感谢您的帮助,谢谢 :)


您也可以使用此处显示的预构建DLL - Gokul NC
2个回答

4

不用实际安装libraqm,仅需以下步骤即可在Python/PIL中使用:

  • 这里下载非官方的构建dll文件(搜索“libraqm”)
  • 将它们复制到与你的python.exe相同的目录中

重启内核后就可以使用了。


3

Libraqm也有它自己的依赖关系需要安装。 安装Libraqm及其依赖项的最简单方法是使用vcpkg链接

这里有一个视频,介绍如何使用vcpkg视频


1
如果有人想要自己构建libraqm(而不使用vcpkg),我建议使用cmake(https://github.com/HOST-Oman/libraqm-cmake)。 - Tim Orton

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接