ttfautohint-py icon indicating copy to clipboard operation
ttfautohint-py copied to clipboard

replace ctypes with.. something else?

Open anthrotype opened this issue 3 years ago • 1 comments

I'm more and more tempted to do away with the ctypes bindings altogether.. We have issues with pypy3 (#11) and now also with M1 arm64 macs (#14). The easiest would be using subprocess to wrap the ttfautohint executable, like we do e.g. for cffsubr or ots-sanitize. Other options include using cffi or cython to wrap the libttfautohint library, but these probably involve more work. Keeping this up to date with upstream ttfautohint also means that every time the upstream CLI interface changes, we have to update its python equivalent. I wonder if this is actually worth the hassle. The way I see this ttfautohint-py project is as a handy way for fontmake to depend on a pip-installable ttfautohint, I don't actually care much whether this is done using a shared library dynamically loaded via ctypes or as a subprocess. Even after https://github.com/googlefonts/fontmake/issues/562, fontmake is still calling ttfautohint-py as an external command (as python -m ttfautohint) instead of importing it as a python module. Maybe we can even deprecate/archive this altogether and tell people to go and brew install ttfautohint (well, at least that works on Mac and maybe Linux).

anthrotype avatar Feb 01 '22 12:02 anthrotype

Currently a single command (pip3 install gftools) will get you something that can build and hint fonts, even without homebrew. That's quite valuable.

simoncozens avatar Feb 02 '22 14:02 simoncozens