Skip to content

Commit 4e3f48c

Browse files
yanonefelipesanches
authored andcommitted
case_mapping: Dynamically exclude incomplete Greek glyphs.
'case_mapping' check on Universal profile. (PR #4721)
1 parent 0c1f34b commit 4e3f48c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Lib/fontbakery/checks/glyphset.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,15 @@
2323
)
2424
def check_case_mapping(ttFont):
2525
"""Ensure the font supports case swapping for all its glyphs."""
26-
from fontbakery.utils import markdown_table
26+
from fontbakery.utils import markdown_table, characters_per_script
2727

2828
# These are a selection of codepoints for which the corresponding case-swap
2929
# glyphs are missing way too often on the Google Fonts library,
3030
# so we'll ignore for now:
3131
EXCEPTIONS = [
3232
0x0192, # ƒ - Latin Small Letter F with Hook
3333
0x00B5, # µ - Micro Sign
34-
0x03C0, # π - Greek Small Letter Pi
3534
0x2126, # Ω - Ohm Sign
36-
0x03BC, # μ - Greek Small Letter Mu
37-
0x03A9, # Ω - Greek Capital Letter Omega
38-
0x0394, # Δ - Greek Capital Letter Delta
3935
0x0251, # ɑ - Latin Small Letter Alpha
4036
0x0261, # ɡ - Latin Small Letter Script G
4137
0x00FF, # ÿ - Latin Small Letter Y with Diaeresis
@@ -53,6 +49,13 @@ def check_case_mapping(ttFont):
5349
0x026B, # ɫ - Latin Small Letter L with Middle Tilde
5450
]
5551

52+
# Font has incomplete legacy Greek coverage, so ignore Greek dynamically
53+
# (minimal Greek coverage is 2x24=48 characters, so we assume incomplete
54+
# if coverage is less than half of 48)
55+
greek = characters_per_script(ttFont, "Greek")
56+
if 0 < len(greek) < 24:
57+
EXCEPTIONS.extend(greek)
58+
5659
missing_counterparts_table = []
5760
cmap = ttFont["cmap"].getBestCmap()
5861
for codepoint in cmap:

0 commit comments

Comments
 (0)