Skip to content

Commit

Permalink
com.google.fonts/check/mac_style: Skip if font.style is None
Browse files Browse the repository at this point in the history
 (PR #4552)
  • Loading branch information
khaledhosny authored Mar 4, 2024
1 parent 0f619e7 commit 064e919
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ A more detailed list of changes is available in the corresponding milestones for
#### On the Open Type Profile
- **[com.google.fonts/check/layout_valid_feature_tags]:** Updated the check to allow valid private-use feature tags. (issue #4544)
- **[com.google.fonts/check/varfont/family_axis_ranges]:** Updated the check to skip fonts without fvar tables. (issue #4554)
- **[com.google.fonts/check/mac_style]:** Skip if font style can not be determined. (issue #4349)


## 0.12.0a2 (2024-Feb-21)
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/checks/opentype/head.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def com_google_fonts_check_font_version(ttFont):
that describe whether a font is bold and/or italic must be coherent with the
actual style of the font as inferred by its filename.
""",
conditions=["style"],
proposal="legacy:check/131",
)
def com_google_fonts_check_mac_style(font):
Expand Down
9 changes: 8 additions & 1 deletion tests/checks/opentype/head_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from fontTools.ttLib import TTFont
import pytest

from fontbakery.status import WARN, FAIL, PASS
from fontbakery.status import WARN, FAIL, PASS, SKIP
from fontbakery.codetesting import (
assert_PASS,
assert_SKIP,
assert_results_contain,
CheckTester,
TEST_FILE,
Expand Down Expand Up @@ -194,6 +195,7 @@ def test_check_mac_style():
[MacStyle.BOLD, "Bold", PASS],
[MacStyle.BOLD, "Thin", "bad-BOLD"],
[MacStyle.BOLD | MacStyle.ITALIC, "BoldItalic", PASS],
[0, None, SKIP],
]

for macStyle_value, style, expected in test_cases:
Expand All @@ -204,6 +206,11 @@ def test_check_mac_style():
check(MockFont(ttFont=ttFont, style=style)),
"with macStyle:{macStyle_value} style:{style}...",
)
elif expected == SKIP:
assert_SKIP(
check(MockFont(ttFont=ttFont, style=style)),
"with macStyle:{macStyle_value} style:{style}...",
)
else:
assert_results_contain(
check(MockFont(ttFont=ttFont, style=style)),
Expand Down

0 comments on commit 064e919

Please sign in to comment.