RContour

class RContour()

selection

Return a list of selected points.

selected

Select the object.

wrapper(*args, **kwargs)

breakContour(point)

Break the contour at a given point. Point could also be the index.

changed()

Notifiy the object has changed.

extremePoints(round=1)

Add extreme points in the contour. Optionally a round value can be provided.

hasOverlap()

Return if the glyph has overlaps. If an overlap is found a list of intersection points will be returned.

join()

Join the contour, if the contour.open

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.

removePoint(point, preserveCurve=False)

Remove point from contour.

Optionally preserveCurve can be enabled.

removeSegment(segment, preserveCurve=False)

Remove segment from contour.

Optionally preserveCurve can be enabled.

updateSelection(sender)

Update the selection.

addObserver(observer, methodName, notification)

Add an observer object. that will receive notification for the given methodName.

getRepresentation(name, **kwargs)

Get a representation by name.

Optionally arguments could be provided if the representation factory requires arguments.

performUndo()

Create a undo item and add it the the undo manager.

prepareUndo(undoTitle='')

Save the current state of the object.

removeObserver(observer, notification)

Remove an observer object for a notification.

Inherits from subclass: fontParts.fontshell.contour.RContour

area

The area of the contour: A positive number or None.

bPoints

clockwise

Boolean indicating if the contour’s winding direction is clockwise.

font

The contour’s parent font.

glyph

The contour’s parent BaseGlyph.

index

The index of the contour within the ordered list of the parent glyph’s contours.

open

Boolean indicating if the contour is open.

points

segments

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]

copyAttributes

box

Deprecated Contour.box

naked()

appendBPoint(type, anchor, bcpIn=None, bcpOut=None)

Append a bPoint to the contour.

appendPoint(position, type='line', smooth=False, name=None, identifier=None)

Append a point to the contour.

appendSegment(type, points, smooth=False)

Append a segment 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.

copyData(source)

Subclasses may override this method. If so, they should call the super.

draw(pen)

Draw the contour with the given Pen.

drawPoints(pen)

Draw the contour with the given PointPen.

getIdentifier()

Create a new, unique identifier for and assign it to the contour. If the contour already has an identifier, the existing one should be returned.

getIdentifierForPoint(point)

Create a new, unique identifier for and assign it to the point. If the point already has an identifier, the existing one should be returned.

getParent()

This is a backwards compatibility method.

insertBPoint(index, type, anchor, bcpIn=None, bcpOut=None)

Insert a bPoint at index in the contour.

insertPoint(index, position, type='line', smooth=False, name=None, identifier=None)

Insert a point into the contour.

insertSegment(index, type, points, smooth=False)

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.

reverse()

Reverse the direction of the contour.

round()

Round coordinates in all points.

setStartSegment(segment)

Set the first segment on the contour. segment can be a segment object or an index.

moveBy(value)

Move the object.

>>> obj.transformBy((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.transformBy(45)
>>> obj.transformBy(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.transformBy(2.0)
>>> obj.transformBy((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/float indicating the value to skew the x direction by.
  • iterable cointaining type integer/float defining 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).

generateIdentifier()

generateIdentifierforPoint()

reverseContour()

setChanged()

update()

move(*args, **kwargs)

rotate(*args, **kwargs)

scale(*args, **kwargs)

skew(*args, **kwargs)

transform(*args, **kwargs)

translate(*args, **kwargs)

setParent(parent)

Last edited on 15/05/2018