Skip to content

Commit

Permalink
Improved display of detected inconsistencies on metadata/familyname
Browse files Browse the repository at this point in the history
com.google.fonts/check/metadata/familyname
On the Google Fonts Profile.

(PR #4570)
  • Loading branch information
simoncozens authored and felipesanches committed Mar 5, 2024
1 parent ad3dfa5 commit 53265b2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 13 additions & 10 deletions Lib/fontbakery/checks/googlefonts/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, (
Expand Down

0 comments on commit 53265b2

Please sign in to comment.