diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f327b0ac..a0c3a54bc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ A more detailed list of changes is available in the corresponding milestones for - **[com.google.fonts/check/metadata/has_tags]:** Also fetch family tagging data from a second Google Sheet (Submissions from designers via form: https://forms.gle/jcp3nDv63LaV1rxH6) (PR #4576) - **[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. (PR #4570) + - **[com.google.fonts/check/metadata/copyright]:** 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 dc73c4b4ff..a23d2f0dde 100644 --- a/Lib/fontbakery/checks/googlefonts/metadata.py +++ b/Lib/fontbakery/checks/googlefonts/metadata.py @@ -1,8 +1,9 @@ +from collections import defaultdict import os from fontbakery.constants import NameID, RIBBI_STYLE_NAMES from fontbakery.prelude import check, Message, INFO, PASS, FAIL, WARN, SKIP, FATAL -from fontbakery.utils import exit_with_install_instructions +from fontbakery.utils import exit_with_install_instructions, show_inconsistencies from fontbakery.checks.googlefonts.glyphset import can_shape @@ -406,18 +407,17 @@ def com_google_fonts_check_metadata_includes_production_subsets( for all fonts in the family. """, ) -def com_google_fonts_check_metadata_copyright(family_metadata): +def com_google_fonts_check_metadata_copyright(family_metadata, config): """METADATA.pb: Copyright notice is the same in all fonts?""" - copyright_str = None - fail = False - for f in family_metadata.fonts: - if copyright_str and f.copyright != copyright_str: - fail = True - copyright_str = f.copyright - if fail: + copyrights = defaultdict(list) + for font in family_metadata.fonts: + copyrights[font.copyright].append(font.filename) + if len(copyrights) > 1: yield FAIL, Message( "inconsistency", - "METADATA.pb: Copyright field value is inconsistent across family", + "METADATA.pb: Copyright field value is inconsistent across the family.\n" + "The following copyright values were found:\n\n" + + show_inconsistencies(copyrights, config), ) else: yield PASS, "Copyright is consistent across family"