Merge branch 'master' into pyup-scheduled-update-2019-02-25
This commit is contained in:
commit
55c7af9e86
@ -1188,31 +1188,21 @@ class DesignSpaceDocument(LogMixin, AsDictMixin):
|
||||
return None
|
||||
|
||||
def normalizeLocation(self, location):
|
||||
# adapted from fontTools.varlib.models.normalizeLocation because:
|
||||
# - 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
|
||||
from fontTools.varLib.models import normalizeValue
|
||||
|
||||
new = {}
|
||||
for axis in self.axes:
|
||||
if axis.name not in location:
|
||||
# skipping this dimension it seems
|
||||
continue
|
||||
v = location.get(axis.name, axis.default)
|
||||
if type(v) == tuple:
|
||||
v = v[0]
|
||||
if v == axis.default:
|
||||
v = 0.0
|
||||
elif v < axis.default:
|
||||
if axis.default == axis.minimum:
|
||||
v = 0.0
|
||||
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
|
||||
value = location[axis.name]
|
||||
# 'anisotropic' location, take first coord only
|
||||
if isinstance(value, tuple):
|
||||
value = value[0]
|
||||
triple = [
|
||||
axis.map_forward(v) for v in (axis.minimum, axis.default, axis.maximum)
|
||||
]
|
||||
new[axis.name] = normalizeValue(value, triple)
|
||||
return new
|
||||
|
||||
def normalize(self):
|
||||
|
@ -200,7 +200,8 @@ class PointToSegmentPen(BasePointToSegmentPen):
|
||||
else:
|
||||
pen.endPath()
|
||||
|
||||
def addComponent(self, glyphName, transform, **kwargs):
|
||||
def addComponent(self, glyphName, transform, identifier=None, **kwargs):
|
||||
del identifier # unused
|
||||
self.pen.addComponent(glyphName, transform)
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ def plotLocationsSurfaces(locations, fig, names=None, **kwargs):
|
||||
assert len(locations[0].keys()) == 2
|
||||
|
||||
if names is None:
|
||||
names = ['']
|
||||
names = [None] * len(locations)
|
||||
|
||||
n = len(locations)
|
||||
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))]
|
||||
|
||||
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.set_title(name)
|
||||
if name is not None:
|
||||
axis3D.set_title(name)
|
||||
axis3D.set_xlabel(ax1)
|
||||
axis3D.set_ylabel(ax2)
|
||||
pyplot.xlim(-1.,+1.)
|
||||
|
@ -1,5 +1,4 @@
|
||||
|Travis Build Status| |Appveyor Build status| |Health| |Coverage Status|
|
||||
|PyPI| |Gitter Chat|
|
||||
|Travis Build Status| |Appveyor Build status| |Coverage Status| |PyPI| |Gitter Chat|
|
||||
|
||||
What is this?
|
||||
~~~~~~~~~~~~~
|
||||
@ -407,8 +406,6 @@ Have fun!
|
||||
:target: https://travis-ci.org/fonttools/fonttools
|
||||
.. |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
|
||||
.. |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
|
||||
:target: https://codecov.io/gh/fonttools/fonttools
|
||||
.. |PyPI| image:: https://img.shields.io/pypi/v/fonttools.svg
|
||||
|
@ -619,7 +619,7 @@ def test_normalise4():
|
||||
for axis in doc.axes:
|
||||
r.append((axis.name, axis.map))
|
||||
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():
|
||||
# note: because designspance lib does not do any actual
|
||||
@ -638,7 +638,7 @@ def test_axisMapping():
|
||||
for axis in doc.axes:
|
||||
r.append((axis.name, axis.map))
|
||||
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):
|
||||
# tests of rules, conditionsets and conditions
|
||||
|
@ -4,6 +4,6 @@ brotli==1.0.7; 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"
|
||||
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
|
||||
fs==2.4.3
|
||||
|
Loading…
x
Reference in New Issue
Block a user