A good first thing to do is to check the python wrapper what it is doing under the hood.
But in this case, the python wrapper tried to abstract away too much:
#import <GlyphsCore/GSGlyphViewControllerProtocol.h>
GSFont *font = … // get the font
NSViewController<GSGlyphEditViewControllerProtocol> *controller;
controller = font.parent.windowController.activeEditViewController;
GSGlyph *glyph = [font glyphForName:@"A"];
UTF32Char Char = [font characterForGlyph:glyph];
[controller.graphicView insertText:[NSString stringWithChar:Char]];
for encoded glyphs, you can skip the glyphForName: > characterForGlyph: part and do:
@Georg, thank you for the answer. It works! But the character can only be added in the text view, at the positon of the cursor. Can it be implemented in non-text view, for example when the selection tool is activated?
Before that, [self.windowController addTabWithGlyphs:glyphs] works, but we won’t open a new tab.