]> git.ipfire.org Git - thirdparty/google/fonts.git/commitdiff
Don't delete name IDs which are shared with the STAT table
authorSimon Cozens <simon@simon-cozens.org>
Fri, 1 Jul 2022 09:28:00 +0000 (10:28 +0100)
committerSimon Cozens <simon@simon-cozens.org>
Fri, 1 Jul 2022 09:28:00 +0000 (10:28 +0100)
Lib/axisregistry/__init__.py

index 192cd683739c37626e9761bf6f6e7330fcd8451d..d8a27e19e42d3d6b4db8e2e1d44b3496e2c277a3 100644 (file)
@@ -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)