Modify glyph selection with script

RoboFont Forums Bugs Modify glyph selection with script

This topic contains 4 replies, has 2 voices, and was last updated by  djr 8 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1107

    djr
    Participant

    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!

    #1108

    frederik
    Keymaster

    The reason is not clear :)

    will be working in the next update

    #1109

    frederik
    Keymaster

    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 :)

    #1110

    djr
    Participant

    > The reason is not clear :)

    :-)

    Thank you!

    #1115

    djr
    Participant

    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’.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.