instancer: add comments to instantiateAvar
This commit is contained in:
parent
7c695d411f
commit
599d24a9e1
@ -158,10 +158,10 @@ def instantiateTupleVariationStore(
|
|||||||
axisLimits, rangeType=NormalizedAxisRange
|
axisLimits, rangeType=NormalizedAxisRange
|
||||||
)
|
)
|
||||||
|
|
||||||
|
newVariations = variations
|
||||||
|
|
||||||
if pinnedLocation:
|
if pinnedLocation:
|
||||||
newVariations = pinTupleVariationAxes(variations, pinnedLocation)
|
newVariations = pinTupleVariationAxes(variations, pinnedLocation)
|
||||||
else:
|
|
||||||
newVariations = variations
|
|
||||||
|
|
||||||
if axisRanges:
|
if axisRanges:
|
||||||
newVariations = limitTupleVariationAxisRanges(newVariations, axisRanges)
|
newVariations = limitTupleVariationAxisRanges(newVariations, axisRanges)
|
||||||
@ -871,6 +871,8 @@ def _isValidAvarSegmentMap(axisTag, segmentMap):
|
|||||||
|
|
||||||
|
|
||||||
def instantiateAvar(varfont, axisLimits):
|
def instantiateAvar(varfont, axisLimits):
|
||||||
|
# 'axisLimits' dict must contain user-space (non-normalized) coordinates.
|
||||||
|
|
||||||
location, axisRanges = splitAxisLocationAndRanges(axisLimits)
|
location, axisRanges = splitAxisLocationAndRanges(axisLimits)
|
||||||
|
|
||||||
segments = varfont["avar"].segments
|
segments = varfont["avar"].segments
|
||||||
@ -887,6 +889,12 @@ def instantiateAvar(varfont, axisLimits):
|
|||||||
if axis in segments:
|
if axis in segments:
|
||||||
del segments[axis]
|
del segments[axis]
|
||||||
|
|
||||||
|
# First compute the default normalization for axisRanges coordinates: i.e.
|
||||||
|
# min = -1.0, default = 0, max = +1.0, and in between values interpolated linearly,
|
||||||
|
# without using the avar table's mappings.
|
||||||
|
# Then, for each axis' SegmentMap, if we are restricting its, compute the new
|
||||||
|
# mappings by dividing the key/value pairs by the desired new min/max values,
|
||||||
|
# dropping any mappings that fall outside the restricted range.
|
||||||
normalizedRanges = normalizeAxisLimits(varfont, axisRanges, usingAvar=False)
|
normalizedRanges = normalizeAxisLimits(varfont, axisRanges, usingAvar=False)
|
||||||
newSegments = {}
|
newSegments = {}
|
||||||
for axisTag, mapping in segments.items():
|
for axisTag, mapping in segments.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user