Skip to content

Commit

Permalink
Merge pull request #162 from googlefonts/opsz
Browse files Browse the repository at this point in the history
_fvar_dflts: move priority of opsz axis
  • Loading branch information
m4rc1e authored Feb 5, 2024
2 parents 0672deb + a323c17 commit 93ea957
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
16 changes: 9 additions & 7 deletions Lib/axisregistry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]:
Expand Down
1 change: 1 addition & 0 deletions tests/gen_test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tests/test_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 93ea957

Please sign in to comment.