From 0f3b7b5b9947954a3bef41b27bdc82e8721686e3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 17 Jan 2023 08:35:19 -0700 Subject: [PATCH] [glyf] Add isVarComposite() --- Lib/fontTools/ttLib/tables/_g_l_y_f.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py index 64929af30..cf6a36808 100644 --- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py +++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py @@ -1090,6 +1090,13 @@ class Glyph(object): else: return self.numberOfContours == -1 + def isVarComposite(self): + """Test whether a glyph has components""" + if hasattr(self, "data") and self.data: + return struct.unpack(">h", self.data[:2])[0] == -2 + else: + return self.numberOfContours == -2 + def getCoordinates(self, glyfTable): """Return the coordinates, end points and flags