Skip to content

Commit 21bccc5

Browse files
authored
Only check for a bold instance on fonts where the weight range extends to 700.
On the OpenType Profile com.google.fonts/check/varfont/bold_wght_coord (issue #4373)
1 parent e8c7c12 commit 21bccc5

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ A more detailed list of changes is available in the corresponding milestones for
1111
- **[com.google.fonts/check/varfont/duplexed_axis_reflow]:** yield FAILs per incorrect axis (message codes specifying axis); sort the list of bad glyphs (PR #4400)
1212
- **[com.google.fonts/check/legacy_accents]:** We changed our minds here, and removed the overide to FAIL on "legacy-accents-component", so it is back a mere WARN again, just like in the Universal Profile (issue #4425)
1313
- **[com.google.fonts/check/font_copyright]:** Accept date ranges. (issue #4386)
14+
#### On the OpenType Profile
15+
- **[com.google.fonts/check/varfont/bold_wght_coord]:** Only check for a bold instance on fonts where the weight range extends to 700. (issue #4373)
1416

1517

1618
## 0.10.9 (2024-Jan-12)

Lib/fontbakery/profiles/fvar.py

+5
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,13 @@ def com_google_fonts_check_varfont_bold_wght_coord(ttFont, bold_wght_coord):
190190
The variable font 'wght' (Weight) axis coordinate must be 700 on the 'Bold'
191191
instance.
192192
"""
193+
from .shared_conditions import wght_axis
193194

195+
wght = wght_axis(ttFont)
194196
if bold_wght_coord is None:
197+
if wght and wght.maxValue < 700:
198+
yield SKIP, Message("no-bold-weight", "Weight axis doesn't go up to bold")
199+
return
195200
yield FAIL, Message("no-bold-instance", '"Bold" instance not present.')
196201
elif bold_wght_coord == 700:
197202
yield PASS, "Bold:wght is 700."

Lib/fontbakery/profiles/shared_conditions.py

+8
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,14 @@ def grad_axis(ttFont):
376376
return axis
377377

378378

379+
@condition
380+
def wght_axis(ttFont):
381+
if "fvar" in ttFont:
382+
for axis in ttFont["fvar"].axes:
383+
if axis.axisTag == "wght":
384+
return axis
385+
386+
379387
def get_axis_tags_set(ttFont):
380388
return set(axis.axisTag for axis in ttFont["fvar"].axes)
381389

tests/profiles/fvar_test.py

+6
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ def test_check_varfont_bold_wght_coord():
275275
check(ttFont), FAIL, "wght-not-700", "with a bad Bold:wght coordinage (600)..."
276276
)
277277

278+
# Check we skip when we don't have a 700 weight.
279+
ttFont = TTFont("data/test/cabinvfbeta/CabinVFBeta.ttf")
280+
del ttFont["fvar"].instances[3]
281+
ttFont["fvar"].axes[0].maxValue = 600
282+
assert_results_contain(check(ttFont), SKIP, "no-bold-weight")
283+
278284

279285
def test_check_varfont_wght_valid_range():
280286
"""The variable font 'wght' (Weight) axis coordinate

0 commit comments

Comments
 (0)