I am having issues with Pillow's text rendering features. I wanted to enable kerning for the font so that it looked nicer, but have descended into an endless rabbit hole of insanity.
When trying to run this code line:
draw.text((1255, 224), desc, font=font.font_variant(size=94), fill=0xff0000ff, features=['kern'])
I receive the following error message:
size, offset = self.font.getsize(
KeyError: 'setting text direction, language or font features is not supported without libraqm'
I've searched online for a long while and have found a few answers that have not yielded any results... Most notably How to install pre-built Pillow wheel with libraqm DLLs on Windows? and Installing Raqm (Libraqm) Windows 10.
I was so stressed that I eventually copied and pasted the DLL files in every folder I could think of (such as System32, SysWOW64, Python38, Python38\Scripts, Python38\DLLs, etc.), but still failed.
I was even changing PATH
, PYTHONPATH
, and sys.path
.
>>> from PIL import features
>>> features.check('raqm')
False
The check above always printed False
I inspected the code that checks if a feature is present and checked myself, it cannot find any DLL:
>>> imported_module = __import__('PIL._imagingft', fromlist=['PIL'])
>>> vars(imported_module)
{ ..., 'HAVE_RAQM': False, 'HAVE_FRIBIDI': False, 'HAVE_HARFBUZZ': False, ... }
For reference, these are my versions:
- Windows 10 Pro 20H2
- Pillow 8.2.0
- Python 3.8.7
I have become very desperate for any answer... Looked online for a while and was not able to find much information, always only one or two Google results had some relevance to this issue.