[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
def add_subtable_break(self, location):
raise FeatureLibError(
log.warning(FeatureLibError(
'unsupported "subtable" statement for lookup type',
location
)
))
class AlternateSubstBuilder(LookupBuilder):

View File

@ -514,16 +514,17 @@ class BuilderTest(unittest.TestCase):
assert "GSUB" in font
def test_unsupported_subtable_break(self):
self.assertRaisesRegex(
FeatureLibError,
'unsupported "subtable" statement for lookup type',
self.build,
"feature test {"
" pos a 10;"
" subtable;"
" pos b 10;"
"} test;"
)
with self.assertLogs(level='WARNING') as logs:
self.build(
"feature test {"
" pos a 10;"
" subtable;"
" 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):
features = (