[feaLib] Make unsupported "subtable" a warning

AFDKO’s makeotf warns and ignores the statement, so do the same. I’m
abusing FeatureLibError() as a lazy way to keep reporting the location.
This commit is contained in:
Khaled Hosny 2019-02-26 19:53:49 +02:00
parent 10cad7be3a
commit 7d03e93e67
2 changed files with 13 additions and 12 deletions

View File

@ -1179,10 +1179,10 @@ class LookupBuilder(object):
return subtables return subtables
def add_subtable_break(self, location): def add_subtable_break(self, location):
raise FeatureLibError( log.warning(FeatureLibError(
'unsupported "subtable" statement for lookup type', 'unsupported "subtable" statement for lookup type',
location location
) ))
class AlternateSubstBuilder(LookupBuilder): class AlternateSubstBuilder(LookupBuilder):

View File

@ -514,16 +514,17 @@ class BuilderTest(unittest.TestCase):
assert "GSUB" in font assert "GSUB" in font
def test_unsupported_subtable_break(self): def test_unsupported_subtable_break(self):
self.assertRaisesRegex( with self.assertLogs(level='WARNING') as logs:
FeatureLibError, self.build(
'unsupported "subtable" statement for lookup type', "feature test {"
self.build, " pos a 10;"
"feature test {" " subtable;"
" pos a 10;" " pos b 10;"
" subtable;" "} test;"
" pos b 10;" )
"} test;" self.assertEqual(logs.output,
) ['WARNING:fontTools.feaLib.builder:<features>:1:32: '
'unsupported "subtable" statement for lookup type'])
def test_skip_featureNames_if_no_name_table(self): def test_skip_featureNames_if_no_name_table(self):
features = ( features = (