RContour.insertPoint() on curve?
RafaŁ Buchner last edited by gferreira
Is there any example of the usage of
RContour.insertPoint()on the curves? (I cannot find any)
When I'm trying to do that myself, it creates strange bezier curves (I don't know if these are quadratic) with only one
you also need to insert the off curves next to the oncurve...
(traveling no example...)
RafaŁ Buchner last edited by
ok, Thanks @frederik!
, I figured it out!
RafaŁ Buchner last edited by RafaŁ Buchner
Here is my solution for everyone, who is interested in the problem.
I hope that this example is proper
g = CurrentGlyph() # drawing the shape with the pen pen = g.getPen() pen.moveTo((396, 371)) pen.curveTo((396, 508), (146, 510), (146, 371)) pen.closePath() g.changed() cA = g.contours.points hA = g.contours.points hB = g.contours.points # coordinates of the points after inserting the new point h1,h2,nc,h3,h4 = ( (396,440), (333,475), (270,475), (208,475), (146,440), ) # inserting the oncurve point g.contours.insertPoint(cA.index,nc,type="curve",smooth=True) # adjusting the handlas before the inserted oncurve point hA.x = h2 hA.y = h2 hB.x = h1 hB.y = h1 # inserting handles after the inserted oncurve point g.contours.insertPoint(cA.index,h3,type="offcurve") g.contours.insertPoint(cA.index,h4,type="offcurve")
thanks for your example!!