[varLib] Add VariationModel.getDeltasAndSupports()
which automatically fetches submodel. Needs docstrings... Part of https://github.com/googlei18n/fontmake/issues/88 Part of https://github.com/fonttools/fonttools/issues/1355
This commit is contained in:
parent
6886075a23
commit
fba530a548
@ -411,9 +411,7 @@ def _merge_TTHinting(font, masterModel, master_ttfs, tolerance=0.5):
|
||||
cvar.version = 1
|
||||
cvar.variations = []
|
||||
|
||||
model, all_cvs = masterModel.getSubModel(all_cvs)
|
||||
deltas = model.getDeltas(all_cvs)
|
||||
supports = model.supports
|
||||
deltas, supports = masterModel.getDeltasAndSupports(all_cvs)
|
||||
for i,(delta,support) in enumerate(zip(deltas[1:], supports[1:])):
|
||||
delta = [otRound(d) for d in delta]
|
||||
if all(abs(v) <= tolerance for v in delta):
|
||||
|
@ -338,6 +338,10 @@ class VariationModel(object):
|
||||
out.append(delta)
|
||||
return out
|
||||
|
||||
def getDeltasAndSupports(self, items):
|
||||
model, items = getSubModel(items)
|
||||
return model.getDeltas(items), model.supports
|
||||
|
||||
def getScalars(self, loc):
|
||||
return [supportScalar(loc, support) for support in self.supports]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user