23
23
)
24
24
def check_case_mapping (ttFont ):
25
25
"""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
27
27
28
28
# These are a selection of codepoints for which the corresponding case-swap
29
29
# glyphs are missing way too often on the Google Fonts library,
30
30
# so we'll ignore for now:
31
31
EXCEPTIONS = [
32
32
0x0192 , # ƒ - Latin Small Letter F with Hook
33
33
0x00B5 , # µ - Micro Sign
34
- 0x03C0 , # π - Greek Small Letter Pi
35
34
0x2126 , # Ω - Ohm Sign
36
- 0x03BC , # μ - Greek Small Letter Mu
37
- 0x03A9 , # Ω - Greek Capital Letter Omega
38
- 0x0394 , # Δ - Greek Capital Letter Delta
39
35
0x0251 , # ɑ - Latin Small Letter Alpha
40
36
0x0261 , # ɡ - Latin Small Letter Script G
41
37
0x00FF , # ÿ - Latin Small Letter Y with Diaeresis
@@ -53,6 +49,13 @@ def check_case_mapping(ttFont):
53
49
0x026B , # ɫ - Latin Small Letter L with Middle Tilde
54
50
]
55
51
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
+
56
59
missing_counterparts_table = []
57
60
cmap = ttFont ["cmap" ].getBestCmap ()
58
61
for codepoint in cmap :
0 commit comments