From 1079d1b8c65f4272f8b1a091ebafbe611060983b Mon Sep 17 00:00:00 2001 From: Yanone Date: Wed, 15 May 2024 15:35:18 +0200 Subject: [PATCH] case_mapping: Dynamically exclude incomplete Greek glyphs. 'case_mapping' check on Universal profile. (PR #4721) --- CHANGELOG.md | 1 + Lib/fontbakery/checks/glyphset.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d130d2c95..bf02f17001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Lib/fontbakery/checks/glyphset.py b/Lib/fontbakery/checks/glyphset.py index f20cdf6762..4fdbf85c89 100644 --- a/Lib/fontbakery/checks/glyphset.py +++ b/Lib/fontbakery/checks/glyphset.py @@ -23,7 +23,7 @@ ) 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, @@ -31,11 +31,7 @@ def check_case_mapping(ttFont): 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 @@ -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: