Merge pull request #1108 from anthrotype/fealib-raise-split-context
[feaLib] report error with multiple runs of marked ' glyphs
This commit is contained in:
commit
25fc8d92a3
@ -340,6 +340,14 @@ class Parser(object):
|
||||
self.expect_symbol_("'")
|
||||
hasMarks = marked = True
|
||||
if marked:
|
||||
if suffix:
|
||||
# makeotf also reports this as an error, while FontForge
|
||||
# silently inserts ' in all the intervening glyphs.
|
||||
# https://github.com/fonttools/fonttools/pull/1096
|
||||
raise FeatureLibError(
|
||||
"Unsupported contextual target sequence: at most "
|
||||
"one run of marked (') glyph/class names allowed",
|
||||
self.cur_token_location_)
|
||||
glyphs.append(gc)
|
||||
elif glyphs:
|
||||
suffix.append(gc)
|
||||
|
@ -1220,6 +1220,42 @@ class ParserTest(unittest.TestCase):
|
||||
self.assertEqual(sub.glyph, "f_f_i")
|
||||
self.assertEqual(sub.replacement, ("f", "f", "i"))
|
||||
|
||||
def test_split_marked_glyphs_runs(self):
|
||||
self.assertRaisesRegex(
|
||||
FeatureLibError,
|
||||
"Unsupported contextual target sequence",
|
||||
self.parse, "feature test{"
|
||||
" ignore pos a' x x A';"
|
||||
"} test;")
|
||||
self.assertRaisesRegex(
|
||||
FeatureLibError,
|
||||
"Unsupported contextual target sequence",
|
||||
self.parse, "lookup shift {"
|
||||
" pos a <0 -10 0 0>;"
|
||||
" pos A <0 10 0 0>;"
|
||||
"} shift;"
|
||||
"feature test {"
|
||||
" sub a' lookup shift x x A' lookup shift;"
|
||||
"} test;")
|
||||
self.assertRaisesRegex(
|
||||
FeatureLibError,
|
||||
"Unsupported contextual target sequence",
|
||||
self.parse, "feature test {"
|
||||
" ignore sub a' x x A';"
|
||||
"} test;")
|
||||
self.assertRaisesRegex(
|
||||
FeatureLibError,
|
||||
"Unsupported contextual target sequence",
|
||||
self.parse, "lookup upper {"
|
||||
" sub a by A;"
|
||||
"} upper;"
|
||||
"lookup lower {"
|
||||
" sub A by a;"
|
||||
"} lower;"
|
||||
"feature test {"
|
||||
" sub a' lookup upper x x A' lookup lower;"
|
||||
"} test;")
|
||||
|
||||
def test_substitute_from(self): # GSUB LookupType 3
|
||||
doc = self.parse("feature test {"
|
||||
" substitute a from [a.1 a.2 a.3];"
|
||||
|
4
tox.ini
4
tox.ini
@ -23,7 +23,7 @@ commands =
|
||||
nocov: pytest {posargs}
|
||||
|
||||
[testenv:htmlcov]
|
||||
basepython = {env:TOXPYTHON:python3.5}
|
||||
basepython = {env:TOXPYTHON:python3.6}
|
||||
deps =
|
||||
coverage>=4.3
|
||||
skip_install = true
|
||||
@ -44,7 +44,7 @@ commands =
|
||||
codecov --env TOXENV
|
||||
|
||||
[testenv:bdist]
|
||||
basepython = {env:TOXPYTHON:python3.5}
|
||||
basepython = {env:TOXPYTHON:python3.6}
|
||||
deps =
|
||||
setuptools
|
||||
wheel
|
||||
|
Loading…
x
Reference in New Issue
Block a user