LettError/MutatorMath

Support some sort of method to exclude glyphs from instances.

Closed this issue · 5 comments

In Superpolator it is possible to exclude specific glyphs from an instance. The glyphs are present in all calculations and festivities, they're just not written to the final UFO. For instance glyphs that play a role in rules.

Currently in MutatorMath's designspace format, when no further information is given, it is assumed all glyphs need to be generated. The only way to exclude glyphs is then to write all but one glyphs in the instance. This would add a lot of data to the .designspace file.

Proposal: an option that accepts a list of glyph names, and adds an element to the instance record that specifically excludes that glyph.

    <instances>
        <instance familyname="Bla" filename="Bla-Awesome.ufo" stylename="SoAwesome">
            <location>
                <dimension name="width" xvalue="394.344554" />
            </location>
            <!-- this would generate all glyphs except the 'm' -->
            <glyph name="m" ignore="1">
        </instance>
    </instances>

Maybe the mechanism that excludes glyphs from masters can also be used to exclude them in instances. I will investigate.

Could this be handled with a

for name in self.doNotWriteTheseGlyphs:
        if name in instanceObject:
            del instanceObject[name]

that happens during DesignSpaceDocumentReader. _readSingleInstanceElement if makeGlyphs:? That would let you handle it without getting too deep into the internals of swapping glyphs and all of the complex stuff. I guess it would need to go through groups and kerning as well.

Maybe this is a dumb idea...

I'll collect the glyph names that have a mute attribute. Then when the ufo is about to be saved, delete those glyphs from the ufo.
I really do not want to touch the kerning and groups at this stage, thinking that something upstream will be responsible. But maybe it should check anyway?

In the muting-issues branch there is a fix in instances.py. And a test that looks at this specific muting issue. Travis says something is failing so I will look into that.

Fixed. If there are no objections I will try to merge this branch into the master.