Modify glyph selection with script



  • i can't seem to modify a font's glyph selection using a script...

    CurrentFont().selection = ['A']
    f.update()
    

    returns

    Traceback (most recent call last):
      File "", line 1, in 
    AttributeError: can't set attribute
    

    and

    CurrentFont().selection.append('A')
    

    returns no error but makes no change to the selection, even after a CurrentFont().update()

    Maybe there is a reason this doesn't work, or another way to accomplish this?

    thanks!



  • in case it is helpful: it seems like the workaround you provided works with glyphs that contain outlines, but not with glyphs that only contain components (for example accents in my font)

    f = CurrentFont()
    f['aacute'].selected = True
    f['a'].selected = True
    

    the code above, run when all glyphs are shown, will select a but not aacute.



  • > The reason is not clear :)

    :-)

    Thank you!


  • admin

    there is a work around

    f = CurrentFont()

    g = f["a"]
    g.selected = True

    (works well when you haven't selected a smart list item, so all glyphs should be active, this bug will be solved too :)


  • admin

    The reason is not clear :)

    will be working in the next update


Log in to reply