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.baseGlyphproperty getter.- Returns:
A
strrepresenting the name of the base glyph, orNoneif the component does not belong to a layer. The value will be normalized withnormalizers.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, orNoneindicating 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.transformationproperty 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.baseGlyphproperty setter.- Parameters:
value –
- The name of the glyph to set as a
str. The value will have been normalized
- The name of the glyph to set as a
- 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.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.
- 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.transformationproperty 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.AbstractPenwith 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.AbstractPointPenwith 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.boundsproperty getter.- Returns:
- A
tupleof fourintorfloatvalues in the form
(x minimum, y minimum, x maximum, y maximum)representing the bounds of the component, orNoneif the component is empty. The value will be normalized withnormalizers.normalizeBoundingBox.
Note
Subclasses may override this method.
- A
- BaseComponent._get_index() int | None[source]¶
Get the index of the native contour.
This is the environment implementation of the
BaseComponent.indexproperty getter.- Returns:
An
intrepresenting the index of the component within the ordered list of parent glyph’s components, orNoneif the component does not belong to a glyph. The value will be normalized withnormalizers.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.offsetproperty 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.scaleproperty getter.- Returns:
A
tupleof twofloatitems representing the(x, y)scale of the component. The value will have been normalized withnormalizers.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:
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.
- 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
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.
- 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
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.
- 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.offsetproperty 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.scaleproperty setter.- Parameters:
value – The scale to set as a
listortupleofintorfloatitems representing the(x, y)scale of the component. The value will have been normalized withnormalizers.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:
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.
- 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:
matrix – The Transformation Matrix to apply. The value will be normalized with
normalizers.normalizeTransformationMatrix.**kwargs – Additional keyword arguments.
Note
Subclasses may override this method.