From 9a33924125b97012338dcb7a942d7f4c36db56c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Corr=C3=AAa=20da=20Silva=20Sanches?= Date: Fri, 27 Dec 2024 01:03:56 -0300 Subject: [PATCH] Move varfont/bold_wght_coord to Universal profile googlefonts/varfont/bold_wght_coord from Google Fonts profile. Renamed to varfont/bold_wght_coord (PR #4938) --- CHANGELOG.md | 2 +- .../varfont/bold_wght_coord.py | 9 +++--- Lib/fontbakery/legacy_checkids.py | 2 +- Lib/fontbakery/profiles/adobefonts.py | 9 ++---- Lib/fontbakery/profiles/fontbureau.py | 1 + Lib/fontbakery/profiles/googlefonts.py | 1 - Lib/fontbakery/profiles/microsoft.py | 1 + Lib/fontbakery/profiles/typenetwork.py | 11 +++---- Lib/fontbakery/profiles/universal.py | 1 + tests/test_checks_adobefonts_overrides.py | 2 +- tests/test_checks_googlefonts.py | 23 -------------- ..._checks_varfont_varfont_bold_wght_coord.py | 31 +++++++++++++++++++ 12 files changed, 48 insertions(+), 45 deletions(-) rename Lib/fontbakery/checks/{vendorspecific/googlefonts => }/varfont/bold_wght_coord.py (80%) create mode 100644 tests/test_checks_varfont_varfont_bold_wght_coord.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 23e42d4bee..67afa0b3ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Lib/fontbakery/checks/vendorspecific/googlefonts/varfont/bold_wght_coord.py b/Lib/fontbakery/checks/varfont/bold_wght_coord.py similarity index 80% rename from Lib/fontbakery/checks/vendorspecific/googlefonts/varfont/bold_wght_coord.py rename to Lib/fontbakery/checks/varfont/bold_wght_coord.py index 8e2d1aecb3..2144a40dea 100644 --- a/Lib/fontbakery/checks/vendorspecific/googlefonts/varfont/bold_wght_coord.py +++ b/Lib/fontbakery/checks/varfont/bold_wght_coord.py @@ -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", diff --git a/Lib/fontbakery/legacy_checkids.py b/Lib/fontbakery/legacy_checkids.py index e8ff5ad9f9..8ac00d29b3 100644 --- a/Lib/fontbakery/legacy_checkids.py +++ b/Lib/fontbakery/legacy_checkids.py @@ -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", @@ -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", diff --git a/Lib/fontbakery/profiles/adobefonts.py b/Lib/fontbakery/profiles/adobefonts.py index dcf32d97ec..a1c24be532 100644 --- a/Lib/fontbakery/profiles/adobefonts.py +++ b/Lib/fontbakery/profiles/adobefonts.py @@ -97,9 +97,6 @@ "adobefonts/unsupported_tables", "adobefonts/STAT_strings", ], - "Google Fonts": [ - "googlefonts/varfont/bold_wght_coord", - ], }, "overrides": { "whitespace_glyphs": [ @@ -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": [ diff --git a/Lib/fontbakery/profiles/fontbureau.py b/Lib/fontbakery/profiles/fontbureau.py index a39a082951..9a483d4a24 100644 --- a/Lib/fontbakery/profiles/fontbureau.py +++ b/Lib/fontbakery/profiles/fontbureau.py @@ -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", diff --git a/Lib/fontbakery/profiles/googlefonts.py b/Lib/fontbakery/profiles/googlefonts.py index 89d95e2af2..23118512ca 100644 --- a/Lib/fontbakery/profiles/googlefonts.py +++ b/Lib/fontbakery/profiles/googlefonts.py @@ -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", diff --git a/Lib/fontbakery/profiles/microsoft.py b/Lib/fontbakery/profiles/microsoft.py index 65b3a0f7b7..9bbcce6410 100644 --- a/Lib/fontbakery/profiles/microsoft.py +++ b/Lib/fontbakery/profiles/microsoft.py @@ -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", diff --git a/Lib/fontbakery/profiles/typenetwork.py b/Lib/fontbakery/profiles/typenetwork.py index 39984b33a8..e275dc2468 100644 --- a/Lib/fontbakery/profiles/typenetwork.py +++ b/Lib/fontbakery/profiles/typenetwork.py @@ -71,7 +71,6 @@ ], "Google Fonts": [ "googlefonts/family/equal_codepoint_coverage", - "googlefonts/varfont/bold_wght_coord", "googlefonts/STAT/axis_order", ], "Outline Checks": [ @@ -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": [ diff --git a/Lib/fontbakery/profiles/universal.py b/Lib/fontbakery/profiles/universal.py index 1f4f3d4c8c..f0ff231140 100644 --- a/Lib/fontbakery/profiles/universal.py +++ b/Lib/fontbakery/profiles/universal.py @@ -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", diff --git a/tests/test_checks_adobefonts_overrides.py b/tests/test_checks_adobefonts_overrides.py index f7a5e35d50..4e015ddb1a 100644 --- a/tests/test_checks_adobefonts_overrides.py +++ b/tests/test_checks_adobefonts_overrides.py @@ -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.""" diff --git a/tests/test_checks_googlefonts.py b/tests/test_checks_googlefonts.py index 50d1723988..e2d3f815f9 100644 --- a/tests/test_checks_googlefonts.py +++ b/tests/test_checks_googlefonts.py @@ -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""" diff --git a/tests/test_checks_varfont_varfont_bold_wght_coord.py b/tests/test_checks_varfont_varfont_bold_wght_coord.py new file mode 100644 index 0000000000..fce3da6f14 --- /dev/null +++ b/tests/test_checks_varfont_varfont_bold_wght_coord.py @@ -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")