Export letters to a font



  • Hello,
    I managed to create a modular font in DrawBot by drawing curves and I was wondering if it is possible to somehow export them and create a font?

    Right now, I am using DrawBot to export a PDF, manually put the shapes into a font editor and then save it.

    It's not a lot of work, but I was wondering??

    Thank you!


  • admin

    All font related python packages necessary to build a font are embedded. Like fontParts, defcon to build .ufo files and fontTools to construct a binary font file.

    I would start with fontParts and using pens to draw in side a glyph. A drawBot BezierPath already acts like a pen.

    good luck!



  • @frederik Alright, I will try that. Thanks!


  • admin

    A small example with a pen saving to a ufo file

    from fontParts.world import RFont
    
    # create a font object
    myFont = RFont(showInterface=False)
    # create a glyph object
    myGlyph = myFont.newGlyph("a")
    # get the pen
    myPen = myGlyph.getPen()
    # draw into the pen, similar as a DrawBot BezierPath
    myPen.moveTo((100, 100))
    myPen.lineTo((100, 200))
    myPen.lineTo((200, 200))
    myPen.lineTo((200, 100))
    myPen.closePath()
    # using a bezierPath
    myPath = BezierPath()
    # draw into the bezierPath
    myPath.oval(10, 10, 50, 50)
    myPath.text("Hello World", (60, 10))
    # draw the bezierPath into the glyph pen
    myPath.drawToPen(myPen)
    # save the ufo
    myFont.save("path/to/save.ufo")
    
    # get a bezierPath
    path = BezierPath()
    # draw the glyph into the bezierPath
    myGlyph.draw(path)
    # draw the bezierPath
    drawPath(path)
    

    with DrawBot as a RoboFont extension you can also just draw into a glyph as a context, similar as drawing into a pdf, png, gif, ...

    # run this RoboFont with the DrawBot extension
    
    oval(10, 10, 100, 100)
    text("Hello World", (110, 10))
    
    
    # 'a(background).glyph'
    saveImage("a.glyph")
    

    Screen Shot 2018-12-24 at 11.14.40.png


Log in to reply