Contour¶
Description¶
A Contour is a single path of any number of points. A Glyph usually consists of a couple of contours, and this is the object that represents each one. The Contour
object offers access to the outline matter in various ways. The parent of Contour
is usually Glyph
.
Overview¶
Copy¶
Copy this object into a new object of the same type. |
Parents¶
The contour's parent |
|
The contour's parent layer. |
|
The contour's parent font. |
Identification¶
The unique identifier for the object. This value will be an Identifier or a |
|
The index of the contour within the parent glyph's contours. |
Winding Direction¶
Boolean indicating if the contour's winding direction is clockwise. |
|
Reverse the direction of the contour. |
Queries¶
The bounds of the contour: (xMin, yMin, xMax, yMax) or None. |
|
Determine if |
Pens and Drawing¶
Draw the contour's outline data to the given type-pen. |
|
Draw the contour's outline data to the given type-point-pen. |
Segments¶
Append a segment to the contour. |
|
Insert a segment into the contour. |
|
Remove segment from the contour. |
|
Set the first segment on the contour. |
|
Automatically calculate and set the first segment in this contour. |
bPoints¶
Append a bPoint to the contour. |
|
Insert a bPoint at index in the contour. |
Points¶
Append a point to the contour. |
|
Insert a point into the contour. |
|
Remove the point from the contour. |
Transformations¶
Transform the object. |
|
Move the object. |
|
Scale the object. |
|
Rotate the object. |
|
Skew the object. |
Normalization¶
Round coordinates in all points to integers. |
Environment¶
Return the environment's native object that has been wrapped by this object. |
|
Tell the environment that something has changed in the object. |
Reference¶
Copy¶
- BaseContour.copy()¶
Copy this object into a new object of the same type. The returned object will not have a parent object.
Parents¶
- BaseContour.layer¶
The contour’s parent layer.
- BaseContour.font¶
The contour’s parent font.
Identification¶
- BaseContour.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()
- BaseContour.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.
Winding Direction¶
- BaseContour.clockwise¶
Boolean indicating if the contour’s winding direction is clockwise.
Queries¶
- BaseContour.bounds¶
The bounds of the contour: (xMin, yMin, xMax, yMax) or None.
- BaseContour.pointInside(point)[source]¶
Determine if
point
is in the black or white of the contour.>>> contour.pointInside((40, 65)) True
point
must be a Coordinate.
Pens and Drawing¶
Segments¶
- BaseContour.segments¶
- BaseContour.appendSegment(type=None, points=None, smooth=False, segment=None)[source]¶
Append a segment to the contour.
- BaseContour.insertSegment(index, type=None, points=None, smooth=False, segment=None)[source]¶
Insert a segment into the contour.
- BaseContour.removeSegment(segment, preserveCurve=False)[source]¶
Remove segment from the contour. If
preserveCurve
is set toTrue
an attempt will be made to preserve the shape of the curve if the environment supports that functionality.
bPoints¶
- BaseContour.bPoints¶
Points¶
- BaseContour.points¶
- BaseContour.appendPoint(position=None, type='line', smooth=False, name=None, identifier=None, point=None)[source]¶
Append a point to the contour.
Transformations¶
- BaseContour.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 Matrix. origin defines the point at with the transformation should originate. It must be a Coordinate or
None
. The default is(0, 0)
.
- BaseContour.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.
- BaseContour.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)
.
- BaseContour.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)
.
- BaseContour.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)
.
Normalization¶
Environment¶
- BaseContour.naked()¶
Return the environment’s native object that has been wrapped by this object.
>>> loweLevelObj = obj.naked()
- BaseContour.changed(*args, **kwargs)¶
Tell the environment that something has changed in the object. The behavior of this method will vary from environment to environment.
>>> obj.changed()