Skip to content

Commit

Permalink
case_mapping: Dynamically exclude incomplete Greek glyphs.
Browse files Browse the repository at this point in the history
'case_mapping' check on Universal profile.

(PR #4721)
  • Loading branch information
yanone authored and felipesanches committed Sep 9, 2024
1 parent b54cfe9 commit 4ed04f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ A more detailed list of changes is available in the corresponding milestones for
## Upcoming release: 0.13.0 (2024-Sep-??)
### Changes to existing checks
#### On the Universal profile
- **[case_mapping]:** Dynamically exclude incomplete Greek glyphs (PR #4721)
- **[missing_small_caps_glyphs]:** Rewrote it from scratch, marked it as **experimental** (issue #4713)
- **[name/family_and_style_max_length"]:** Use nameID 16 (Typographic family name) to determine name length if it exists. (PR #4811)

Expand Down
13 changes: 8 additions & 5 deletions Lib/fontbakery/checks/glyphset.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@
)
def check_case_mapping(ttFont):
"""Ensure the font supports case swapping for all its glyphs."""
from fontbakery.utils import markdown_table
from fontbakery.utils import markdown_table, characters_per_script

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

# Font has incomplete legacy Greek coverage, so ignore Greek dynamically
# (minimal Greek coverage is 2x24=48 characters, so we assume incomplete
# if coverage is less than half of 48)
greek = characters_per_script(ttFont, "Greek")
if 0 < len(greek) < 24:
EXCEPTIONS.extend(greek)

missing_counterparts_table = []
cmap = ttFont["cmap"].getBestCmap()
for codepoint in cmap:
Expand Down

0 comments on commit 4ed04f9

Please sign in to comment.