From 5b98dcb52f7459a08ec99a3953f03ebbd86d6f68 Mon Sep 17 00:00:00 2001 From: Frederik Berlaen Date: Fri, 15 Dec 2023 17:55:42 +0100 Subject: [PATCH] add support for /? and /! --- .../lib/designspaceEditor/locationPreview.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/DesignspaceEditor2.roboFontExt/lib/designspaceEditor/locationPreview.py b/DesignspaceEditor2.roboFontExt/lib/designspaceEditor/locationPreview.py index 0bebc87..0887773 100644 --- a/DesignspaceEditor2.roboFontExt/lib/designspaceEditor/locationPreview.py +++ b/DesignspaceEditor2.roboFontExt/lib/designspaceEditor/locationPreview.py @@ -238,7 +238,19 @@ def updatePreview(self): def inputCallback(self, sender): previewString = sender.get() self.operator.lib[previewTextLibKey] = previewString - glyphNames = splitText(previewString, self.operator.getCharacterMapping()) + glyphNames = [] + for glyphName in splitText(previewString, self.operator.getCharacterMapping()): + if glyphName == "/?": + currentGlyph = CurrentGlyph() + if currentGlyph is not None: + glyphNames.append(currentGlyph.name) + elif glyphName == "/!": + currentFont = CurrentFont() + if currentFont is not None: + glyphNames.extend(currentFont.selectedGlyphNames) + else: + glyphNames.append(glyphName) + possibleKerningPairs = ((side1, side2) for side1, side2 in zip(glyphNames[:-1], glyphNames[1:])) possibleKerningPairs = list(possibleKerningPairs) @@ -448,6 +460,9 @@ def designspaceEditorSourcesDidChangeSelection(self, notification): self.selectedSources = notification["selectedItems"] self.updatePreview() + def roboFontDidSwitchCurrentGlyph(self, notification): + self.updatePreview() + if __name__ == '__main__': designspace = CurrentDesignspace()