RContour
class RContour()
convertToCubic(round=1)
Convert all curves to cubic curves.
Optionally a round value can be provided.
convertToQuadratic(round=1)
Convert all curves to quadratic curves.
Optionally a round value can be provided.
removeBPoint(bPoint, preserveCurve=False)
Remove BP point from contour.
Optionally preserveCurve can be enabled.
removeOverlap(round=1)
Perform a remove overlap on a contour.
Optionally a round value can be provided.
addObserver(observer, methodName, notification)
Add an observer object. that will receive notification for the given methodName.
destroyRepresentation(name, **kwargs)
Destroy the stored representation for name and optionally kwargs.
getRepresentation(name, **kwargs)
Get a representation by name.
Optionally arguments could be provided if the representation factory requires arguments.
undo(undoTitle='')
Capture the current state of the object and create a undo item in a with statement.
Optionally an undoTitle can be provided.
index
The index of the contour within the parent glyph’s contours.
contour.index
1
contour.index = 0
The value will always be a type-int.
selectedBPoints
A list of bPoints selected in the contour.
Getting selected bPoint objects:
for bPoint in contour.selectedBPoints:
... bPoint.move((10, 20))
Setting selected bPoint objects:
contour.selectedBPoints = someBPoints
Setting also supports bPoint indexes:
contour.selectedBPoints = [0, 2]
selectedPoints
A list of points selected in the contour.
Getting selected point objects:
for point in contour.selectedPoints:
... point.move((10, 20))
Setting selected point objects:
contour.selectedPoints = somePoints
Setting also supports point indexes:
contour.selectedPoints = [0, 2]
selectedSegments
A list of segments selected in the contour.
Getting selected segment objects:
for segment in contour.selectedSegments:
... segment.move((10, 20))
Setting selected segment objects:
contour.selectedSegments = someSegments
Setting also supports segment indexes:
contour.selectedSegments = [0, 2]
identifier
The unique identifier for the object.
This value will be an identifier or a None.
This attribute is read only.
object.identifier
'ILHGJlygfds'
To request an identifier if it does not exist use
object.getIdentifier()
appendBPoint(type=None, anchor=None, bcpIn=None, bcpOut=None, bPoint=None)
Append a bPoint to the contour.
appendPoint(position=None, type='line', smooth=False, name=None, identifier=None, point=None)
Append a point to the contour.
contourInside(otherContour)
Determine if otherContour is in the black or white of this contour.
contour.contourInside(otherContour)
True
contour must be a BaseContour.
drawPoints(pen)
Draw the contour’s outline data to the given type-point-pen.
contour.drawPoints(pointPen)
getIdentifierForPoint(point)
Create a unique identifier for and assign it to point.
If the point already has an identifier, the existing
identifier will be returned.
contour.getIdentifierForPoint(point)
'ILHGJlygfds'
point must be a BasePoint. The returned value
will be a identifier.
insertBPoint(index, type=None, anchor=None, bcpIn=None, bcpOut=None, bPoint=None)
Insert a bPoint at index in the contour.
insertPoint(index, position=None, type='line', smooth=False, name=None, identifier=None, point=None)
Insert a point into the contour.
insertSegment(index, type=None, points=None, smooth=False, segment=None)
Insert a segment into the contour.
isCompatible(other)
Evaluate interpolation compatibility with other.
compatible, report = self.isCompatible(otherContour)
compatible
False
compatible
[Fatal] Contour: [0] + [0]
[Fatal] Contour: [0] contains 4 segments | [0] contains 3 segments
[Fatal] Contour: [0] is closed | [0] is open
This will return a bool indicating if the contour is
compatible for interpolation with other and a
string of compatibility notes.
pointInside(point)
Determine if point is in the black or white of the contour.
contour.pointInside((40, 65))
True
point must be a coordinate.
removePoint(point, preserveCurve=False)
Remove the point from the contour.
point can be a point object or an index.
If preserveCurve is set to True an attempt
will be made to preserve the shape of the curve
if the environment supports that functionality.
removeSegment(segment, preserveCurve=False)
Remove segment from the contour.
If preserveCurve is set to True an attempt
will be made to preserve the shape of the curve
if the environment supports that functionality.
setStartSegment(segment)
Set the first segment on the contour. segment can be a segment object or an index.
moveBy(value)
Move the object.
obj.moveBy((10, 0))
value must be an iterable containing two
integer/float values defining the x and y
values to move the object by.
rotateBy(value, origin=None)
Rotate the object.
obj.rotateBy(45)
obj.rotateBy(45, origin=(500, 500))
value must be a integer/float values
defining the angle to rotate the object by. origin
defines the point at with the rotation should originate.
It must be a coordinate or None.
The default is (0, 0).
scaleBy(value, origin=None)
Scale the object.
obj.scaleBy(2.0)
obj.scaleBy((0.5, 2.0), origin=(500, 500))
value must be an iterable containing two
integer/float values defining the x and y
values to scale the object by. origin defines the
point at with the scale should originate. It must be
a coordinate or None. The default is
(0, 0).
skewBy(value, origin=None)
Skew the object.
obj.skewBy(11)
obj.skewBy((25, 10), origin=(500, 500))
value must be rone of the following:
- single
integer/floatindicating the value to skew the x direction by. - iterable cointaining type
integer/floatdefining the values to skew the x and y directions by.
origin defines the point at with the skew should
originate. It must be a coordinate or
None. The default is (0, 0).
transformBy(matrix, origin=None)
Transform the object.
obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))
matrix must be a transformation.
origin defines the point at with the transformation
should originate. It must be a coordinate
or None. The default is (0, 0).