SOLVED Font view not updating after adding to skipExportGlyphs

  • Hello,

    I update the lib entry of a font to add glyphs to “skipExportGlyphs” with a script. But after I add them, they don’t get the red cross in the bottom right corner like when I tick them individually to exclude during export. They do however end up in the list in the font info window.

    When I save the font, the crosses appear. How can I tell the font window that something has changed in the background?

    The code looks pretty much like this:

    font = CurrentFont()
    font_lib = font.lib.asDict()
    {font_lib.setdefault('public.skipExportGlyphs', []).append(glyph_name) for glyph_name in font.selectedGlyphNames}       

    Thanks in advance!

  • admin

    hello @benedikt,

    not sure I understand your code – why get the whole lib as a dict, why setdefault?

    I would write it like this:

    font = CurrentFont()
    # get the current list of skip export glyph names
    skipExportGlyphNames = font.lib.get('public.skipExportGlyphs', default=[])
    # add selected glyphs to the list
    skipExportGlyphNames += font.selectedGlyphNames
    # remove duplicates
    skipExportGlyphNames = list(set(skipExportGlyphNames))
    # store list back into the lib
    font.lib['public.skipExportGlyphs'] = skipExportGlyphNames

    this works fine in my tests, the red marks are updated automatically – please give it a try.


    ps: obj.update() is deprecated (old RF1/RoboFab syntax), use obj.changed() instead (new RF3/FontParts syntax). see RoboFab vs. FontParts APIs

  • Hey @gferreira,

    Thank you so much for the fast reply, your code works just as expected!