Skip to content

Commit 5e5b8f6

Browse files
Fix typographic family name
'typographic_family_name' on Universal profile. Fix for supporting families without typographic family name. (PR #5012)
1 parent 6c0f42f commit 5e5b8f6

3 files changed

Lines changed: 55 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
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.3 (2025-Feb-??)
4+
## Upcoming release: 0.13.3 (2025-Apr-??)
5+
56
### Migration of checks
67
#### Moved from Universal to OpenType profile
78
- **[[opentype/unwanted_aat_tables]]:** AAT is as legitimate as OpenType and Apple ships and actively develop AAT fonts. Such check belongs to the OpenYype profile instead of the Universal profile. (issue #4991)
@@ -13,6 +14,7 @@ A more detailed list of changes is available in the corresponding milestones for
1314
### On the Universal profile
1415
- **[unwanted_tables]:** Remove checking for 'prop' because it is an AAT table. (issue #4989)
1516
- **[base_has_width]:** Examine non-mark glyphs rather than mark glyphs; ignore PUA. (issue #5007)
17+
- **[typographic_family_name]:** Fix for support families with RIBBI and non-RIBBI styles. (PR #5012)
1618

1719

1820
## 0.13.2 (2025-Feb-03)

Lib/fontbakery/checks/typographic_family_name.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from fontbakery.prelude import check, FAIL
1+
from fontbakery.prelude import check, FAIL, Message
22

33

44
@check(
@@ -15,11 +15,12 @@ def check_typographic_family_name(ttFonts):
1515
for ttFont in ttFonts:
1616
name_record = ttFont["name"].getName(16, 3, 1, 0x0409)
1717
if name_record is None:
18-
values.add("<no value>")
19-
else:
20-
values.add(name_record.toUnicode())
18+
name_record = ttFont["name"].getName(1, 3, 1, 0x0409)
19+
20+
values.add(name_record.toUnicode())
2121
if len(values) != 1:
22-
yield FAIL, (
22+
yield FAIL, Message(
23+
"incosistent-family-name",
2324
f"Name ID 16 (Typographic Family name) is not consistent "
24-
f"across fonts. Values found: {sorted(values)}"
25+
f"across fonts. Values found: {sorted(values)}",
2526
)

tests/test_checks_name.py

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,46 @@ def test_ttFont():
1818
return TTFont(TEST_FILE("selawik/Selawik-fvar-test-VTT.ttf"), lazy=True)
1919

2020

21+
@pytest.fixture
22+
def montserrat_ttFonts():
23+
paths = [
24+
TEST_FILE("montserrat/Montserrat-Black.ttf"),
25+
TEST_FILE("montserrat/Montserrat-BlackItalic.ttf"),
26+
TEST_FILE("montserrat/Montserrat-Bold.ttf"),
27+
TEST_FILE("montserrat/Montserrat-BoldItalic.ttf"),
28+
TEST_FILE("montserrat/Montserrat-ExtraBold.ttf"),
29+
TEST_FILE("montserrat/Montserrat-ExtraBoldItalic.ttf"),
30+
TEST_FILE("montserrat/Montserrat-ExtraLight.ttf"),
31+
TEST_FILE("montserrat/Montserrat-ExtraLightItalic.ttf"),
32+
TEST_FILE("montserrat/Montserrat-Italic.ttf"),
33+
TEST_FILE("montserrat/Montserrat-Light.ttf"),
34+
TEST_FILE("montserrat/Montserrat-LightItalic.ttf"),
35+
TEST_FILE("montserrat/Montserrat-Medium.ttf"),
36+
TEST_FILE("montserrat/Montserrat-MediumItalic.ttf"),
37+
TEST_FILE("montserrat/Montserrat-Regular.ttf"),
38+
TEST_FILE("montserrat/Montserrat-SemiBold.ttf"),
39+
TEST_FILE("montserrat/Montserrat-SemiBoldItalic.ttf"),
40+
TEST_FILE("montserrat/Montserrat-Thin.ttf"),
41+
TEST_FILE("montserrat/Montserrat-ThinItalic.ttf"),
42+
]
43+
return [TTFont(path) for path in paths]
44+
45+
46+
@pytest.fixture
47+
def cabin_ttFonts():
48+
paths = [
49+
TEST_FILE("cabin/Cabin-BoldItalic.ttf"),
50+
TEST_FILE("cabin/Cabin-Bold.ttf"),
51+
TEST_FILE("cabin/Cabin-Italic.ttf"),
52+
TEST_FILE("cabin/Cabin-MediumItalic.ttf"),
53+
TEST_FILE("cabin/Cabin-Medium.ttf"),
54+
TEST_FILE("cabin/Cabin-Regular.ttf"),
55+
TEST_FILE("cabin/Cabin-SemiBoldItalic.ttf"),
56+
TEST_FILE("cabin/Cabin-SemiBold.ttf"),
57+
]
58+
return [TTFont(path) for path in paths]
59+
60+
2161
@check_id("name_id_1")
2262
def test_check_name_id_1(check, test_ttFont):
2363
"""Font has a name with ID 1."""
@@ -46,15 +86,15 @@ def test_check_name_length_req(check, test_ttFont):
4686

4787

4888
@check_id("typographic_family_name")
49-
def test_check_typographic_family_name(check, test_ttFont):
89+
def test_check_typographic_family_name(check, cabin_ttFonts, montserrat_ttFonts):
5090
"""Typographic Family name consistency."""
5191

52-
family = [
53-
test_ttFont, # FIXME: This must be tested with more than a single font file!
54-
]
92+
family = montserrat_ttFonts
5593
assert_PASS(check(family), "with a good family...")
5694

57-
# TODO: test a FAIL case
95+
assert_results_contain(
96+
check([cabin_ttFonts, montserrat_ttFonts]), FAIL, "incosistent-family-name"
97+
)
5898

5999

60100
@check_id("name/char_restrictions")

0 commit comments

Comments
 (0)