-
Notifications
You must be signed in to change notification settings - Fork 480
Fixes to voltLib and VoltToFea #3818
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
Conversation
Python 3.8 does not have graphlib module, I tried adding Suggestions are welcome. 3.8 is EOL’d already, if dropping support for it is an option. |
Swap the actual and expected strings in self.assertEqual() calls so that the diffs are shown correctly.
See inline comments and the example in the test.
See inline comments.
This seems to be what VOLT does.
If any of the input glyphs is a glyph class, we need to explode it into multiple statements since feature file syntax does not support classes in ligature substitutions.
VOLT ranges are GID-based, while feature files ranges are glyph names-based, so the two are not compatible and we should expand VOLT ranges.
Since we need to map VOLT glyph names to font glyph names and groups reference glyphs.
If only some of the glyphs are ligatures or marks, then VOLT makes it a mark to base lookup and uses the anchor of the first ligature component (in case of ligatures).
In VOLT group definitions can be ordered in any order, but in FEA a group must be defined before being referenced in another group. We had some code to sort the groups to fix this, but it was broken in several ways. We now use the more appropriate TopologicalSorter(), and nested enums when getting what groups a group references.
Without this fix we would output invalid fea code like: pos [[a b] [c d] [e f g h i j k l] [m n o p q]]' lookup lookup_target space;
Rename variables to be less cryptic.
In FEA syntax aalt is not allowed to have script or language statements, but in OpenType and VOLT it is a regular feature like any other. We now emit a warning and use only lookups from first script and language.
No functional change. Prepares for next commit.
Using inline syntax results in very inefficient lookups, with each statement going into a subtable. Some fonts get too big lookups and even fail to compile. Using explicit lookup blocks for the chained lookups fixes most of such undesired subtable breaks.
VOLT might skip the padding spaces, but feaLib.ast will assert if not equal to 4.
VOLT ignores it unless it is a single substitution lookup, so we now do the same instead of raising.
Add __main__.py CLI that takes a MS VOLT project and compiles it to font tables. Layout tables are currently converted first to feature files and compiled with feaLib. Support for other tables (e.g. cmap) will be added later. At some point direct compilation of layout tables (without converting to feature files first) might be added.
Python 3.8 support was dropped in #3819, so this is fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks Khaled
This PR add some missing functionality and fixes to voltLib and VoltToFea, making the conversion to feature files more robust. Together with the recent feaLib changes, this allowed me to compile a large corpus of VOLT sources (which I can not share). The PR also adds a script that uses voltLib and feaLib to compile VOLT sources directly (doing an intermediate fea conversion internally) to be used as
fonttools voltLib
from command line.