Component

Must Override

BaseComponent._decompose() None[source]

Decompose the native component.

This is the environment implementation of BaseComponent.decompose.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseComponent._get_baseGlyph() str | None[source]

Get the name of the glyph referenced by the native component.

This is the environment implementation of the BaseComponent.baseGlyph property getter.

Returns:

A str representing the name of the base glyph, or None if the component does not belong to a layer. The value will be normalized with normalizers.normalizeGlyphName.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseComponent._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, or None indicating the object has no identifier.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseComponent._get_transformation() tuple[float, float, float, float, float, float][source]

Get the native component’s transformation matrix.

This is the environment implementation of the BaseComponent.transformation property getter.

Returns:

A Transformation Matrix value representing the transformation matrix of the component. The value will be normalized with normalizers.normalizeTransformationMatrix.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseComponent._set_baseGlyph(value: str) None[source]

Set the name of the glyph referenced by the native component.

This is the environment implementation of the BaseComponent.baseGlyph property setter.

Parameters:

value

The name of the glyph to set as a str. The value

will have been normalized

with normalizers.normalizeGlyphName.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseComponent._set_index(value: int) None[source]

Set the index of the native contour.

This is the environment implementation of the BaseComponent.index property setter.

Parameters:

value – The index to set as an int. The value will have been normalized with normalizers.normalizeIndex.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

BaseComponent._set_transformation(value: list[int | float] | tuple[float, float, float, float, float, float]) None[source]

Set the native component’s transformation matrix.

This is the environment implementation of the BaseComponent.transformation property setter.

Parameters:

value – The Transformation Matrix to set. The value will have been normalized with normalizers.normalizeTransformationMatrix.

Raises:

NotImplementedError – If the method has not been overridden by a subclass.

Important

Subclasses must override this method.

May Override

BaseComponent._draw(pen: AbstractPen, **kwargs: Any) None[source]

Draw the native component with the given pen.

This is the environment implementation of BaseComponent.draw.

Parameters:
  • pen – The fontTools.pens.basePen.AbstractPen with which to draw the componnet.

  • **kwargs – Additional keyword arguments.

Note

Subclasses may override this method.

BaseComponent._drawPoints(pen: AbstractPointPen, **kwargs: Any) None[source]

Draw the native component with the given point pen.

This is the environment implementation of BaseComponent.draw.

Parameters:
  • pen – The fontTools.pens.pointPen.AbstractPointPen with which to draw the componnet.

  • **kwargs – Additional keyword arguments.

Note

Subclasses may override this method.

BaseComponent._get_bounds() tuple[float, float, float, float][source]

Get the bounds of the component.

This is the environment implementation of the BaseComponent.bounds property getter.

Returns:

A tuple of four int or float values

in the form (x minimum, y minimum, x maximum, y maximum) representing the bounds of the component, or None if the component is empty. The value will be normalized with normalizers.normalizeBoundingBox.

Note

Subclasses may override this method.

BaseComponent._get_index() int | None[source]

Get the index of the native contour.

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

Returns:

An int representing the index of the component within the ordered list of parent glyph’s components, or None if the component does not belong to a glyph. The value will be normalized with normalizers.normalizeIndex.

Note

Subclasses may override this method.

BaseComponent._get_offset() tuple[int | float, int | float][source]

Get the native component’s offset.

This is the environment implementation of the BaseComponent.offset property getter.

Returns:

A Coordinate representing the offset of the component. The value will be normalized with normalizers.normalizeTransformationOffset.

Note

Subclasses may override this method.

BaseComponent._get_scale() tuple[float, float][source]

Get the native component’s scale.

This is the environment implementation of the BaseComponent.scale property getter.

Returns:

A tuple of two float items representing the (x, y) scale of the component. The value will have been normalized with normalizers.normalizeComponentScale.

Note

Subclasses may override this method.

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

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

BaseComponent._pointInside(point: list[int | float] | tuple[int | float, int | float]) bool[source]

Check if point lies inside the filled area of the native component.

This is the environment implementation of BaseComponent.pointInside.

Parameters:

point – The point to check as a Coordinate. The value will have been normalized with normalizers.normalizeCoordinateTuple.

Returns:

bool.

Note

Subclasses may override this method.

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

BaseComponent._round() None[source]

Round the native compnent’s offset coordinates.

This is the environment implementation of BaseComponent.round.

Note

Subclasses may override this method.

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

BaseComponent._set_offset(value: list[int | float] | tuple[int | float, int | float]) None[source]

Set the native component’s offset.

This is the environment implementation of the BaseComponent.offset property setter.

Parameters:

value – The offset to set as a Coordinate. The value will have been normalized with normalizers.normalizeTransformationOffset.

Note

Subclasses may override this method.

BaseComponent._set_scale(value: list[int | float] | tuple[float, float]) None[source]

Set the native component’s scale.

This is the environment implementation of the BaseComponent.scale property setter.

Parameters:

value – The scale to set as a list or tuple of int or float items representing the (x, y) scale of the component. The value will have been normalized with normalizers.normalizeComponentScale.

Note

Subclasses may override this method.

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

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

Transform the component according to the given matrix.

This is the environment implementation of BaseComponent.transformBy.

Parameters:

Note

Subclasses may override this method.

BaseComponent.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.