From e9711e33ec7be9b85e8a52dabe1b183d5b691176 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Mon, 5 Feb 2024 15:14:37 +0000 Subject: [PATCH 1/4] _fvar_dflts: move priority of opsz axis --- Lib/axisregistry/__init__.py | 8 ++++---- tests/test_names.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Lib/axisregistry/__init__.py b/Lib/axisregistry/__init__.py index 09f8a3024..9b4bdb35c 100644 --- a/Lib/axisregistry/__init__.py +++ b/Lib/axisregistry/__init__.py @@ -150,14 +150,14 @@ def _fvar_dflts(ttFont): res = OrderedDict() for a in ttFont["fvar"].axes: fallback = axis_registry.fallback_for_value(a.axisTag, a.defaultValue) - if fallback: + if a.axisTag == "opsz": + name = f"{int(a.defaultValue)}pt" + elided = True + elif fallback: name = fallback.name elided = fallback.value == axis_registry[ a.axisTag ].default_value and name not in ["Regular", "Italic", "14pt"] - elif a.axisTag == "opsz": - name = f"{int(a.defaultValue)}pt" - elided = False else: name = None elided = True # since we can't find a name for it, keep it elided diff --git a/tests/test_names.py b/tests/test_names.py index 32f2fbf93..a4e3b74e3 100644 --- a/tests/test_names.py +++ b/tests/test_names.py @@ -303,13 +303,13 @@ def _test_names(ttFont, expected): None, [], { - (1, 3, 1, 0x409): "Playfair 5pt SemiExpanded Light", + (1, 3, 1, 0x409): "Playfair SemiExpanded Light", (2, 3, 1, 0x409): "Regular", - (3, 3, 1, 0x409): "2.000;FTH;Playfair-5ptSemiExpandedLight", - (4, 3, 1, 0x409): "Playfair 5pt SemiExpanded Light", - (6, 3, 1, 0x409): "Playfair-5ptSemiExpandedLight", + (3, 3, 1, 0x409): "2.000;FTH;Playfair-SemiExpandedLight", + (4, 3, 1, 0x409): "Playfair SemiExpanded Light", + (6, 3, 1, 0x409): "Playfair-SemiExpandedLight", (16, 3, 1, 0x409): "Playfair", - (17, 3, 1, 0x409): "5pt SemiExpanded Light", + (17, 3, 1, 0x409): "SemiExpanded Light", }, ), ], From f4420c2d27a294442be27392f91965c4d4a9542a Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Mon, 5 Feb 2024 15:20:26 +0000 Subject: [PATCH 2/4] black --- Lib/axisregistry/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/axisregistry/__init__.py b/Lib/axisregistry/__init__.py index 9b4bdb35c..2b7d0567b 100644 --- a/Lib/axisregistry/__init__.py +++ b/Lib/axisregistry/__init__.py @@ -213,9 +213,11 @@ def build_stat(ttFont, sibling_ttFonts=[]): "name": fallback.name, "value": fallback.value, # include flags and linked values - "flags": 0x2 - if fallback.value == axis_registry[axis].default_value - else 0x0, + "flags": ( + 0x2 + if fallback.value == axis_registry[axis].default_value + else 0x0 + ), } ) if axis in LINKED_VALUES and fallback.value in LINKED_VALUES[axis]: From 7fac8253cd796a563251a6de95cb90380cc8199c Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Mon, 5 Feb 2024 15:23:00 +0000 Subject: [PATCH 3/4] update tox lint check --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9809c5c78..352ccb3ae 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ skip_install = true deps = -r test_requirements.txt commands = - black --check --diff --extend-exclude "_version.py" . + black --check --diff --extend-exclude "_version.py|axes*" . [testenv:coverage-report] skip_install = true From a323c170490d3374737a95f6e2228886df3a4740 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Mon, 5 Feb 2024 15:26:41 +0000 Subject: [PATCH 4/4] black tests --- tests/gen_test_data.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/gen_test_data.py b/tests/gen_test_data.py index 931637d24..0173b66c7 100644 --- a/tests/gen_test_data.py +++ b/tests/gen_test_data.py @@ -2,6 +2,7 @@ Regenerate ttx dumps. Run this is the axis registry files in Lib/axisregistry/data/*.textproto have been updated. """ + from fontTools.ttLib import TTFont from fontTools.misc.testTools import getXML, parseXML from glob import glob