# RContour.insertPoint() on curve?

• Hey,
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 BCP.

• you also need to insert the off curves next to the oncurve...

(traveling no example...)

• ok, Thanks @frederik!
, I figured it out!

• 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[0].points[3]
hA = g.contours[0].points[2]
hB = g.contours[0].points[1]

# 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[0].insertPoint(cA.index,nc,type="curve",smooth=True)

# adjusting the handlas before the inserted oncurve point
hA.x = h2[0]
hA.y = h2[1]
hB.x = h1[0]
hB.y = h1[1]

# inserting handles after the inserted oncurve point
g.contours[0].insertPoint(cA.index,h3,type="offcurve")
g.contours[0].insertPoint(cA.index,h4,type="offcurve")

• thanks for your example!!

Looks like your connection to RoboFont ● Forum was lost, please wait while we try to reconnect.