ttFont_test: add test for getGlyphID

This commit is contained in:
Cosimo Lupo 2023-03-10 11:37:07 +00:00
parent 1a202ab1be
commit d77c8901c8
No known key found for this signature in database
GPG Key ID: DF65A8A5A119C9A8

View File

@ -262,3 +262,13 @@ def test_font_normalizeLocation_no_VF():
ttf = TTFont()
with pytest.raises(TTLibError, match="Not a variable font"):
ttf.normalizeLocation({})
def test_getGlyphID():
font = TTFont()
font.importXML(os.path.join(DATA_DIR, "TestTTF-Regular.ttx"))
assert font.getGlyphID("space") == 3
assert font.getGlyphID("glyph12345") == 12345 # virtual glyph
with pytest.raises(KeyError):
font.getGlyphID("non_existent")