diff --git a/Lib/fontTools/feaLib/builder.py b/Lib/fontTools/feaLib/builder.py index 20c0b9969..10e1446c0 100644 --- a/Lib/fontTools/feaLib/builder.py +++ b/Lib/fontTools/feaLib/builder.py @@ -110,7 +110,8 @@ class Builder(object): for (script, lang, feature), lookups in self.features_.items() if feature == name] - if not feature: + # "aalt" does not have to specify its own lookups, but it might. + if not feature and name != "aalt": raise FeatureLibError("Feature %s has not been defined" % name, location) for script, lang, feature, lookups in feature: diff --git a/Lib/fontTools/feaLib/builder_test.py b/Lib/fontTools/feaLib/builder_test.py index db16ad76e..bf1619506 100644 --- a/Lib/fontTools/feaLib/builder_test.py +++ b/Lib/fontTools/feaLib/builder_test.py @@ -149,7 +149,7 @@ class BuilderTest(unittest.TestCase): def test_constructs(self): for name in ("Attach enum markClass language_required " "GlyphClassDef LigatureCaretByIndex LigatureCaretByPos " - "lookup lookupflag").split(): + "lookup lookupflag feature_aalt").split(): font = makeTTFont() addOpenTypeFeatures(self.getpath("%s.fea" % name), font) self.expect_ttx(font, self.getpath("%s.ttx" % name)) diff --git a/Lib/fontTools/feaLib/testdata/feature_aalt.fea b/Lib/fontTools/feaLib/testdata/feature_aalt.fea new file mode 100644 index 000000000..3e29cfc5d --- /dev/null +++ b/Lib/fontTools/feaLib/testdata/feature_aalt.fea @@ -0,0 +1,31 @@ +languagesystem DFLT dflt; + +feature aalt { + feature sups; + feature frac; + feature ordn; +} aalt; + +feature sups { + sub one by onesuperior; + sub two by twosuperior; + sub three by threesuperior; +} sups; + +feature frac { + sub one slash four by onequarter; + sub one slash two by onehalf; + sub three slash four by threequarters; +} frac; + +feature ordn { + sub [zero one two three four five six seven eight nine] [A a]' + by ordfeminine; + sub [zero one two three four five six seven eight nine] [O o]' + by ordmasculine; +} ordn; + +feature liga { + sub f i by fi; + sub f l by fl; +} liga; diff --git a/Lib/fontTools/feaLib/testdata/feature_aalt.ttx b/Lib/fontTools/feaLib/testdata/feature_aalt.ttx new file mode 100644 index 000000000..9fff95e8a --- /dev/null +++ b/Lib/fontTools/feaLib/testdata/feature_aalt.ttx @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +