From 9b5017719d5a30ab3cda1b6fdaa83c2cbf5d5834 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Wed, 20 Jul 2022 12:22:26 +0100 Subject: [PATCH] Allow classify_glyphs to handle its classifying function returning more than one category --- Lib/ufo2ft/util.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/ufo2ft/util.py b/Lib/ufo2ft/util.py index 4fec5aac2..34f5d5405 100644 --- a/Lib/ufo2ft/util.py +++ b/Lib/ufo2ft/util.py @@ -294,11 +294,14 @@ def classifyGlyphs(unicodeFunc, cmap, gsub=None): glyphSets = {} neutralGlyphs = set() for uv, glyphName in cmap.items(): - key = unicodeFunc(uv) - if key is None: + key_or_keys = unicodeFunc(uv) + if key_or_keys is None: neutralGlyphs.add(glyphName) + elif isinstance(key_or_keys, (list, set)): + for key in key_or_keys: + glyphSets.setdefault(key, set()).add(glyphName) else: - glyphSets.setdefault(key, set()).add(glyphName) + glyphSets.setdefault(key_or_keys, set()).add(glyphName) if gsub is not None: if neutralGlyphs: