diff --git a/Lib/fontTools/ttLib/woff2.py b/Lib/fontTools/ttLib/woff2.py index 6be06be0a..02e273d2e 100644 --- a/Lib/fontTools/ttLib/woff2.py +++ b/Lib/fontTools/ttLib/woff2.py @@ -294,8 +294,9 @@ class WOFF2Writer(SFNTWriter): if self.sfntVersion == "OTTO": return - for tag in ("maxp", "head", "loca", "glyf"): - self._decompileTable(tag) + for tag in ("maxp", "head", "loca", "glyf", "fvar"): + if tag in self.tables: + self._decompileTable(tag) self.ttFont["glyf"].padding = padding for tag in ("glyf", "loca"): self._compileTable(tag) diff --git a/Tests/ttLib/woff2_test.py b/Tests/ttLib/woff2_test.py index cfc7b1bc3..0a89b8b43 100644 --- a/Tests/ttLib/woff2_test.py +++ b/Tests/ttLib/woff2_test.py @@ -1491,6 +1491,20 @@ class UShort255Test(unittest.TestCase): ) +class VarCompositeTest(unittest.TestCase): + def test_var_composite(self): + input_path = os.path.join(data_dir, "varc-ac00-ac01.ttf") + ttf = ttLib.TTFont(input_path) + ttf.flavor = "woff2" + out = BytesIO() + ttf.save(out) + + ttf = ttLib.TTFont(out) + ttf.flavor = None + out = BytesIO() + ttf.save(out) + + if __name__ == "__main__": import sys