Checking for component objects.

RoboFont Forums Help / General Checking for component objects.

This topic contains 3 replies, has 3 voices, and was last updated by  qkeave 6 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5764

    qkeave
    Participant

    Another simple question, how do I check for components. Is it because they are “objects” that I’m running into problems?

    ex.

    if not f[i].components['<Component for K>']:
        f[i].appendComponent('K')
    
    #5765

    Jens K.
    Participant

    Something along these lines:

    component_names = [component.baseGlyph for component in f[i].components]
    if not "K" in component_names:
        f[i].appendComponent("K")
    
    #5766

    frederik
    Keymaster

    thanks Jens!

    #5769

    qkeave
    Participant

    Thank u Jens!

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

You must be logged in to reply to this topic.