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.
This commit is contained in:
Cosimo Lupo 2019-05-01 18:30:49 +01:00
parent 8eed2a2ec0
commit b8a33d0c75
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642

View File

@ -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