Skip to content

Commit

Permalink
Allow classify_glyphs to handle its classifying function returning mo…
Browse files Browse the repository at this point in the history
…re than one category
  • Loading branch information
simoncozens committed Nov 2, 2022
1 parent 236096c commit 9b50177
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Lib/ufo2ft/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9b50177

Please sign in to comment.