When running a script ported from G3 to 4 it seems to run fine most of the times. However, on occasion, I am seeing this:
What is interesting is that I have no filters in the sidebar. I was actually wondering why my G3 filters didn’t get imported in G4, but didn’t think more of it. However, the naming of the error messages there seems to suggest they are “there”, just not valid and thus not displayed, and somehow the script run occasionally triggers them somehow?
Possibly related to this one.
I don’t think the script itself does anything (and does not consistently trigger this error — maybe it has to do with the glyphs that were selected when running it?). Anyway, in case it could matter:
# Rebuild selected glyphs from components
import os
from GlyphsApp import *
for g in [l.parent for l in Glyphs.font.selectedLayers]:
# G3 but doesnt work in G4
#is_cap = g.glyphInfo.category == "Letter" and g.glyphInfo.subCategory == "Uppercase"
is_cap = g.glyphInfo.category == "Letter" and g.glyphInfo.case == 1
base, suffix = os.path.splitext(g.name)
g.beginUndo()
if not g.glyphInfo.components:
print(f"No glyph info for {g}")
continue
for l in g.layers:
l.shapes = []
l.hints = []
l.anchors = []
for c in g.glyphInfo.components:
suffix_name = f"{c.name}{suffix}"
if suffix_name != c.name and suffix_name in Glyphs.font.glyphs:
l.shapes.append(GSComponent(suffix_name))
continue
if is_cap:
cap_name = f"{c.name}.case"
if cap_name in Glyphs.font.glyphs:
l.shapes.append(GSComponent(cap_name))
continue
if c.name in Glyphs.font.glyphs:
l.shapes.append(GSComponent(c.name))
else:
print(f"Missing component {c.name}")
g.endUndo()
g.color = 4

