10000 varLib. Use designspace <axes> element to define the axisMap and order. by readroberts · Pull Request #857 · fonttools/fonttools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

varLib. Use designspace <axes> element to define the axisMap and order. #857

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 2 commits into from
Feb 24, 2017
Merged

varLib. Use designspace <axes> element to define the axisMap and order. #857

merged 2 commits into from
Feb 24, 2017

Conversation

readroberts
Copy link
Collaborator

Here is a method to use the designspace element to define the axis map, and preserve the axis order. If the element does not exist, still uses the standard_map, but with the order preserved.

@@ -59,7 +60,9 @@ def _add_fvar(font, axes, instances, axis_map):
font['fvar'] = fvar = newTable('fvar')
nameTable = font['name']

for iden in sorted(axes.keys(), key=lambda k: axis_map[k][0]):
for iden in axis_map.keys():
if not axes.has_key(iden):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to use in instead of has_key, as that no longer exists in py3

@@ -29,6 +29,7 @@
from fontTools.ttLib.tables import otTables as ot
from fontTools.varLib import builder, designspace, models
from fontTools.varLib.merger import VariationMerger
import collections
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used downstream

@@ -1,5 +1,6 @@
"""Rudimentary support for loading MutatorMath .designspace files."""
from __future__ import print_function, division, absolute_import
import collections
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to do from collections import OrderedDict ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it would make any difference.

The designspace_test.py also needs to be modified (that's why CI are failing).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if you use OrderedDict more than once, you can spare an extra attribute lookup if you import from, as Miguel suggested.

@anthrotype
Copy link
Member

@behdad @brawer could we merge this as is, and then do any fix-ups?

@behdad
Copy link
Member
behdad commented Feb 24, 2017

@behdad @brawer could we merge this as is, and then do any fix-ups?

Yes please.

@anthrotype
Copy link
Member

@behdad ok then you can merge it. The CI will still fail as the tests needs to be adjusted.

@miguelsousa
Copy link
Collaborator

@anthrotype I can take care of the fixes

@anthrotype anthrotype merged commit 7a3f8f7 into fonttools:master Feb 24, 2017
@anthrotype
Copy link
Member

Thanks Read and Miguel.

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.

4 participants
0