feaLib.parser: raise meaningful error for substitution of multiple glyphs by multiple glyphs
This commit is contained in:
parent
29deb7e6fb
commit
94b51e7344
@ -749,6 +749,12 @@ class Parser(object):
|
||||
return self.ast.ReverseChainSingleSubstStatement(
|
||||
location, old_prefix, old_suffix, old, new)
|
||||
|
||||
if len(old) > 1 and len(new) > 1:
|
||||
raise FeatureLibError(
|
||||
'Direct substitution of multiple glyphs by multiple glyphs '
|
||||
'is not supported',
|
||||
location)
|
||||
|
||||
# GSUB lookup type 6: Chaining contextual substitution.
|
||||
assert len(new) == 0, new
|
||||
rule = self.ast.ChainContextSubstStatement(
|
||||
|
@ -1220,6 +1220,14 @@ class ParserTest(unittest.TestCase):
|
||||
self.assertEqual(sub.glyph, "f_f_i")
|
||||
self.assertEqual(sub.replacement, ("f", "f", "i"))
|
||||
|
||||
def test_substitute_multiple_by_mutliple(self):
|
||||
self.assertRaisesRegex(
|
||||
FeatureLibError,
|
||||
"Direct substitution of multiple glyphs by multiple glyphs "
|
||||
"is not supported",
|
||||
self.parse,
|
||||
"lookup MxM {sub a b c by d e f;} MxM;")
|
||||
|
||||
def test_split_marked_glyphs_runs(self):
|
||||
self.assertRaisesRegex(
|
||||
FeatureLibError,
|
||||
|
Loading…
x
Reference in New Issue
Block a user