From 2906e4043d92d044861d3b982091fdbc94f19cc2 Mon Sep 17 00:00:00 2001 From: ftCLI Date: Tue, 5 Nov 2024 17:39:57 +0100 Subject: [PATCH] Add test for reorderGlyphs function with CFF fonts --- Tests/ttLib/reorderGlyphs_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tests/ttLib/reorderGlyphs_test.py b/Tests/ttLib/reorderGlyphs_test.py index cfda2d285..02ac2f49d 100644 --- a/Tests/ttLib/reorderGlyphs_test.py +++ b/Tests/ttLib/reorderGlyphs_test.py @@ -59,6 +59,17 @@ def test_ttfont_reorder_glyphs(): assert list(reversed(old_coverage2)) == new_coverage2 +def test_reorder_glyphs_cff(): + font_path = DATA_DIR / "TestVGID-Regular.otf" + font = TTFont(str(font_path)) + ga = font.getGlyphOrder() + ga = list(reversed(ga)) + reorderGlyphs(font, ga) + + assert list(font["CFF "].cff.topDictIndex[0].CharStrings.charStrings.keys()) == ga + assert font["CFF "].cff.topDictIndex[0].charset == ga + + def test_reorder_glyphs_bad_length(caplog): font_path = DATA_DIR / "Test-Regular.ttf" font = TTFont(str(font_path))