Segment

Must Override

May Override

BaseSegment._getItem(index: int) BasePoint[source]

Get the native point at the specified index.

This is the environment implementation of BaseSegment.__getitem__.

Parameters:

index – The zero-based index of the point to retrieve as an int.

Returns:

The BasePoint instance located at the specified index.

Raises:

IndexError – If the specified index is out of range.

Note

Subclasses may override this method.

BaseSegment._get_base_offCurve() tuple[BasePoint, ...][source]
BaseSegment._get_index() int[source]

Get the index of the native segment.

This is the environment implementation of the BaseSegment.index property getter.

Returns:

An int representing the segment’s index within an ordered list of the parent contour’s segments, or None if the segment does not belong to a contour.

Note

Subclasses may override this method.

BaseSegment._get_offCurve() tuple[BasePoint, ...][source]

Get the off-curve points in the native segment.

This is the environment implementation of the BaseSegment.offCurve property getter.

Returns:

An off-curve BasePoint instance or None.

Note

Subclasses may override this method.

BaseSegment._get_onCurve() BasePoint | None[source]

Get the on-curve point in the native segment.

This is the environment implementation of the BaseSegment.onCurve property getter.

Returns:

An on-curve BasePoint instance or None.

Note

Subclasses may override this method.

BaseSegment._get_points() tuple[BasePoint, ...][source]

Get a list of all points in the native segment.

This is the environment implementation of the BaseSegment.points property getter.

Returns:

A tuple of :class`BasePoints`.

Note

Subclasses may override this method.

BaseSegment._get_smooth() bool[source]

Get the native segment’s smooth state.

This is the environment implementation of the BaseSegment.smooth property getter.

Returns:

True if the segment is smooth, False if it is sharp. The value will have been normalized with normalizers.normalizeBoolean.

Note

Subclasses may override this method.

BaseSegment._get_type() str[source]

Get the native segment’s type.

This is the environment implementation of the BaseSegment.type property getter.

Returns:

A str representing the type of the segment. The value will have been normalized with normalizers.normalizeSegmentType.

Note

Subclasses may override this method.

BaseSegment._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.

BaseSegment._iterPoints(**kwargs: Any) Generator[BasePoint][source]

Return an iterator over the points in the native segment.

This is the environment implementation of BaseSegment.__iter__.

Returns:

An iterator over the BasePoint subclass instances belonging to the segment.

Note

Subclasses may override this method.

BaseSegment._len(**kwargs: Any) int[source]

Return the number of points in the native segment.

This is the environment implementation of BaseSegment.__len__.

Returns:

An int representing the number of BasePoint subclass instances belonging to the segment.

Note

Subclasses may override this method.

BaseSegment._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:

Note

Subclasses may override this method.

BaseSegment._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 int or a float. The value will have been normalized with normalizers.normalizeRotationAngle.

  • origin – The point at which the rotation should originate as a Coordinate or None. The value will have been normalized with normalizers.normalizeCoordinateTuple.

  • **kwargs – Additional keyword arguments.

Note

Subclasses may override this method.

BaseSegment._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 int or float, or a tuple or list of two int or float values representing the values (x, y). The value will have been normalized with normalizeTransformationScale.

  • origin – The point at which the scale should originate as a Coordinate or None. The value will have been normalized with normalizers.normalizeCoordinateTuple.

  • **kwargs – Additional keyword arguments.

Note

Subclasses may override this method.

BaseSegment._set_smooth(value: bool) None[source]

Set the native segment’s smooth state.

This is the environment implementation of the BaseSegment.smooth property setter.

Parameters:

value – The point’s smooth state as a bool. The value will have been normalized with normalizers.normalizeBoolean.

Note

Subclasses may override this method.

BaseSegment._set_type(newType: str) None[source]

Set the native segment’s type.

This is the environment implementation of the BaseSegment.type property setter.

Parameters:

newType – The segment type definition as a str. The value will have been normalized with normalizers.normalizeSegmentType.

Raises:

FontPartsError – If the segment does not belong to a contour.

Note

Subclasses may override this method.

BaseSegment._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:

Note

Subclasses may override this method.

BaseSegment._transformBy(matrix: list[int | float] | tuple[float, float, float, float, float, float], **kwargs: Any)[source]

Transform the native object according to the given matrix.

This is the environment implementation of TransformationMixin.transformBy.

Parameters:

Note

Subclasses may override this method.

BaseSegment.copyData(source: BaseObjectType) None

Copy data from source into the current object.

Note

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