Legend:
Library
Module
Module type
Parameter
Class
Class type
A Contour is a collection of points. A contour may be either based on cubic or quadratic splines.
If based on cubic splines there should be either 0 or 2 off-curve points between every two on-curve points. If there are no off-curve points then we have a line between those two points. If there are 2 off-curve points we have a cubic bezier curve between the two end points.
If based on quadratic splines things are more complex. Again, two adjacent on-curve points yield a line between those points. Two on-curve points with an off-curve point between them yields a quadratic bezier curve. However if there are two adjacent off-curve points then an on-curve point will be interpolated between them. (This should be familiar to anyone who has read the truetype 'glyf' table docs).
For examples of what these splines can look like see the section on bezier curves.
A contour may be open in which case it is just a long wiggly line, or closed when it is more like a circle with an inside and an outside. Unless you are making stroked fonts all your contours should eventually be closed.
Contours may also be expressed in terms of Raph Levien's spiro points. This is an alternate representation for the contour, and is not always available (Only if fontforge.hasSpiro() is True. If available the spiro member will return a tuple of spiro control points, while assigning to this member will change the shape of the contour to match the new spiros.
Two contours may be compared to see if they describe similar paths.
Adds an line to the contour. If the optional third argument is given, the line will be added after the pos'th point, otherwise it will be at the end of the contour.
Adds an line to the contour. If the optional third argument is given, the line will be added after the pos'th point, otherwise it will be at the end of the contour.
Idem LineTo with float coords.
val cubicToCoord : cp1:coord->cp2:coord->pt:coord->?nth:int ->t-> unit
Idem LineTo with float coords.
Adds a cubic curve to the contour (requires Is_quadratic set to false). If the optional fourth argument is give, the line will be added after the pos'th point, otherwise it will be at the end of the contour.
val cubicTo :
cpx1:int ->cpy1:int ->cpx2:int ->cpy2:int ->x:int ->y:int ->?nth:int ->t->
unit
Adds a cubic curve to the contour (requires Is_quadratic set to false). If the optional fourth argument is give, the line will be added after the pos'th point, otherwise it will be at the end of the contour.
Idem cubicToCoord with int coords.
val quadraticToCoord : cp:coord->pt:coord->?nth:int ->t-> unit
Idem cubicToCoord with int coords.
Adds a quadratic curve to the contour (requires Is_quadratic set to true). If the optional third argument is give, the line will be added after the pos'th point, otherwise it will be at the end of the contour.
val quadraticTo : cpx:int ->cpy:int ->x:int ->y:int ->?nth:int ->t-> unit
Adds a quadratic curve to the contour (requires Is_quadratic set to true). If the optional third argument is give, the line will be added after the pos'th point, otherwise it will be at the end of the contour.
Idem quadraticToCoord with int coords.
val insertPtCoord : pt:coord->?onCurve:bool ->?nth:int ->t-> unit
Idem quadraticToCoord with int coords.
Adds point to the contour. If the optional third argument is give, the line will be added after the pos'th point, otherwise it will be at the end of the contour. The point may be either a point or a tuple with three members (x,y,on_curve)
val insertPt : x:int ->y:int ->?onCurve:bool ->?nth:int ->t-> unit
Adds point to the contour. If the optional third argument is give, the line will be added after the pos'th point, otherwise it will be at the end of the contour. The point may be either a point or a tuple with three members (x,y,on_curve)
Rotate the point list so that the pos'th point becomes the first point.
Returns whether the contour is drawn in a clockwise direction. A return value of -1 indicates that no consistant direction could be found (the contour self-intersects).
Returns whether the contour is drawn in a clockwise direction. A return value of -1 indicates that no consistant direction could be found (the contour self-intersects).
Reverse the order in which the contour is drawn (turns a clockwise contour into a counter-clockwise one). See also layer.correctDirection.
Removes the on-curve point a the given position and rearranges the other points to make the curve as similar to the original as possible. All of the listed position will be removed. See Also simplify.
Whether the contour should be interpretted as a set of quadratic or cubic splines. Setting this value has the side effect of converting the point list to the appropriate format.
Whether the contour should be interpretted as a set of quadratic or cubic splines. Setting this value has the side effect of converting the point list to the appropriate format.