Not really a python guy myself either, but I know enough python & freetype to be trusted with commit access to freetype-py (I think I wrote about half of their bundled examples. A few years ago when I decided I wanted to learn pycairo, I rewrote all their existing examples from PIL+numpy to pycairo... so doubling the number) - that's the "x.freetype.x" part you are using below. So I read some freetype-py issues filed too.
If I remember correctly, pygame bundles their own rather old freetype-py fork in their "pygame.freetype." part, and possibly also a very old private libfreetype too. So problems you experienced might just be because of using old code (as in, freetype 2.5 era...).
You might want to check versions of both.
That path /usr/share/fonts/truetype/Sarai/Sarai.ttf looks linux - Debian or Ubuntu? They ship some fonts of questionable quality...
Lastly, shameless plug: Font Validator is your friend...
I collects FontVal reports from all shipped fonts on fedora and ubuntu from time to time, specifically just the rasterizer/ hinting instructions part as FontVal's testing. I think the report for this font (just the hinting instructions part) might be filed under https://github.com/HinTak/FontVal-Tests-at-10pt/ already, under the Ubuntu or the fedora branch.
On Friday, 30 June 2023 at 21:18:21 GMT+8, Werner LEMBERG <wl@gnu.org> wrote:
> Thanks, but I'm not a Python guy, so I won't test this by myself.
> > font = pygame.freetype.Font("/usr/share/fonts/truetype/Sarai/Sarai.ttf", 50)
...