rougier / freetype-py

Python binding for the freetype library
Other
298 stars 88 forks source link

Variable font support spotty? #116

Closed josh-hadley closed 4 years ago

josh-hadley commented 4 years ago

I'm curious as to any plans around implementing FreeType's variable font related functions in freetype-py. There are a few linked up already in freetype/raw.py:

But other related ones are not (FT_Get_Var_Blend_Coordinates, FT_Get_Var_Design_Coordinates, FT_Get_Var_Axis_Flags, FT_Done_MM_Var, ...), and it doesn't appear that any of the related variable font structs are yet wired up in freetype/ft_structs.py FT_Var_Axis, FT_Var_Named_Style, FT_MM_Var).

I have been playing around with some implementations of these and related code locally that might be useful freetype-py. Do the maintainers have a strong preference for handling contributions (i.e. submit PRs from a fork, or direct to this repo)?

madig commented 4 years ago

Hi! Thanks for looking into this. I think no one is working on anything in this repo right now, it's more or less on life-support. PRs from a fork is fine :)

HinTak commented 4 years ago

PRs from fork is slightly better as it is CI checked before merge; direct commit is after the fact. The reason why some APIs are linked up while others aren't, is mainly age and backward compatibility: you want to support some slightly-older freetype, where some of these are missing, and have graceful errors. So I'd prefer you don't force people to upgrade their libfreetype.

josh-hadley commented 4 years ago

@HinTak sure, it shouldn't be a problem to maintain backward compatibility with older FreeType versions (I think there's already some code in there to handle such cases).

HinTak commented 4 years ago

I think the few that were linked up, were because they were in older freetype. I think I added a few just based on symbol dumps a while ago, as part of a "this routine is in libfreetype, why it isn't exposed in freetype-py" general fix. It was systematic in the sense that "these symbols have been part of freetype for a while, let's add them", but not in the sense of adding support to specific new features. I also found it a bit tedious to find out which version of freetype has what, and try to put in some "if version > x expose routine y" checks. But if you are doing specific features like variable fonts, you can enclose entire blocks in such, which is nicer to add and to look at too.

josh-hadley commented 4 years ago

Yes, this is what I was thinking also.

I have some company approval stuff to complete before I can contribute a PR but will try to get these in as soon as I have that and we can discuss more then.

madig commented 4 years ago

I suppose this is solved now? :)