Segment¶
Description¶
A Contour object is a list of segments. A Segment is a list of points with some special attributes and methods.
Overview¶
Parents¶
BaseSegment.contour |
The segment’s parent contour. |
BaseSegment.glyph |
The segment’s parent glyph. |
BaseSegment.layer |
The segment’s parent layer. |
BaseSegment.font |
The segment’s parent font. |
Identification¶
BaseSegment.index |
The index of the segment within the ordered list of the parent contour’s segments. |
Attributes¶
BaseSegment.type |
The segment type. |
BaseSegment.smooth |
Boolean indicating if the segment is smooth or not. |
Points¶
BaseSegment.points |
A list of points in the segment. |
BaseSegment.onCurve |
The on curve point in the segment. |
BaseSegment.offCurve |
The off curve points in the segment. |
Transformations¶
BaseSegment.transformBy |
Transform the object. |
BaseSegment.moveBy |
Move the object. |
BaseSegment.scaleBy |
Scale the object. |
BaseSegment.rotateBy |
Rotate the object. |
BaseSegment.skewBy |
Skew the object. |
Normalization¶
BaseSegment.round |
Round coordinates in all points. |
Environment¶
BaseSegment.naked |
Return the environment’s native object that has been wrapped by this object. |
BaseSegment.changed |
Tell the environment that something has changed in the object. |
Reference¶
Parents¶
-
BaseSegment.contour¶ The segment’s parent contour.
-
BaseSegment.glyph¶ The segment’s parent glyph.
-
BaseSegment.layer¶ The segment’s parent layer.
-
BaseSegment.font¶ The segment’s parent font.
Identification¶
-
BaseSegment.index¶ The index of the segment within the ordered list of the parent contour’s segments.
Attributes¶
-
BaseSegment.type¶ The segment type. The possible types are move, line, curve, qcurve.
-
BaseSegment.smooth¶ Boolean indicating if the segment is smooth or not.
Points¶
-
BaseSegment.points¶ A list of points in the segment.
-
BaseSegment.onCurve¶ The on curve point in the segment.
-
BaseSegment.offCurve¶ The off curve points in the segment.
Transformations¶
-
BaseSegment.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).
-
BaseSegment.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.
-
BaseSegment.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).
-
BaseSegment.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).
-
BaseSegment.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).
Environment¶
-
BaseSegment.naked()¶ Return the environment’s native object that has been wrapped by this object.
>>> loweLevelObj = obj.naked()
-
BaseSegment.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()