diff --git a/Lib/fontTools/feaLib/builder.py b/Lib/fontTools/feaLib/builder.py index 067c59708..e66c4c3b4 100644 --- a/Lib/fontTools/feaLib/builder.py +++ b/Lib/fontTools/feaLib/builder.py @@ -385,10 +385,6 @@ class Builder(object): def set_language(self, location, language, include_default, required): assert(len(language) == 4) - if self.cur_lookup_name_: - raise FeatureLibError( - "Within a named lookup block, it is not allowed " - "to change the language", location) if self.cur_feature_name_ in ('aalt', 'size'): raise FeatureLibError( "Language statements are not allowed " @@ -450,10 +446,6 @@ class Builder(object): self.lookupflag_ = value def set_script(self, location, script): - if self.cur_lookup_name_: - raise FeatureLibError( - "Within a named lookup block, it is not allowed " - "to change the script", location) if self.cur_feature_name_ in ('aalt', 'size'): raise FeatureLibError( "Script statements are not allowed " diff --git a/Lib/fontTools/feaLib/builder_test.py b/Lib/fontTools/feaLib/builder_test.py index f3687c98d..58d3f2b22 100644 --- a/Lib/fontTools/feaLib/builder_test.py +++ b/Lib/fontTools/feaLib/builder_test.py @@ -51,7 +51,7 @@ class BuilderTest(unittest.TestCase): spec4h1 spec5d1 spec5d2 spec5fi1 spec5fi2 spec5fi3 spec5fi4 spec5h1 spec6b_ii spec6d2 spec6e spec6f spec6h_ii spec6h_iii_1 spec8a spec9b spec9c1 spec9c2 spec9c3 - bug463 bug502 + bug463 bug501 bug502 """.split() def __init__(self, methodName): @@ -237,13 +237,6 @@ class BuilderTest(unittest.TestCase): "Script statements are not allowed within \"feature aalt\"", self.build, "feature aalt { script latn; } aalt;") - def test_script_in_lookup_block(self): - self.assertRaisesRegex( - FeatureLibError, - "Within a named lookup block, it is not allowed " - "to change the script", - self.build, "lookup Foo { script latn; } Foo;") - def test_script_in_size_feature(self): self.assertRaisesRegex( FeatureLibError, @@ -269,13 +262,6 @@ class BuilderTest(unittest.TestCase): "Language statements are not allowed within \"feature aalt\"", self.build, "feature aalt { language FRA; } aalt;") - def test_language_in_lookup_block(self): - self.assertRaisesRegex( - FeatureLibError, - "Within a named lookup block, it is not allowed " - "to change the language", - self.build, "lookup Foo { language RUS; } Foo;") - def test_language_in_size_feature(self): self.assertRaisesRegex( FeatureLibError, diff --git a/Lib/fontTools/feaLib/testdata/bug501.fea b/Lib/fontTools/feaLib/testdata/bug501.fea new file mode 100644 index 000000000..58a4081fc --- /dev/null +++ b/Lib/fontTools/feaLib/testdata/bug501.fea @@ -0,0 +1,8 @@ +# https://github.com/behdad/fonttools/issues/501 +languagesystem DFLT dflt; +feature test { + lookup L { + script grek; + pos T 100; + } L; +} test; diff --git a/Lib/fontTools/feaLib/testdata/bug501.ttx b/Lib/fontTools/feaLib/testdata/bug501.ttx new file mode 100644 index 000000000..33c3202e1 --- /dev/null +++ b/Lib/fontTools/feaLib/testdata/bug501.ttx @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +