Merge pull request #2067 from simoncozens/fealib-debug-subclassable

Only stash lookup location if buildLookups_ has cooperated
This commit is contained in:
Simon Cozens 2020-10-19 09:14:06 +01:00 committed by GitHub
commit 10413d947a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ from fontTools.otlLib.error import OpenTypeLibError
from collections import defaultdict
import itertools
import logging
import warnings
log = logging.getLogger(__name__)
@ -707,9 +708,13 @@ class Builder(object):
continue
for ix in lookup_indices:
self.lookup_locations[tag][str(ix)] = self.lookup_locations[tag][
str(ix)
]._replace(feature=key)
try:
self.lookup_locations[tag][str(ix)] = self.lookup_locations[tag][
str(ix)
]._replace(feature=key)
except KeyError:
warnings.warn("feaLib.Builder subclass needs upgrading to "
"stash debug information. See fonttools#2065.")
feature_key = (feature_tag, lookup_indices)
feature_index = feature_indices.get(feature_key)