8000 [varLib/designspace] fixups by anthrotype · Pull Request #865 · fonttools/fonttools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[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

Merged
merged 4 commits into from
Feb 27, 2017
Merged

[varLib/designspace] fixups #865

merged 4 commits into from
Feb 27, 2017

Conversation

anthrotype
Copy link
Member
@anthrotype anthrotype commented Feb 27, 2017

mostly cosmetic, two changes deserve mention:

  • if any of axes, instances or sources element is not present, the dictionary returned from designspace.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 called sources for consistency with the designspace document specification.

Cosimo Lupo added 4 commits February 27, 2017 16:17
…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.
- 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 []
Copy link
Collaborator

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

Copy link
Member Author
@anthrotype anthrotype Feb 27, 2017

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. :)

01d8145

Copy link
Collaborator

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

Copy link
Collaborator

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.

Copy link
Member Author

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!

anthrotype pushed a commit to googlefonts/fontmake that referenced this pull request Feb 27, 2017
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.
@miguelsousa
Copy link
Collaborator

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.
Cosmo, do you have anything else to commit? I just want to make sure we're not doing the same thing.

@anthrotype
Copy link
Member Author

Ok, I'm done now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0