Skip to content

Commit 9532556

Browse files
authored
fixes check_monospace to also work with CFF
* Extend test_check_monospace to fail with CFF * Fix "opentype/monospace": remove conditions "is_ttf" + remove "glyf" from required tables On the opentype profile. (issue #5030)
1 parent a2dc9ad commit 9532556

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ A more detailed list of changes is available in the corresponding milestones for
55
### Bugfixes
66
- fonttools==4.58.0 has been changed (PR #https://github.com/fonttools/fonttools/pull/3809/): It fixes duplicate names, therefore the test for the `unique_glyphnames`check was failing. (issue #5023)
77

8+
### On the opentype profile
9+
- **[check_monospace]:** Check CFF fonts as well: remove conditions "is_ttf" + remove "glyf" from required tables (issue #5030)
10+
11+
812
## 1.0.0 (2025-May-07)
913
- See also: https://github.com/fonttools/fontspector
1014

Lib/fontbakery/checks/opentype/monospace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def PANOSE_expected(family_type):
6767

6868
@check(
6969
id="opentype/monospace",
70-
conditions=["glyph_metrics_stats", "is_ttf"],
70+
conditions=["glyph_metrics_stats"],
7171
rationale="""
7272
There are various metadata in the OpenType spec to specify if a font is
7373
monospaced or not. If the font is not truly monospaced, then no monospaced
@@ -118,7 +118,7 @@ def check_monospace(ttFont, glyph_metrics_stats):
118118

119119
# Check for missing tables before indexing them
120120
missing_tables = False
121-
required = ["glyf", "hhea", "hmtx", "OS/2", "post"]
121+
required = ["hhea", "hmtx", "OS/2", "post"]
122122
for key in required:
123123
if key not in ttFont:
124124
missing_tables = True

tests/test_checks_opentype_name.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ def test_check_monospace(check):
191191
del ttFont["OS/2"]
192192
assert_results_contain(check(ttFont), FAIL, "lacks-table")
193193

194+
# --------------------------------------------
195+
# And now we test a CFF font:
196+
# --------------------------------------------
197+
ttFont = TTFont(TEST_FILE("source-sans-pro/OTF/SourceSansPro-Regular.otf"))
198+
assert_results_contain(
199+
check(ttFont), PASS, "good", "with a good non-monospace font..."
200+
)
201+
194202

195203
@check_id("opentype/name/match_familyname_fullfont")
196204
def test_check_name_match_familyname_fullfont(check):

0 commit comments

Comments
 (0)