diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c3a54bc2..f5c40266f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ A more detailed list of changes is available in the corresponding milestones for - **[com.google.fonts/check/metadata/broken_links]:** Added rationale. (PR #4570) - **[com.google.fonts/check/metadata/menu_and_latin]:** Added rationale. (PR #4570) - **[com.google.fonts/check/metadata/copyright]:** Added rationale and improve display of detected inconsistencies. (PR #4570) + - **[com.google.fonts/check/metadata/familyname]:** Added rationale and improve display of detected inconsistencies. (PR #4570) #### On the Universal profile - **DISABLED - [com.google.fonts/check/legacy_accents]:** This is one of the checks that we probably should run on the sources instead of binaries. (https://github.com/fonttools/fontbakery/issues/3959#issuecomment-1822913547) diff --git a/Lib/fontbakery/checks/googlefonts/metadata.py b/Lib/fontbakery/checks/googlefonts/metadata.py index a23d2f0dde..7a69f5bd78 100644 --- a/Lib/fontbakery/checks/googlefonts/metadata.py +++ b/Lib/fontbakery/checks/googlefonts/metadata.py @@ -427,20 +427,23 @@ def com_google_fonts_check_metadata_copyright(family_metadata, config): id="com.google.fonts/check/metadata/familyname", conditions=["family_metadata"], proposal="legacy:check/089", + rationale=""" + The METADATA.pb file includes a family name field for each font + file in the family. The value of this field should be the same + for all fonts in the family. + """, ) -def com_google_fonts_check_metadata_familyname(family_metadata): +def com_google_fonts_check_metadata_familyname(family_metadata, config): """Check that METADATA.pb family values are all the same.""" - name = "" - fail = False - for f in family_metadata.fonts: - if name and f.name != name: - fail = True - name = f.name - if fail: + names = defaultdict(list) + for font in family_metadata.fonts: + names[font.name].append(font.filename) + if len(names) > 1: yield FAIL, Message( "inconsistency", - "METADATA.pb: Family name is not the same" - ' in all metadata "fonts" items.', + "METADATA.pb: family name value is inconsistent across the family.\n" + "The following name values were found:\n\n" + + show_inconsistencies(names, config), ) else: yield PASS, (