Merge branch 'master' into pyup-scheduled-update-2019-02-25

This commit is contained in:
Cosimo Lupo 2019-02-27 17:10:00 -08:00 committed by GitHub
commit 55c7af9e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 31 deletions

View File

@ -1188,31 +1188,21 @@ class DesignSpaceDocument(LogMixin, AsDictMixin):
return None return None
def normalizeLocation(self, location): def normalizeLocation(self, location):
# adapted from fontTools.varlib.models.normalizeLocation because: from fontTools.varLib.models import normalizeValue
# - this needs to work with axis names, not tags
# - this needs to accomodate anisotropic locations
# - the axes are stored differently here, it's just math
new = {} new = {}
for axis in self.axes: for axis in self.axes:
if axis.name not in location: if axis.name not in location:
# skipping this dimension it seems # skipping this dimension it seems
continue continue
v = location.get(axis.name, axis.default) value = location[axis.name]
if type(v) == tuple: # 'anisotropic' location, take first coord only
v = v[0] if isinstance(value, tuple):
if v == axis.default: value = value[0]
v = 0.0 triple = [
elif v < axis.default: axis.map_forward(v) for v in (axis.minimum, axis.default, axis.maximum)
if axis.default == axis.minimum: ]
v = 0.0 new[axis.name] = normalizeValue(value, triple)
else:
v = (max(v, axis.minimum) - axis.default) / (axis.default - axis.minimum)
else:
if axis.default == axis.maximum:
v = 0.0
else:
v = (min(v, axis.maximum) - axis.default) / (axis.maximum - axis.default)
new[axis.name] = v
return new return new
def normalize(self): def normalize(self):

View File

@ -200,7 +200,8 @@ class PointToSegmentPen(BasePointToSegmentPen):
else: else:
pen.endPath() pen.endPath()
def addComponent(self, glyphName, transform, **kwargs): def addComponent(self, glyphName, transform, identifier=None, **kwargs):
del identifier # unused
self.pen.addComponent(glyphName, transform) self.pen.addComponent(glyphName, transform)

View File

@ -35,7 +35,7 @@ def plotLocationsSurfaces(locations, fig, names=None, **kwargs):
assert len(locations[0].keys()) == 2 assert len(locations[0].keys()) == 2
if names is None: if names is None:
names = [''] names = [None] * len(locations)
n = len(locations) n = len(locations)
cols = math.ceil(n**.5) cols = math.ceil(n**.5)
@ -45,10 +45,11 @@ def plotLocationsSurfaces(locations, fig, names=None, **kwargs):
names = [names[model.reverseMapping[i]] for i in range(len(names))] names = [names[model.reverseMapping[i]] for i in range(len(names))]
ax1, ax2 = sorted(locations[0].keys()) ax1, ax2 = sorted(locations[0].keys())
for i, (support,color, name) in enumerate(zip(model.supports, cycle(pyplot.cm.Set1.colors), cycle(names))): for i, (support, color, name) in enumerate(zip(model.supports, cycle(pyplot.cm.Set1.colors), cycle(names))):
axis3D = fig.add_subplot(rows, cols, i + 1, projection='3d') axis3D = fig.add_subplot(rows, cols, i + 1, projection='3d')
axis3D.set_title(name) if name is not None:
axis3D.set_title(name)
axis3D.set_xlabel(ax1) axis3D.set_xlabel(ax1)
axis3D.set_ylabel(ax2) axis3D.set_ylabel(ax2)
pyplot.xlim(-1.,+1.) pyplot.xlim(-1.,+1.)

View File

@ -1,5 +1,4 @@
|Travis Build Status| |Appveyor Build status| |Health| |Coverage Status| |Travis Build Status| |Appveyor Build status| |Coverage Status| |PyPI| |Gitter Chat|
|PyPI| |Gitter Chat|
What is this? What is this?
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
@ -407,8 +406,6 @@ Have fun!
:target: https://travis-ci.org/fonttools/fonttools :target: https://travis-ci.org/fonttools/fonttools
.. |Appveyor Build status| image:: https://ci.appveyor.com/api/projects/status/0f7fmee9as744sl7/branch/master?svg=true .. |Appveyor Build status| image:: https://ci.appveyor.com/api/projects/status/0f7fmee9as744sl7/branch/master?svg=true
:target: https://ci.appveyor.com/project/fonttools/fonttools/branch/master :target: https://ci.appveyor.com/project/fonttools/fonttools/branch/master
.. |Health| image:: https://landscape.io/github/behdad/fonttools/master/landscape.svg?style=flat
:target: https://landscape.io/github/behdad/fonttools/master
.. |Coverage Status| image:: https://codecov.io/gh/fonttools/fonttools/branch/master/graph/badge.svg .. |Coverage Status| image:: https://codecov.io/gh/fonttools/fonttools/branch/master/graph/badge.svg
:target: https://codecov.io/gh/fonttools/fonttools :target: https://codecov.io/gh/fonttools/fonttools
.. |PyPI| image:: https://img.shields.io/pypi/v/fonttools.svg .. |PyPI| image:: https://img.shields.io/pypi/v/fonttools.svg

View File

@ -619,7 +619,7 @@ def test_normalise4():
for axis in doc.axes: for axis in doc.axes:
r.append((axis.name, axis.map)) r.append((axis.name, axis.map))
r.sort() r.sort()
assert r == [('ddd', [(0, 0.1), (300, 0.5), (600, 0.5), (1000, 0.9)])] assert r == [('ddd', [(0, 0.0), (300, 0.5), (600, 0.5), (1000, 1.0)])]
def test_axisMapping(): def test_axisMapping():
# note: because designspance lib does not do any actual # note: because designspance lib does not do any actual
@ -638,7 +638,7 @@ def test_axisMapping():
for axis in doc.axes: for axis in doc.axes:
r.append((axis.name, axis.map)) r.append((axis.name, axis.map))
r.sort() r.sort()
assert r == [('ddd', [(0, 0.1), (300, 0.5), (600, 0.5), (1000, 0.9)])] assert r == [('ddd', [(0, 0.0), (300, 0.5), (600, 0.5), (1000, 1.0)])]
def test_rulesConditions(tmpdir): def test_rulesConditions(tmpdir):
# tests of rules, conditionsets and conditions # tests of rules, conditionsets and conditions

View File

@ -4,6 +4,6 @@ brotli==1.0.7; platform_python_implementation != "PyPy"
brotlipy==0.7.0; platform_python_implementation == "PyPy" brotlipy==0.7.0; platform_python_implementation == "PyPy"
unicodedata2==11.0.0; python_version < '3.7' and platform_python_implementation != "PyPy" unicodedata2==11.0.0; python_version < '3.7' and platform_python_implementation != "PyPy"
scipy==1.2.1; platform_python_implementation != "PyPy" scipy==1.2.1; platform_python_implementation != "PyPy"
munkres==1.1.2; platform_python_implementation == "PyPy" munkres==1.0.12; platform_python_implementation == "PyPy" # pyup: ignore
zopfli==0.1.6 zopfli==0.1.6
fs==2.4.3 fs==2.4.3