RoboFontError: Glyph not in font

RoboFont Forums Help / General RoboFontError: Glyph not in font

This topic contains 1 reply, has 2 voices, and was last updated by  frederik 8 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3838

    joanca
    Participant

    I get an error now if a glyph is not in font, so it raises an Error intead of returning a boolean.

    if f[gname] in f:
        print gname
    else: #f[gname] not in f
        print "%s not in %s" %(gname, f)
    

    How should I do it in RoboFont? It worked this way with robofab.
    I just want to know if a glyph exists in a font.

    thanks

    #3839

    frederik
    Keymaster

    He

    This will also not work in robofab :)

    You can check if a glyphName is in the font:

    f = CurrentFont()
    
    gname = "test"
    
    if gname in f:
        print gname
    else: #f[gname] not in f
        print "%s not in %s" %(gname, f)
    

    good luck

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

You must be logged in to reply to this topic.