Skip to content

Commit

Permalink
name/family_and_style_max_length: Use typographic family name if present
Browse files Browse the repository at this point in the history
Use nameID 16 (Typographic family name) to determine name length if it exists

- 'name_family_and_style_max_length' check;
- Universal profile.

(PR #4811)
  • Loading branch information
m4rc1e authored and felipesanches committed Sep 6, 2024
1 parent b70b881 commit c0a53a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
20 changes: 16 additions & 4 deletions Lib/fontbakery/checks/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit c0a53a7

Please sign in to comment.