RoboFontError: Glyph not in font



  • 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


  • admin

    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


Log in to reply