From: Simon Cozens Date: Fri, 1 Jul 2022 09:28:00 +0000 (+0100) Subject: Don't delete name IDs which are shared with the STAT table X-Git-Tag: v0.3.3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d980533c1496babded6ce6e9feb6d397c3e2e007;p=thirdparty%2Fgoogle%2Ffonts.git Don't delete name IDs which are shared with the STAT table --- diff --git a/Lib/axisregistry/__init__.py b/Lib/axisregistry/__init__.py index 192cd68373..d8a27e19e4 100644 --- a/Lib/axisregistry/__init__.py +++ b/Lib/axisregistry/__init__.py @@ -320,9 +320,14 @@ def build_fvar_instances(ttFont, axis_dflts={}): name_table = ttFont["name"] style_name = name_table.getBestSubFamilyName() + # Protect name IDs which are shared with the STAT table + stat_nameids = [] + if "STAT" in ttFont: + stat_nameids = [av.ValueNameID for av in ttFont["STAT"].table.AxisValueArray.AxisValue] + # rm old fvar subfamily and ps name records for inst in fvar.instances: - if inst.subfamilyNameID not in [2, 17]: + if inst.subfamilyNameID not in [2, 17] + stat_nameids: name_table.removeNames(nameID=inst.subfamilyNameID) if inst.postscriptNameID not in [65535, 6]: name_table.removeNames(nameID=inst.postscriptNameID)