-
Notifications
You must be signed in to change notification settings - Fork 476
ft2fea-feature file dumper #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Cool! |
Thanks Lasse! We definitely have plans to do this. My personal preference is to finish otlLib's build stuff, then add unbuild, and then add this feature to feaLib that would interface with unbuilt stuff rather than the internal tables directly. But that definitely is not a requirement per se. |
Hey, this is great! Thank you for sharing this here, Lasse :) As @behdad anticipated in #468 (comment), we are indeed planning to add support for writing OTL tables to feature files in various formats (fea, vtp, mti). Behdad proposed to define an API for "unbuilding" otData-defined objects to a set of Python primitive types (tuples, dict, set, etc.), i.e. the reverse of what otlLib.builder does. With that in place, then it would be easier to conceive writers outputting this data in various formats, including .FEA. Anyway, yours seems to go in the same direction. I look forward to seeing more of it! |
This is great, Lasse! My only concern is the lack of testing. Without unit tests, the codebase is hard to maintain. OK to wait a week or so? Then I should have the unbuild() part done. |
Thank you all for the feedback.
The unbuild plans sound good to me. I wouldn't mind to switch.
I agree. That can be done though.
I'm not in a hurry. In fact I would suggest to keep the PR open for a while and let it evolve. Adding tests, using unbuild, that's fine for me. After all you are the maintainers of fontTools, so you should decide what goes into it. With some more distance and a bit of spare time I think I'd review the implementation of the filtering/query code in the CLI (ExportAggregator), because that's rather at the edge of "keep it simple", it has probably too much implicit knowledge about the behavior of the printing functions of |
…r Format 3 (GSUB LookupType 6 Format 3)
Original Source: https://github.com/graphicore/fonttools/tree/ft2fea PR in fontTools: fonttools/fonttools#479
Original Source: https://github.com/graphicore/fonttools/tree/ft2fea PR in fontTools: fonttools/fonttools#479
Can't ft2fea be used for dumping binary fonts feature to an FEA file, which fea2fea (the other PR) can't (only takes FEA as input)? |
Ah true, I confused the two things.. 😐 So yeah, we still need to finish that unbuilding bit. |
Still would be nice if we can generate AST from binary and use AST writer. That way changing whitespace and other things will be uniformly applied to both kinds of output. |
This code is "just" a snippet, and while it would be great to have it integrated more solidly into fonttools, it's seems that no movement is being made into that direction. I'd rather have this code actually be in |
...although it currently doesn't run on Python 3, which is a bummer:
|
Can someone take this on and do the proper implementation please? |
@graphicore can you bring this up to date so it runs on Python 3 and drop it into Snippets? If not we'll have to close this. |
I'm proposing to add a feature file generator to fontTools that I just wrote for a font project of mine.
The tool is in an early state so this could be a living Pull-Request until it's sufficient for you.
This PR has two parts: the fea-rendering library
ft2fea.py
and a command line toolft2feaCLI.py
.I decided to add the CLI so that I can use the fea-generator while I'm completing it. Otherwise I had to come up with another way to silence output that I don't need in my build process.
The tool outputs GDEF, GPOS and GSUB. However, I only implemented the GPOS Lookup Types 4, 5 and 6 (MarkToBase, MarkToLigature, MarkToMark) yet.
The command line tool features a query api that makes it possible to export just selected parts of the fea and honors dependency relations (like a Lookupflag that requires a defined Mark Attachment Class from GDEF) .
Sample output of
$ ft2feaCLI.py fontfile.otf > dumped.fea
The help output of the tool: