Feature request: Clear Background from the Font tab

Is there a way to clear the background for the whole font? I tried Clear Background from the Font tab with all glyphs selected but it does not work. According to the API reference, it does not seem to be possible with Python either. It is a bit of a hassle to do Clear Background individually whenever I edit a glyph.

So, my request would be a feature that allows me to clear the background of all glyphs in the font (ideally, only for one master).

Another, related request: A simple command that allows me to remove all “extra” layers, i.e. those that are not a master. Looks like this would be possible via Python but it would be good to have as a built-in command (I don’t think it is my own peculiar way of working that requires this).

I would find these useful too, especially the latter.

What about the bracket layers. They should stay, right?

Yes, I would say so. Only the “backup” layers would be removed.

A simple command that allows me to remove all “extra” layers…

Agreed. I often create a lot of variations as I work and when I move to the next stage of the design it would be nice to wipe them out.

What about the bracket layers. They should stay, right?

Definitely!

Yes, there is. 1. Select all glyphs 2. Right-click > Copy glyph names. 3. Create a new empty font. 4. In the new font, Font > Generate Glyphs, paste, click Generate. 5. In the original font, with all glyphs still selected, Layers > Assign Background and pick the empty font as source. Ta-daa!

I already implemented it.

Ah, thanks!

I had tried Assign Background with an fresh font (i.e. most glyphs missing), which did not quite work. Not sure whether this is the ideal behaviour, though. When I use Assign Background on the whole font then I’d prefer if I could rely on the backgrounds in the font coming strictky from the specified font and not a mixture of sources.

Assign Background works only on selected Glyphs. So you need select all glyphs.

Yes but if the font I am assigning does not have that glyph then the background is kept, which I think is not good. Instead, it should be removed.

Btw, Rainer’s recipe does not remove the background from non-master layers.

I just found out that it can be done quite easily, though. Open the .glyphs file in a text editor and remove all (?m:background = {.*?}:wink: via grep.

Here is a Python script that removes all extra (i.e. associated) layers that do not contain a bracket:

https://www.dropbox.com/s/dxbysmgwno47j3g/remove%20extra%20layers.py

Place in the scripts folder (just press Cmd-Shift-Y while in Glyphs).

Works well for me but use at your own risk.

Tim: put it on GitHub!

@TimAhrens can you please reupload the script?

It’s on Github now:

1 Like

Thanks a lot!