Skip to content

Commit c0a53a7

Browse files
m4rc1efelipesanches
authored andcommitted
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)
1 parent b70b881 commit c0a53a7

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
Below are the noteworthy changes from each release.
22
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).
33

4-
## Upcoming release: 0.13.0 (2024-Aug-??)
4+
## Upcoming release: 0.13.0 (2024-Sep-??)
5+
### Changes to existing checks
6+
#### On the Universal profile
7+
- **[name/family_and_style_max_length"]:** Use nameID 16 (Typographic family name) to determine name length if it exists. (PR #4811)
8+
59
### Migration of checks
610
#### Moved from Fontwerk to OpenType profile
711
- **[opentype/weight_class_fvar]**: "Checking if OS/2 usWeightClass matches fvar."

Lib/fontbakery/checks/name.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,27 @@ def strip_ribbi(x):
157157
f" cause problems {reason}.",
158158
)
159159

160-
# name ID 1 + fvar instance name > 32 : FAIL : problems with Windows
160+
# name ID 1/16 + fvar instance name > 32 : FAIL : problems with Windows
161161
if "fvar" in ttFont:
162162
for instance in ttFont["fvar"].instances:
163163
for instance_name in get_name_entry_strings(
164164
ttFont, instance.subfamilyNameID
165165
):
166-
for family_name in get_name_entry_strings(
167-
ttFont, NameID.FONT_FAMILY_NAME
168-
):
166+
typo_family_names = {
167+
(r.platformID, r.platEncID, r.langID): r
168+
for r in ttFont["name"].names
169+
if r.nameID == 16
170+
}
171+
family_names = {
172+
(r.platformID, r.platEncID, r.langID): r
173+
for r in ttFont["name"].names
174+
if r.nameID == 1
175+
}
176+
for platform in family_names:
177+
if platform in typo_family_names:
178+
family_name = typo_family_names[platform].toUnicode()
179+
else:
180+
family_name = family_names[platform].toUnicode()
169181
full_instance_name = family_name + " " + instance_name
170182
if len(full_instance_name) > 32:
171183
yield FAIL, Message(

0 commit comments

Comments
 (0)