Macro to print selected glyphs

Hi

Is there a simple macro I can use to print the glyphs that are selected

Could I then use this list of glyphs to select those glyphs in another font

for l in Glyphs.font.selectedLayers:
	print(l.parent.name)

Is it possible to now write a script and select glyphs

If this script returns ‘A B C D’ can I put that into a script to select those glyphs in the font.

I want to alter certain glyphs in a font and use that selection in other weights, its not a MM font

You might like the “Sync Tabs” plugin. You’ll find it in the plugin manager.

I have installed that plugin but can’t really see what its doing or how it can help

I would just like a script where I could add the glyphs and they are selected, I’ll keep looking

A script is not needed. Just make a Custom List Filter; that should do what you want.

Think Ive found it thank you

From the manual:
6.5.5 List Filters
You can define a list of glyphs to be displayed by choosing Add
List Filter from the gear menu in the bottom left of the Font
tab. By default, currently selected glyphs are added to the list
automatically. You can subsequently edit the list or paste a list
of glyph names. In Font view, once you apply a list filter, you
will see its glyphs in the order they are listed in.

List filters are an option but are not flexible enough.

Have you activated the “Sync Tabs” in the View menu? I think it is exactly what you are looking for.

But to answer your question:

	glyphs = []
	for name in names:
		glyph = Glyphs.font.glyphs[name]
		if glyph is not None:
			glyphs.append(glyph)
	Glyphs.font.selection = glyphs

selectGlyphsByName(["E", "G"])
2 Likes

@GeorgSeifert I copied your example but get the following error

 File "<string>", line 1
glyphs = []
^
IndentationError: unexpected indent

You need to check all the spaces and tabs at the beginning of all lines. Specially in that line and the ones before.