From b8a33d0c7501bb61bbbe93085ea9a85d40bfce90 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 1 May 2019 18:30:49 +0100 Subject: [PATCH] instancer: drop STAT when varfont fully instanced varLib.mutator does the same. Ideally we would keep STAT if has any extra (inter-family) DesignAxis or it font was only partially instanced. We can improve on this later as needed. --- Lib/fontTools/varLib/instancer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/fontTools/varLib/instancer.py b/Lib/fontTools/varLib/instancer.py index f5b6c2dd2..91ddd006b 100644 --- a/Lib/fontTools/varLib/instancer.py +++ b/Lib/fontTools/varLib/instancer.py @@ -570,6 +570,15 @@ def instantiateVariableFont(varfont, axis_limits, inplace=False, optimize=True): instantiateFvar(varfont, axis_limits) + if "fvar" not in varfont and "STAT" in varfont: + # Drop the entire STAT table when the varfont is fully instanced (or keep it + # as is if only partially instanced). + # TODO(anthrotype) Only drop DesignAxis and corresponding AxisValue records + # for the pinned axes that were removed from fvar. STAT design axes may be a + # superset of fvar axes (e.g. can include axes for an entire family). + log.info("Dropping STAT table") + del varfont["STAT"] + return varfont