From 81d528f01c8c115d29ff7549dfbbd115685b1d99 Mon Sep 17 00:00:00 2001 From: Yanone Date: Tue, 26 Sep 2023 16:29:25 +0200 Subject: [PATCH] Check for tuple instead of just oldName --- Lib/fontmake/instantiator.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Lib/fontmake/instantiator.py b/Lib/fontmake/instantiator.py index c3245071..fce4e028 100644 --- a/Lib/fontmake/instantiator.py +++ b/Lib/fontmake/instantiator.py @@ -168,17 +168,17 @@ def process_rules_swaps(rules, location, glyphNames): # I guess it should be, so that we can swap, and if it isn't, # then it's better to error out later when we try to swap, # instead of silently ignoring the rule here. - # Also checking for duplication of rules by oldName here: - oldName_exists = oldName in [swap[0] for swap in swaps] - if oldName_exists: + # Also checking for duplication of rules here: + pair = (oldName, newName) + swap_exists = pair in swaps + if swap_exists: logging.warning( - "Duplicate rule for %s in location %s: %s", - (oldName, newName), - location, - swaps[[swap[0] for swap in swaps].index(oldName)] + "Duplicate rule for %s in location %s", + pair, + location ) - if oldName in glyphNames and not oldName_exists: - swaps.append((oldName, newName)) + if oldName in glyphNames and not swap_exists: + swaps.append(pair) return swaps