Contour¶
Must Override¶
- BaseContour._getPoint(index: int, **kwargs: Any) BasePoint[source]¶
Get the given point from the native contour.
- Parameters:
index – The index representing the
BaseBPointsubclass instance to retrieve as anint. The value will have been normalized withnormalizers.normalizeIndex.**kwargs – Additional keyword arguments.
- Returns:
A
BasePointsubclass instance.
Important
Subclasses must override this method.
- BaseContour._get_clockwise() bool[source]¶
Determine whether the native contour’s winding direction is clockwise.
This is the environment implementation of the
BaseContour.clockwiseproperty getter.- Returns:
Trueif the contour’s winding direction is clockwise, otherwiseFalse. The value will have been normalized withnormalizers.normalizeBoolean.- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseContour._get_identifier() str | None¶
Get the native object’s unique identifier.
This is the environment implementation of
IdentifierMixin.identifier.If the native object does not have an identifier assigned, one may be assigned with
IdentifierMixin.getIdentifier- Returns:
The unique identifier assigned to the object as a
str, orNoneindicating the object has no identifier.- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseContour._insertPoint(index: int, position: list[int | float] | tuple[int | float, int | float], type: str, smooth: bool, name: str | None, identifier: str | None, **kwargs: Any) None[source]¶
Insert the given point into the native contour.
This is the environment implementation of
BaseContour.insertPoint.- Parameters:
index – The
BasePoint.indexto be applied to the point as anint. The value will have been normalized withnormalizers.normalizeIndex.position – The position to be applied to the point as a Coordinate. The value will have been normalized with
normalizers.normalizeCoordinateTuple.type – The
BasePoint.typeto be applied to the point as astr. The value will have been normalized withnormalizers.normalizePointType.smooth – The
BasePoint.smoothstate to be applied to the point as abool. The value will have been normalized withnormalizers.normalizeBoolean.name – An optional
BasePoint.nameto be applied to the point as astr. The value will have been normalized withnormalizers.normalizePointNameidentifier – An optional
BasePoint.identifierto be applied to the point as astr. The value will have been normalized withnormalizers.normalizeIdentifier, but will not have been tested for uniqueness.**kwargs – Additional keyword arguments.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseContour._lenPoints(**kwargs: Any) int[source]¶
Return the number of points in the native contour.
- Parameters:
**kwargs – Additional keyword arguments.
- Returns:
An
intrepresenting the number ofBasePointsubclass instances belonging to the contour.
Important
Subclasses must override this method.
- BaseContour._removePoint(index: int, preserveCurve: bool, **kwargs: Any) None[source]¶
Remove the given point from the native contour.
This is the environment implementation of
BaseContour.removePoint.- Parameters:
index – The index representing the
BasePointsubclass instance to remove as anint. The value will have been normalized withnormalizers.normalizeIndex.preserveCurve – A
boolindicating whether to preserve the curve’s shape after the point is removed. The value will have been normalized withnormalizers.normalizeBoolean.**kwargs – Additional keyword arguments.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseContour._set_index(value: int) None[source]¶
Set the index of the contour.
This is the environment implementation of the
BaseContour.indexproperty setter.- Parameters:
value – The index to set as an
int. The value will have been normalized withnormalizers.normalizeIndex.- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
May Override¶
- BaseContour._appendBPoint(type: str, anchor: list[int | float] | tuple[int | float, int | float], bcpIn: list[int | float] | tuple[int | float, int | float], bcpOut: list[int | float] | tuple[int | float, int | float], **kwargs: Any) None[source]¶
Append the given bPoint to the native contour.
This is the environment implementation of
BaseContour.appendBPoint.- Parameters:
type – The
BaseBPoint.typeto be applied to the bPoint as astr. The value will have been normalized withnormalizers.normalizeBPointType.anchor – The
BaseBPoint.anchorto be applied to the bPoint as a Coordinate. The value will have been normalized withnormalizers.normalizeCoordinateTuple.bcpIn – The
BaseBPoint.bcpInto be applied to the bPoint as a Coordinate. The value will have been normalized withnormalizers.normalizeCoordinateTuple.bcpOut – An optional
BaseBPoint.bcpOutto be applied to the bPoint as a Coordinate. The value will have been normalized withnormalizers.normalizeCoordinateTuple.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._appendSegment(type: str, points: list[list[int | float] | tuple[int | float, int | float]] | tuple[list[int | float] | tuple[int | float, int | float], ...], smooth: bool, **kwargs: Any) None[source]¶
Append the given segment to the native contour.
This is the environment implementation of
BaseContour.appendSegment.- Parameters:
type – The
BaseSegment.typeto be applied to the segment as astr. The value will have been normalized withnormalizers.normalizeSegmentType.points – The
BaseSegment.pointsto be applied to the segment as alistortupleof Coordinate items. The value will have been normalized withnormalizers.normalizeCoordinateTuple.smooth – The
BaseSegment.smoothstate to be applied to the segment as abool. The value will have been normalized withnormalizers.normalizeBoolean.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._autoStartSegment(**kwargs: Any) None[source]¶
Automatically calculate and set the native contour’s first segment.
This is the environment implementation of
BaseContour.autoStartSegment.- Parameters:
**kwargs – Additional keyword arguments.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseContour._draw(pen: AbstractPen, **kwargs: Any) None[source]¶
Draw the native contour’s outline data to the given pen.
This is the environment implementation of
BaseContour.draw.- Parameters:
pen – The
fontTools.pens.basePen.AbstractPento which the outline data should be drawn.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._drawPoints(pen: AbstractPointPen, **kwargs: Any) None[source]¶
Draw the native contour’s outline data to the given point pen.
This is the environment implementation of
BaseContour.drawPoints.- Parameters:
pen – The
fontTools.pens.basePen.AbstractPointPento which the outline data should be drawn.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._get_bounds() tuple[float, float, float, float] | None[source]¶
Get the bounds of the contour.
This is the environment implementation of the
BaseContour.boundsproperty getter.- Returns:
A
tupleof fourintorfloatvalues in the form(x minimum, y minimum, x maximum, y maximum)representing the bounds of the contour, orNoneif the contour is open.
Note
Subclasses may override this method.
- BaseContour._get_index() int | None[source]¶
Get the index of the native contour.
This is the environment implementation of the
BaseContour.indexproperty getter.- Returns:
An
intrepresenting the contour’s index within an ordered list of the parent glyph’s contours, orNoneif the contour does not belong to a glyph. The value will be normalized withnormalizers.normalizeIndex.
Note
Subclasses may override this method.
- BaseContour._get_points() tuple[BasePoint, ...][source]¶
Get a list of all points in the native contour.
This is the environment implementation of the
BaseContour.pointsproperty getter.- Returns:
A
tupleof :class`BasePoint` subclass instances.
Note
Subclasses may override this method.
- BaseContour._get_segments() tuple[BaseSegment, ...][source]¶
Get the native contour’s segments.
This is the environment implementation of the
BaseContour.segmentsproperty getter.- Returns:
A
tupleofBaseSegmentsubclass instances.
Note
Subclasses may override this method.
- BaseContour._init(*args: Any, **kwargs: Any) None¶
Initialize the native object.
This is the environment implementation of
BaseObject.__init__.- Parameters:
*args – Any positional arguments.
**kwargs – Any keyword arguments.
Note
Subclasses may override this method.
- BaseContour._insertBPoint(index: int, type: str, anchor: list[int | float] | tuple[int | float, int | float], bcpIn: list[int | float] | tuple[int | float, int | float], bcpOut: list[int | float] | tuple[int | float, int | float], **kwargs: Any) None[source]¶
Insert the given bPoint into the native contour.
This is the environment implementation of
BaseContour.insertBPoint.- Parameters:
index – The
BaseBPoint.indexto be applied to the bPoint as anint. The value will have been normalized withnormalizers.normalizeIndex.type – An optional
BaseBPoint.typeto be applied to the bPoint as astr. The value will have been normalized withnormalizers.normalizeBPointType.anchor – The
BaseBPoint.anchorto be applied to the bPoint as a Coordinate. The value will have been normalized withnormalizers.normalizeCoordinateTuple.bcpIn – The
BaseBPoint.bcpInto be applied to the bPoint as a Coordinate. The value will have been normalized withnormalizers.normalizeCoordinateTuple.bcpOut – An optional
BaseBPoint.bcpOutto be applied to the bPoint as a Coordinate. The value will have been normalized withnormalizers.normalizeCoordinateTuple.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._insertSegment(index: int, type: str, points: list[list[int | float] | tuple[int | float, int | float]] | tuple[list[int | float] | tuple[int | float, int | float], ...], smooth: bool, **kwargs: Any) None[source]¶
Insert the given segment into the native contour.
This is the environment implementation of
BaseContour.insertSegment.- Parameters:
index – The
BaseSegment.indexto be applied to the segment as aint. The value will have been normalized withnormalizers.normalizeIndex.type – The
BaseSegment.typeto be applied to the segment as astr. The value will have been normalized withnormalizers.normalizeSegmentType.points – The
BaseSegment.pointsto be applied to the segment as alistortupleof Coordinate items. The value will have been normalized withnormalizers.normalizeCoordinateTuple.smooth – The
BaseSegment.smoothstate to be applied to the segment as abool. The value will have been normalized withnormalizers.normalizeBoolean.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._len__segments(**kwargs: Any) int[source]¶
Return the number of segments in the native contour.
This is the environment implementation of
BaseContour.__len__.- Returns:
An
intrepresenting the number ofBaseSegmentsubclass instances belonging to the contour.- Parameters:
**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._moveBy(value: list[int | float] | tuple[int | float, int | float], **kwargs: Any) None¶
Move the native object according to the given coordinates.
This is the environment implementation of
BaseObject.moveBy.- Parameters:
value – The x and y values to move the object by as a Coordinate. The value will have been normalized with
normalizers.normalizeTransformationOffset.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._pointInside(point: list[int | float] | tuple[int | float, int | float]) bool[source]¶
Check if point is within the filled area of the native contour.
This is the environment implementation of
BaseContour.pointInside.- Parameters:
point –
- The point to check as a Coordinate. The value
will have been normalized with
normalizers.normalizeCoordinateTuple.
Note
Subclasses may override this method.
- BaseContour._removeSegment(index: int, preserveCurve: bool, **kwargs: Any) None[source]¶
Remove the given segment from the native contour.
This is the environment implementation of
BaseContour.removeSegment.- Parameters:
index – The segment to remove as an
intrepresenting the segment’s index. The value will have been normalized withnormalizers.normalizeIndex.preserveCurve – A
boolindicating whether to preserve the curve’s shape after the segment is removed. Defaults toFalse. The value will have been normalized withnormalizers.normalizeBoolean.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._reverse(**kwargs) None[source]¶
Reverse the direction of the contour.
This is the environment implementation of
BaseContour.reverse.- Parameters:
**kwargs – Additional keyword arguments.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Important
Subclasses must override this method.
- BaseContour._rotateBy(value: float, origin: list[int | float] | tuple[int | float, int | float], **kwargs: Any) None¶
Rotate the native object by the specified value.
This is the environment implementation of
TransformationMixin.rotateBy.- Parameters:
value – The angle at which to rotate the object as an
intor afloat. The value will have been normalized withnormalizers.normalizeRotationAngle.origin – The point at which the rotation should originate as a Coordinate or
None. The value will have been normalized withnormalizers.normalizeCoordinateTuple.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._round(**kwargs: Any) None[source]¶
Round all point coordinates in the native contour to the nearest integer.
This is the environment implementation of
BaseContour.round.- Parameters:
**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._scaleBy(value: list[int | float] | tuple[float, float], origin: list[int | float] | tuple[int | float, int | float], **kwargs: Any) None¶
Scale the native object according to the given values.
This is the environment implementation of
BaseObject.scaleBy.- Parameters:
value – The value to scale the glyph by as a single
intorfloat, or atupleorlistof twointorfloatvalues representing the values(x, y). The value will have been normalized withnormalizeTransformationScale.origin – The point at which the scale should originate as a Coordinate or
None. The value will have been normalized withnormalizers.normalizeCoordinateTuple.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._setStartSegment(segmentIndex: int, **kwargs: Any) None[source]¶
Set the first segment in the native contour.
This is the environment implementation of
BaseContour.setStartSegment.- Parameters:
segmentIndex – An
intrepresenting the index of the segment to be set as the first instance in the contour.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._set_clockwise(value: bool) None[source]¶
Specify whether the native contour’s winding direction is clockwise.
This is the environment implementation of the
BaseContour.clockwiseproperty setter.- Parameters:
value – A
boolindicating the desired winding direction.Truesets the direction to clockwise, andFalseto counter-clockwise. The value will have been normalized withnormalizers.normalizeBoolean.
Note
Subclasses may override this method.
- BaseContour._skewBy(value: list[int | float] | tuple[float, float], origin: list[int | float] | tuple[int | float, int | float], **kwargs: Any) None¶
Skew the native object by the given value.
This is the environment implementation of
TransformationMixin.skewBy.- Parameters:
value – The value by which to skew the object as either a single
intorfloatcorresponding to the x direction, or atupleof twointorfloatvalues corresponding to the x and y directions. The value will have been normalized withnormalizers.normalizeTransformationSkewAngle.origin – The point at which the rotation should originate as a Coordinate or
None. The value will have been normalized withnormalizers.normalizeCoordinateTuple.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.
- BaseContour._transformBy(matrix: list[int | float] | tuple[float, float, float, float, float, float], **kwargs: Any) None[source]¶
Transform the contour according to the given matrix.
This is the environment implementation of
BaseContour.transformBy.- Parameters:
matrix – The Transformation Matrix to apply. The value will be normalized with
normalizers.normalizeTransformationMatrix.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.