[gvar] Remove GlyphCoordinates.__abs__()
It's not wel-defined, as abs typically is supposed to return a scalar... Also combine the tolerance-check with the zero-check in varLib.
This commit is contained in:
parent
e46f94950c
commit
3db5be2195
@ -1355,22 +1355,6 @@ class GlyphCoordinates(object):
|
|||||||
for i in range(len(a)):
|
for i in range(len(a)):
|
||||||
a[i] = -a[i]
|
a[i] = -a[i]
|
||||||
return r
|
return r
|
||||||
def __abs__(self):
|
|
||||||
"""
|
|
||||||
>>> g = GlyphCoordinates([(-1.5,2)])
|
|
||||||
>>> g
|
|
||||||
GlyphCoordinates([(-1.5, 2.0)])
|
|
||||||
>>> g2 = abs(g)
|
|
||||||
>>> g
|
|
||||||
GlyphCoordinates([(-1.5, 2.0)])
|
|
||||||
>>> g2
|
|
||||||
GlyphCoordinates([(1.5, 2.0)])
|
|
||||||
"""
|
|
||||||
r = self.copy()
|
|
||||||
a = r._a
|
|
||||||
for i in range(len(a)):
|
|
||||||
a[i] = abs(a[i])
|
|
||||||
return r
|
|
||||||
def __round__(self):
|
def __round__(self):
|
||||||
"""
|
"""
|
||||||
Note: This is Python 3 only. Python 2 does not call __round__.
|
Note: This is Python 3 only. Python 2 does not call __round__.
|
||||||
|
@ -232,6 +232,8 @@ def _optimize_delta(delta, coords, ends):
|
|||||||
|
|
||||||
def _add_gvar(font, model, master_ttfs, tolerance=.5, optimize=True):
|
def _add_gvar(font, model, master_ttfs, tolerance=.5, optimize=True):
|
||||||
|
|
||||||
|
assert tolerance >= 0
|
||||||
|
|
||||||
log.info("Generating gvar")
|
log.info("Generating gvar")
|
||||||
assert "gvar" not in font
|
assert "gvar" not in font
|
||||||
gvar = font["gvar"] = newTable('gvar')
|
gvar = font["gvar"] = newTable('gvar')
|
||||||
@ -261,9 +263,7 @@ def _add_gvar(font, model, master_ttfs, tolerance=.5, optimize=True):
|
|||||||
endPts = control[1] if control[0] >= 1 else list(range(len(control[1])))
|
endPts = control[1] if control[0] >= 1 else list(range(len(control[1])))
|
||||||
|
|
||||||
for i,(delta,support) in enumerate(zip(deltas[1:], supports[1:])):
|
for i,(delta,support) in enumerate(zip(deltas[1:], supports[1:])):
|
||||||
if all(0 == v for v in delta.array):
|
if all(abs(v) <= tolerance for v in delta.array):
|
||||||
continue
|
|
||||||
if tolerance and max(abs(delta).array) <= tolerance: # XXX
|
|
||||||
continue
|
continue
|
||||||
var = TupleVariation(support, delta)
|
var = TupleVariation(support, delta)
|
||||||
if optimize:
|
if optimize:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user