Drawing glyphs from ufo file.



  • how to draw glyph of a UFO file in DrawBot outside RoboFont?
    So far I came up with this solution, but I don't know what to do next:

    from fontParts.world import *
    
    basepath = os.path.dirname(__file__)
    filepath = os.path.abspath(os.path.join(basepath, "..", "..", "UFOS/typeface-regular.ufo"))
    
    f = OpenFont(filepath)
    for g in f:
        newPage(1000,1000)
        p = g.getPen()
        # I don't know what should I put here
    

    command drawGlyph(g) doesn't work, and I imagine, that it should work only inside of RoboFont.

    Thanks for the help in advance



  • Hey,

    Until this is integrated in the standalone version of Drawbot (fingers crossed), you could have a look at how drawGlyph() is defined within the RF Extension and reuse some of the code for your script.



  • @rafalbuchner This should work:

    def drawGlyph(g):
        bez = BezierPath()
        g.draw(bez)
        drawPath(bez)
    


  • Delayed, but still: thanks guys 🙂 !!!