Say, I have a font with a light and an extrabold master, and intermediate semibold layers in some glyphs.
When I work on the intermediate semibold layers, I need to see some surrounding glyphs, of course, in the matching weight. I do this by setting up a semibold instance (a.k.a export), and selecting it in the preview bar. This way, I am literally seeing the intermediate layer(s), and I get the correct interpolations for those glyphs that do not need intermediate layers. When I work on a real master again, I switch back to the “—” instance.
It would be very convenient if the “—” instance automatically showed the interpolation matching the selected intermediate layer (think of is as being “almost a master”), for all visible glyphs. This would save a lot of switching between instances, in particular if I have many intermediate layers (and even the instances/exports wouldn’t be necessary). I can’t think of a scenario in which you wouldn’t want this behaviour.
from GlyphsApp import Glyphs
# from https://github.com/mekkablue/Glyphs-Scripts/blob/master/Interpolation/Other/Show%20next%20instance.py
font = Glyphs.font
previewingTab = font.currentTab
previewPanel = Glyphs.delegate().pluginForClassName_("GlyphsPreviewPanel")
# find coordinates:
selectedLayer = font.selectedLayers[0]
layerCoordinates = selectedLayer.attributes["coordinates"]
newInstanceNumber = 0
if layerCoordinates:
layerCoordinates = [layerCoordinates[axis.id] for axis in font.axes]
for instance in font.instances:
if instance.internalAxesValues == layerCoordinates:
break
newInstanceNumber += 1
else:
newInstance = GSInstance()
newInstance.name = "{" + ", ".join(map(str, layerCoordinates)) + "}"
newInstance.active = False
font.instances.append(newInstance)
font.instances[-1].internalAxesValues = layerCoordinates
previewingTab.setSelectedInstance_(newInstanceNumber)
Of course, it would be more convenient if this happened automatically, without having to call a script, and also without having to set up an explicit instance.