[voltLib] Accept COMPONENT glyph type

This commit is contained in:
Khaled Hosny 2019-01-24 13:55:53 +02:00
parent 55f48176f4
commit cd553debc3
2 changed files with 9 additions and 1 deletions

View File

@ -73,7 +73,7 @@ class Parser(object):
if self.next_token_ == "TYPE":
self.expect_keyword_("TYPE")
gtype = self.expect_name_()
assert gtype in ("BASE", "LIGATURE", "MARK")
assert gtype in ("BASE", "LIGATURE", "MARK", "COMPONENT")
components = None
if self.next_token_ == "COMPONENTS":
self.expect_keyword_("COMPONENTS")

View File

@ -77,6 +77,14 @@ class ParserTest(unittest.TestCase):
def_glyph.type, def_glyph.components),
("f_f", 320, None, "LIGATURE", 2))
def test_def_glyph_component(self):
[def_glyph] = self.parse(
'DEF_GLYPH "f.f_f" ID 320 TYPE COMPONENT END_GLYPH'
).statements
self.assertEqual((def_glyph.name, def_glyph.id, def_glyph.unicode,
def_glyph.type, def_glyph.components),
("f.f_f", 320, None, "COMPONENT", None))
def test_def_glyph_no_type(self):
[def_glyph] = self.parse(
'DEF_GLYPH "glyph20" ID 20 END_GLYPH'