From 0d53cfbb99aac5e8638fe85baf0e13d237cc04fe Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 26 Feb 2020 18:24:53 +0000 Subject: [PATCH] woff2_test: add test with CBDT/CBLC font without glyf/loca tables --- Tests/ttLib/woff2_test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Tests/ttLib/woff2_test.py b/Tests/ttLib/woff2_test.py index 10439bc5a..2651e8085 100644 --- a/Tests/ttLib/woff2_test.py +++ b/Tests/ttLib/woff2_test.py @@ -1199,6 +1199,24 @@ class WOFF2RoundtripTest(object): assert tmp.getvalue() == tmp2.getvalue() assert ttFont2.reader.flavorData.transformedTables == {"hmtx"} + def test_roundtrip_no_glyf_and_loca_tables(self): + ttx = os.path.join( + os.path.dirname(current_dir), "subset", "data", "google_color.ttx" + ) + ttFont = ttLib.TTFont() + ttFont.importXML(ttx) + + assert "glyf" not in ttFont + assert "loca" not in ttFont + + ttFont.flavor = "woff2" + tmp = BytesIO() + ttFont.save(tmp) + + tmp2, ttFont2 = self.roundtrip(tmp) + assert tmp.getvalue() == tmp2.getvalue() + assert ttFont.flavor == "woff2" + class MainTest(object):