Skip to content

Commit

Permalink
Move varfont/bold_wght_coord to Universal profile
Browse files Browse the repository at this point in the history
googlefonts/varfont/bold_wght_coord from Google Fonts profile.
Renamed to varfont/bold_wght_coord

(PR #4938)
  • Loading branch information
felipesanches committed Dec 27, 2024
1 parent 592a41b commit 9a33924
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A more detailed list of changes is available in the corresponding milestones for
### Migration of checks
#### Moved from Google Fonts to Universal profile
- **[googlefonts/varfont/duplicate_instance_names]**: Renamed to **varfont/duplicate_instance_names** (PR #4937)

- **[googlefonts/varfont/bold_wght_coord]**: Renamed to **varfont/bold_wght_coord** (PR #4938)

### Deprecated checks
#### On the Universal Profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@


@check(
id="googlefonts/varfont/bold_wght_coord",
id="varfont/bold_wght_coord",
rationale="""
The OpenType spec's registered
design-variation tag 'wght' available at
https://docs.microsoft.com/en-gb/typography/opentype/spec/dvaraxistag_wght
does not specify a required value for the 'Bold' instance of a variable font.
But Dave Crossland suggested that we should enforce
a required value of 700 in this case (NOTE: a distinction
is made between "no bold instance present" vs "bold instance is present
but its wght coordinate is not == 700").
But Dave Crossland suggested that a required value of 700 should be enforced
in this case (NOTE: a distinction is made between "no bold instance present"
vs "bold instance is present but its wght coordinate is not == 700").
""",
conditions=["is_variable_font", "has_wght_axis"],
proposal="https://github.com/fonttools/fontbakery/issues/1707",
Expand Down
2 changes: 1 addition & 1 deletion Lib/fontbakery/legacy_checkids.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
"com.google.fonts/check/STAT": "googlefonts/STAT/compulsory_axis_values",
"com.google.fonts/check/unitsperem_strict": "googlefonts/unitsperem",
"com.google.fonts/check/os2/use_typo_metrics": "googlefonts/use_typo_metrics",
"com.google.fonts/check/varfont/bold_wght_coord": "googlefonts/varfont/bold_wght_coord",
"com.google.fonts/check/varfont/generate_static": "googlefonts/varfont/generate_static",
"com.google.fonts/check/varfont/has_HVAR": "googlefonts/varfont/has_HVAR",
"com.google.fonts/check/vendor_id": "googlefonts/vendor_id",
Expand Down Expand Up @@ -324,6 +323,7 @@
"com.google.fonts/check/aat": "unwanted_aat_tables",
"com.google.fonts/check/unwanted_tables": "unwanted_tables",
"com.google.fonts/check/valid_glyphnames": "valid_glyphnames",
"com.google.fonts/check/varfont/bold_wght_coord": "varfont/bold_wght_coord",
"com.google.fonts/check/varfont/consistent_axes": "varfont/consistent_axes",
"com.google.fonts/check/varfont/duplexed_axis_reflow": "varfont/duplexed_axis_reflow",
"com.google.fonts/check/varfont/duplicate_instance_names": "varfont/duplicate_instance_names",
Expand Down
9 changes: 3 additions & 6 deletions Lib/fontbakery/profiles/adobefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
"adobefonts/unsupported_tables",
"adobefonts/STAT_strings",
],
"Google Fonts": [
"googlefonts/varfont/bold_wght_coord",
],
},
"overrides": {
"whitespace_glyphs": [
Expand Down Expand Up @@ -162,16 +159,16 @@
"reason": "Many CFF OpenType fonts in circulation are built with the Microsoft platform Full font name string identical to the PostScript FontName in the CFF Name INDEX. This practice was documented in the OpenType spec until version 1.5.",
}
],
"googlefonts/varfont/bold_wght_coord": [
"varfont/bold_wght_coord": [
{
"code": "no-bold-instance",
"status": "WARN",
"reason": "Adobe strongly recommends, but does not require having a Bold instance, and that instance should have coordinate 700 on the 'wght' axis.",
"reason": "Adobe strongly recommends, but does not require having a Bold instance.",
},
{
"code": "wght-not-700",
"status": "WARN",
"reason": "Adobe strongly recommends, but does not require having a Bold instance, and that instance should have coordinate 700 on the 'wght' axis.",
"reason": "Adobe strongly recommends (but does not require) that instance should have coordinate 700 on the 'wght' axis.",
},
],
"opentype/fvar/regular_coords_correct": [
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/fontbureau.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"smart_dropout",
"stylisticset_description",
"typographic_family_name",
"varfont/bold_wght_coord",
"varfont/consistent_axes",
"varfont/duplexed_axis_reflow",
"varfont/duplicate_instance_names",
Expand Down
1 change: 0 additions & 1 deletion Lib/fontbakery/profiles/googlefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
"googlefonts/STAT/compulsory_axis_values",
"googlefonts/unitsperem",
"googlefonts/use_typo_metrics",
"googlefonts/varfont/bold_wght_coord",
"googlefonts/varfont/generate_static",
"googlefonts/varfont/has_HVAR",
"googlefonts/vendor_id",
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/microsoft.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"ufo_required_fields",
"ufo_unnecessary_fields",
"unwanted_aat_tables",
"varfont/bold_wght_coord",
"varfont/consistent_axes",
"varfont/duplexed_axis_reflow",
"varfont/duplicate_instance_names",
Expand Down
11 changes: 4 additions & 7 deletions Lib/fontbakery/profiles/typenetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
],
"Google Fonts": [
"googlefonts/family/equal_codepoint_coverage",
"googlefonts/varfont/bold_wght_coord",
"googlefonts/STAT/axis_order",
],
"Outline Checks": [
Expand Down Expand Up @@ -109,19 +108,17 @@
"reason": "This is a feature, not really needed to the font perform well.",
},
],
"googlefonts/varfont/bold_wght_coord": [
"varfont/bold_wght_coord": [
{
"code": "no-bold-instance",
"status": "WARN",
"reason": "Adobe and Type Network recommend, but do not require having a Bold "
"instance, and that instance should have coordinate 700 on the 'wght' axis.",
"reason": "Adobe and Type Network recommend, but do not require having a Bold instance.",
},
{
"code": "wght-not-700",
"status": "WARN",
"reason": "Adobe and Type Network recommend, but do not require having a "
"Bold instance, and that instance should have coordinate 700 on "
"the 'wght' axis.",
"reason": "Adobe and Type Network recommend (but do not require) that"
" instance should have coordinate 700 on the 'wght' axis.",
},
],
"opentype/fvar/regular_coords_correct": [
Expand Down
1 change: 1 addition & 0 deletions Lib/fontbakery/profiles/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"unwanted_aat_tables",
"unwanted_tables",
"valid_glyphnames",
"varfont/bold_wght_coord",
"varfont/consistent_axes",
"varfont/duplexed_axis_reflow",
"varfont/duplicate_instance_names",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_checks_adobefonts_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def test_check_override_trailing_spaces(check):
assert "Overridden" in msg


@check_id("googlefonts/varfont/bold_wght_coord", profile=adobefonts_profile)
@check_id("varfont/bold_wght_coord", profile=adobefonts_profile)
def test_check_override_bold_wght_coord(check):
"""Check that overriden tests yield WARN rather than FAIL."""

Expand Down
23 changes: 0 additions & 23 deletions tests/test_checks_googlefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3855,29 +3855,6 @@ def test_check_shape_languages(check):
assert_results_contain(check(test_font), FAIL, "failed-language-shaping")


@check_id("googlefonts/varfont/bold_wght_coord")
def test_check_varfont_bold_wght_coord(check):
"""The variable font 'wght' (Weight) axis coordinate
must be 700 on the 'Bold' instance."""

# Our reference varfont CabinVFBeta.ttf
# has a good Bold:wght coordinate
ttFont = TTFont("data/test/cabinvfbeta/CabinVFBeta.ttf")
assert_PASS(check(ttFont), "with a good Bold:wght coordinate...")

# We then change the value to ensure the problem is properly detected by the check:
ttFont["fvar"].instances[3].coordinates["wght"] = 600
assert_results_contain(
check(ttFont), FAIL, "wght-not-700", "with a bad Bold:wght coordinage (600)..."
)

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


@check_id("googlefonts/metadata/minisite_url")
def test_check_metadata_minisite_url(check):
"""Validate minisite_url field"""
Expand Down
31 changes: 31 additions & 0 deletions tests/test_checks_varfont_varfont_bold_wght_coord.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from conftest import check_id
from fontTools.ttLib import TTFont

from fontbakery.codetesting import (
assert_PASS,
assert_results_contain,
)
from fontbakery.status import FAIL, SKIP


@check_id("varfont/bold_wght_coord")
def test_check_varfont_bold_wght_coord(check):
"""The variable font 'wght' (Weight) axis coordinate
must be 700 on the 'Bold' instance."""

# Our reference varfont CabinVFBeta.ttf
# has a good Bold:wght coordinate
ttFont = TTFont("data/test/cabinvfbeta/CabinVFBeta.ttf")
assert_PASS(check(ttFont), "with a good Bold:wght coordinate...")

# We then change the value to ensure the problem is properly detected by the check:
ttFont["fvar"].instances[3].coordinates["wght"] = 600
assert_results_contain(
check(ttFont), FAIL, "wght-not-700", "with a bad Bold:wght coordinage (600)..."
)

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

0 comments on commit 9a33924

Please sign in to comment.