Skip to content

Commit

Permalink
[TN] Fix weightclass check
Browse files Browse the repository at this point in the history
typenetwork/usweightclass
On the TypeNetwork profile.

(PR fonttools#4878)
  • Loading branch information
guidoferreyra authored and felipesanches committed Nov 1, 2024
1 parent 83966c8 commit 63432cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Below are the noteworthy changes from each release.
A more detailed list of changes is available in the corresponding milestones for each release in the Github issue tracker (https://github.com/googlefonts/fontbakery/milestones?state=closed).

## Upcoming release: 0.13.0 (a4?) (2024-Nov-??)
### Changes to existing checks
### On the TypeNetwork profile
- **[typenetwork/usweightclass]:** Fix weightclass check. (PR #4878)

### Deprecated checks
#### Removed from the OpenType profile
- **DEPRECATED - [opentype/dsig]:** Merged into **[unwanted_tables]** on the `Universal` profile. (issue #4865)
Expand Down
12 changes: 3 additions & 9 deletions Lib/fontbakery/checks/vendorspecific/typenetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def check_usweightclass(font, tn_expected_os2_weight):
"""Checking OS/2 usWeightClass."""
failed = False
expected_value = tn_expected_os2_weight["weightClass"]
weight_name = tn_expected_os2_weight["name"]
weight_name = tn_expected_os2_weight["name"].lower()
os2_value = font.ttFont["OS/2"].usWeightClass

fail_message = "OS/2 usWeightClass is '{}' when it should be '{}'."
Expand Down Expand Up @@ -705,25 +705,19 @@ def check_usweightclass(font, tn_expected_os2_weight):
"no-value", no_value_message.format(os2_value, weight_name)
)

elif "Thin" in weight_name.split(" "):
elif "thin" in weight_name.split(" "):
if os2_value not in expected_value:
failed = True
yield FAIL, Message(
"bad-value", fail_message.format(os2_value, expected_value)
)
if os2_value == 100:
failed = True
yield WARN, Message("warn-value", warn_message.format(os2_value, 250))

elif "ExtraLight" in weight_name.split(" "):
elif "extralight" in weight_name.split(" "):
if os2_value not in expected_value:
failed = True
yield FAIL, Message(
"bad-value", fail_message.format(os2_value, expected_value)
)
if os2_value == 200:
failed = True
yield WARN, Message("warn-value", warn_message.format(os2_value, 275))

elif os2_value != expected_value:
failed = True
Expand Down

0 comments on commit 63432cb

Please sign in to comment.