[feaLib] fix check for redefined glyph between multiple markClass definitions (#803)
* [feaLib.ast] fix checking multiple markClass definitions don't redefine same glyphs
As pointed out by @mhosken, we are looking in the wrong list for glyphs
that have already been defined in a previous markClass definition.
With this patch, the current markClass.fea test case fails becuase it defines 'acute'
twice for the same @TOP_MARKS class:
fontTools.feaLib.error.FeatureLibError: Lib/fontTools/feaLib/testdata/markClass.fea:6:5: Glyph acute already defined at Lib/fontTools/feaLib/testdata/markClass.fea:3:1
Also see conversation at:
3b79d51755 (r94622074)
* feaLib/testdat/markClass.fea: remove duplicate 'acute' in @TOP_MARKS
Now the test pass, after 45c77b7
* [feaLib.builder_test] test case for redefined glyph in multiple markClass definitions
This commit is contained in:
parent
04c1c68d18
commit
cb94d6c4cd
@ -319,8 +319,8 @@ class MarkClass(object):
|
|||||||
assert isinstance(definition, MarkClassDefinition)
|
assert isinstance(definition, MarkClassDefinition)
|
||||||
self.definitions.append(definition)
|
self.definitions.append(definition)
|
||||||
for glyph in definition.glyphSet():
|
for glyph in definition.glyphSet():
|
||||||
if glyph in self.definitions:
|
if glyph in self.glyphs:
|
||||||
otherLoc = self.definitions[glyph].location
|
otherLoc = self.glyphs[glyph].location
|
||||||
raise FeatureLibError(
|
raise FeatureLibError(
|
||||||
"Glyph %s already defined at %s:%d:%d" % (
|
"Glyph %s already defined at %s:%d:%d" % (
|
||||||
glyph, otherLoc[0], otherLoc[1], otherLoc[2]),
|
glyph, otherLoc[0], otherLoc[1], otherLoc[2]),
|
||||||
|
@ -448,6 +448,13 @@ class BuilderTest(unittest.TestCase):
|
|||||||
self.check_fea2fea_file(
|
self.check_fea2fea_file(
|
||||||
"baseClass.feax", base="baseClass.fea", parser=testParser)
|
"baseClass.feax", base="baseClass.fea", parser=testParser)
|
||||||
|
|
||||||
|
def test_markClass_same_glyph_redefined(self):
|
||||||
|
self.assertRaisesRegex(
|
||||||
|
FeatureLibError,
|
||||||
|
"Glyph acute already defined",
|
||||||
|
self.build,
|
||||||
|
"markClass [acute] <anchor 350 0> @TOP_MARKS;"*2)
|
||||||
|
|
||||||
|
|
||||||
def generate_feature_file_test(name):
|
def generate_feature_file_test(name):
|
||||||
return lambda self: self.check_feature_file(name)
|
return lambda self: self.check_feature_file(name)
|
||||||
|
2
Lib/fontTools/feaLib/testdata/markClass.fea
vendored
2
Lib/fontTools/feaLib/testdata/markClass.fea
vendored
@ -3,7 +3,7 @@ languagesystem DFLT dflt;
|
|||||||
markClass [acute] <anchor 350 0> @TOP_MARKS;
|
markClass [acute] <anchor 350 0> @TOP_MARKS;
|
||||||
|
|
||||||
feature foo {
|
feature foo {
|
||||||
markClass [acute grave] <anchor 350 0> @TOP_MARKS;
|
markClass [grave] <anchor 350 0> @TOP_MARKS;
|
||||||
markClass cedilla <anchor 300 0> @BOTTOM_MARKS;
|
markClass cedilla <anchor 300 0> @BOTTOM_MARKS;
|
||||||
} foo;
|
} foo;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user