-
Notifications
You must be signed in to change notification settings - Fork 476
[varLib/designspace] fixups #865
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
…turned dict According to https://github.com/LettError/designSpaceDocument > Not all values might be required by all applications. So if any of 'elements', 'sources' or 'instances' is missing, the dictionary returned by designspace.load will not contain those keys.
…space document I don't see why our parser should call this element differently than its official name.
…' and 'instances' as optional
- remove unused import - use snake_case instead of camelCase - add two empty lines between module-level definitions - rename 'elt' variable to 'element' - don't make extra dict copy in _load_axis
axes = ds['axes'] if 'axes' in ds else [] | ||
if 'sources' not in ds or not ds['sources']: | ||
raise VarLibError("no 'sources' defined in .designspace") | ||
instances = ds['instances'] if 'instances' in ds else [] |
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.
@anthrotype You forgot to define the 'masters' variable
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.
Ouch! thanks Miguel. I guess it's time to add some tests to varLib. :)
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.
also, varLib.interpolate_layout
needs some of these changes
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.
BTW, I'm putting together some test cases that will exercise fontTools.varLib.build()
and fontTools.varLib.interpolate_layout.interpolate_layout()
. I think these will help a lot validating this and upcoming changes.
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.
That'd be great, thanks a lot!
Following fonttools/fonttools#864 and fonttools/fonttools#865, varLib.designspace.load() no longer returns a tuple, but returns a dictionary with 'sources' and 'instances' items. Once a new fonttools is released, we shall also update the minimum fonttools requirements. Currently the fontmake test suite does not exercise the `-o variable` output format, so the tests will pass nonetheless.
I was getting ready to submit a PR with some of these changes. At this point the only thing salvageable is probably the test case I had to go along with them. |
Ok, I'm done now! |
mostly cosmetic, two changes deserve mention:
if any of
axes
,instances
orsources
element is not present, the dictionary returned fromdesignspace.load
will not contain the respective key/value pair; an empty list means the element is defined but empty;what was previously called
masters
is now calledsources
for consistency with the designspace document specification.