Snippet : drawOnCurvePoints



  • This snippet allow to draw points of a BezierPath ignoring quadratic added nodes when exporting a font.

    def drawOnCurvePoints(bezierPath, size):
        for c in bezierPath:
            for p in c.points:
                i = c.points.index(p)
                try:
                    nextPoint = c.points[i+1]
                except:
                    nextPoint = c.points[0]
                previousPoint = c.points[i-1]
    
                if nextPoint in bezierPath.onCurvePoints and previousPoint in bezierPath.onCurvePoints :
                    oval(p[0]-size/2,p[1]-size/2, size ,size)
            
                if nextPoint[0] == p[0] and p in bezierPath.onCurvePoints:
                    oval(p[0]-size/2,p[1]-size/2, size ,size)
                
                if previousPoint[0] == p[0] and p in bezierPath.onCurvePoints:
                    oval(p[0]-size/2,p[1]-size/2, size ,size)
                
                if nextPoint[1] == p[1] and p in bezierPath.onCurvePoints:
                    oval(p[0]-size/2,p[1]-size/2, size ,size)
                
                if previousPoint[1] == p[1] and p in bezierPath.onCurvePoints:
                    oval(p[0]-size/2,p[1]-size/2, size ,size)
    

Log in to reply