Group Details Private

drafts

  • RE: Making a loop to save multiple GIFs

    now you are going in both direction with in increasing speed, while when you go back you to start fast and end slow:

    def linear(factor):
        return factor
    
    def easeIn(factor):
        return factor*factor
    
    def easeOut(factor):
        return factor * (2-factor)
    
    
    steps = 100
    
    blockWidth = width() / steps
    
    
    for func in [linear, easeIn, easeOut]:
        newPage(2000, 1000)
        for i in range(steps):
            factor = i / (steps-1)
            factor = func(factor)
            rect(0, 0, blockWidth, height() * factor)    
            translate(blockWidth, 0)    
        
        for i in range(steps):
            factor = i / (steps-1)
            # go the other way around
            factor = func(1 - factor)
            rect(0, 0, blockWidth, height() * factor)    
            translate(blockWidth, 0)   
    

    Screen Shot 2020-03-29 at 14.15.52.png

    posted in Tutorials
  • RE: Oval() point placement

    I don't know why but my wild guess is it has todo with drawing ovals at more extreme w, h ratios, when the points are on the extremes you will need a pushing point in the middle to nice curve back.

    @gferreira you method only works for circles...

    the drawBot RoboFont extension has points on the extremes, cause the context is type... see https://github.com/typemytype/drawBotRoboFontExtension/blob/master/DrawBot.roboFontExt/lib/glyphContext.py#L23

    see the big difference when the oval is getting thinner...

    def straightOval(x, y, w, h):
            c = 0.55
            hx = w * c * .5
            hy = h * c * .5
            path = BezierPath()
            path.moveTo((x + w * .5, y))
            path.curveTo((x + w * .5 + hx, y), (x + w, y + h * .5 - hy), (x + w, y + h * .5))
            path.curveTo((x + w, y + h * .5 + hy), (x + w * .5 + hx, y + h), (x + w * .5, y + h))
            path.curveTo((x + w * .5 - hx, y + h), (x, y + h * .5 + hy), (x, y + h * .5))
            path.curveTo((x, y + h * .5 - hy), (x + w * .5 - hx, y), (x + w * .5, y))
            path.closePath()
            drawPath(path)
            
    
    x, y, w, h = 10, 10, 8.0, 146.0
    
    
    oval(x, y, w, h)
    straightOval(x + w + 10, y, w, h)
    
    posted in General Discussion
  • RE: Oval() point placement

    hello @ryan,

    I dont’t know why the extremes are angled…

    here’s a way to get the desired result by modifying oval:

    def twist(func, angle):
        def wrapper(x, y, w, h):
            with savedState():
                translate(x + w/2, y + h/2)
                rotate(angle)
                func(-w/2, -h/2, w, h)
        return wrapper
    
    oval = twist(oval, 45)
    

    when working with BezierPath, it’s possible to rotate the shape:

    B = BezierPath()
    B.oval(x, y, w, h)
    B.rotate(45, (x + w/2, y + h/2))
    

    hope this helps!

    posted in General Discussion
  • RE: Manipulating points

    @michelangelo you can use DrawBot inside RoboFont with the DrawBot extension

    posted in General Discussion
  • RE: Manipulating points

    you can get point labels in RoboFont with:

    glyph = CurrentGlyph()
    
    for contour in glyph:
        for point in contour.points:
            print(point.labels)
    
    posted in General Discussion
  • RE: Manipulating points

    I dont know Glyhps 🙂 but you can always do this in RoboFont with point labels!!!

    posted in General Discussion
  • RE: Add anchor points?

    you can use the FlattenPen from fontPens.

    from fontPens.flattenPen import FlattenPen
    
    # create an empty path
    dest = BezierPath()
    # create flatten pen that will draw into the dest bezierPath
    pen = FlattenPen(dest, approximateSegmentLength=30, segmentLines=True)
    
    # draw into the flatten pen
    pen.moveTo((100, 100))
    pen.curveTo((100, 150), (150, 200), (200, 200))
    pen.endPath()
    
    # create an other path
    path = BezierPath()
    # draw an oval
    path.oval(200, 200, 200, 200)
    # draw the path with oval in the flatten pen
    path.drawToPen(pen)
    
    # set stroke and fill
    stroke(0)
    fill(None)
    # draw the dest
    drawPath(dest)
    

    to learn more about pens and how to use them see https://robofont.com/documentation/how-tos/using-pens/

    posted in General Discussion
  • RE: Cryptic error language in the pip/PyPi frontend

    this should be resolved in the latest update!!!

    posted in General Discussion
  • RE: RFont subclass not generating "otf"

    two things:

    why generate a binary and read the the binary back in? see f1.generate("otfcff", "f1.otf")

    Give you new font a unique name based on the interp_factor. The font familyName and styleName makes up the postScriptName which has to be unique to set a font in drawBot (and everywhere else). In your case the font familyName and styleName will be "None" "None". This is not good...

    posted in General Discussion
  • RE: Delay after drawing

    DrawBot has an abstract stack of "actions" which can be applied on different contexts. One context is your output: an animated gif. And there is always a drawBot context to create the preview pdf data.

    Using drawBot from the module helps in this case as @gferreira suggested.

    posted in General Discussion