From c0a53a734cff0749ac233af0315aea573ca816d9 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Thu, 8 Aug 2024 16:26:07 +0100 Subject: [PATCH] name/family_and_style_max_length: Use typographic family name if present Use nameID 16 (Typographic family name) to determine name length if it exists - 'name_family_and_style_max_length' check; - Universal profile. (PR #4811) --- CHANGELOG.md | 6 +++++- Lib/fontbakery/checks/name.py | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1a0514863..8bdc27dce0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,11 @@ Below are the noteworthy changes from each release. A more detailed list of changes is available in the corresponding milestones for each release in the Github issue tracker (https://github.com/googlefonts/fontbakery/milestones?state=closed). -## Upcoming release: 0.13.0 (2024-Aug-??) +## Upcoming release: 0.13.0 (2024-Sep-??) +### Changes to existing checks +#### On the Universal profile + - **[name/family_and_style_max_length"]:** Use nameID 16 (Typographic family name) to determine name length if it exists. (PR #4811) + ### Migration of checks #### Moved from Fontwerk to OpenType profile - **[opentype/weight_class_fvar]**: "Checking if OS/2 usWeightClass matches fvar." diff --git a/Lib/fontbakery/checks/name.py b/Lib/fontbakery/checks/name.py index c2c7afb345..71463f114b 100644 --- a/Lib/fontbakery/checks/name.py +++ b/Lib/fontbakery/checks/name.py @@ -157,15 +157,27 @@ def strip_ribbi(x): f" cause problems {reason}.", ) - # name ID 1 + fvar instance name > 32 : FAIL : problems with Windows + # name ID 1/16 + fvar instance name > 32 : FAIL : problems with Windows if "fvar" in ttFont: for instance in ttFont["fvar"].instances: for instance_name in get_name_entry_strings( ttFont, instance.subfamilyNameID ): - for family_name in get_name_entry_strings( - ttFont, NameID.FONT_FAMILY_NAME - ): + typo_family_names = { + (r.platformID, r.platEncID, r.langID): r + for r in ttFont["name"].names + if r.nameID == 16 + } + family_names = { + (r.platformID, r.platEncID, r.langID): r + for r in ttFont["name"].names + if r.nameID == 1 + } + for platform in family_names: + if platform in typo_family_names: + family_name = typo_family_names[platform].toUnicode() + else: + family_name = family_names[platform].toUnicode() full_instance_name = family_name + " " + instance_name if len(full_instance_name) > 32: yield FAIL, Message(