How to add tags via scripting

Following the GutenTag handbook I am able to set tags using the someGlyph.setTags_(["caseable", "narrow", "top"]) example, which removes all existing tags and resets with the new tags.

I am running into trouble with adding tags. @FlorianPircher could you please provide an example of how to go about doing that?

I tried:

Font = Glyphs.font
someGlyph = Font.selectedLayers[0].parent
#someGlyph.setTags_(["TEST1"])
someGlyph.addTag_(["TEST2"])
#also tried this
someGlyph.addTag(["TEST3"])

but those don’t seem to be working.

When adding a tag, you don’t need to wrap the tag name in a list. Instead, pass the string directly to the list:

someGlyph.addTag_("TEST2")
# or
Layer.parent.tags += ["TEST2"]
1 Like

Instead of addTag_ you could use this:

Layer.parent.tags.append("TEST2")
2 Likes