[feaLib] Disallow lookup blocks inside feature aalt
The new behavior matches how makeotf v2.0.90 interprets the OpenType Feature File Specification.
This commit is contained in:
parent
f998cf1126
commit
bf79ceb2f2
@ -364,6 +364,11 @@ class Builder(object):
|
|||||||
if name in self.named_lookups_:
|
if name in self.named_lookups_:
|
||||||
raise FeatureLibError(
|
raise FeatureLibError(
|
||||||
'Lookup "%s" has already been defined' % name, location)
|
'Lookup "%s" has already been defined' % name, location)
|
||||||
|
if self.cur_feature_name_ == "aalt":
|
||||||
|
raise FeatureLibError(
|
||||||
|
"Lookup blocks cannot be placed inside 'aalt' features; "
|
||||||
|
"move it out, and then refer to it with a lookup statement",
|
||||||
|
location)
|
||||||
self.cur_lookup_name_ = name
|
self.cur_lookup_name_ = name
|
||||||
self.named_lookups_[name] = None
|
self.named_lookups_[name] = None
|
||||||
self.cur_lookup_ = None
|
self.cur_lookup_ = None
|
||||||
|
@ -329,6 +329,12 @@ class BuilderTest(unittest.TestCase):
|
|||||||
" sub A from [A.alt1 A.alt2];"
|
" sub A from [A.alt1 A.alt2];"
|
||||||
"} foo;")
|
"} foo;")
|
||||||
|
|
||||||
|
def test_lookup_inside_feature_aalt(self):
|
||||||
|
self.assertRaisesRegex(
|
||||||
|
FeatureLibError,
|
||||||
|
"Lookup blocks cannot be placed inside 'aalt' features",
|
||||||
|
self.build, "feature aalt {lookup L {} L;} aalt;")
|
||||||
|
|
||||||
|
|
||||||
def generate_feature_file_test(name):
|
def generate_feature_file_test(name):
|
||||||
return lambda self: self.check_feature_file(name)
|
return lambda self: self.check_feature_file(name)
|
||||||
@ -339,4 +345,3 @@ for name in BuilderTest.TEST_FEATURE_FILES:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user