bPoint

Description

The bPoint is a point object which mimics the old “Bezier Point” from RoboFog. It has attributes for bcpIn, anchor, bcpOut and type. The coordinates in bcpIn and bcpOut are relative to the position of the anchor. For instance, if the bcpIn is 20 units to the left of the anchor, its coordinates would be (-20,0), regardless of the coordinates of the anchor itself. Also: bcpIn will be (0,0) when it is “on top of the anchor”, i.e. when there is no bcp it will still have a value. The parent of a bPoint is usually a Contour.

Overview

Parents

BaseBPoint.contour

Get or set the bPoint's parent contour object.

BaseBPoint.glyph

Get the bPoint's parent glyph object.

BaseBPoint.layer

Get the bPoint's parent layer object.

BaseBPoint.font

Get the bPoint's parent font object.

Identification

BaseBPoint.index

Get the index of the bPoint.

Attributes

BaseBPoint.type

Get or set the bPoint's type.

Points

BaseBPoint.anchor

Get or set the bPoint's anchor point.

BaseBPoint.bcpIn

Get or set the bPoint's incoming off-curve.

BaseBPoint.bcpOut

Get or set the bPoint's outgoing off-curve.

Transformations

BaseBPoint.transformBy

Transform the object according to the given matrix.

BaseBPoint.moveBy

Move the object according to the given coordinates.

BaseBPoint.scaleBy

Scale the object according to the given values.

BaseBPoint.rotateBy

Rotate the object by the specified value.

BaseBPoint.skewBy

Skew the object by the given value.

Normalization

BaseBPoint.round

Round the bPoint's coordinates.

Environment

BaseBPoint.naked

Return the environment's native object wrapped by the current object.

BaseBPoint.changed

Tell the environment that something has changed in the object.

Reference

class fontParts.base.BaseBPoint(*args: Any, **kwargs: Any)[source]

Represent the basis for a bPoint object.

Parents

BaseBPoint.contour

Get or set the bPoint’s parent contour object.

The value must be a BaseContour instance or None.

Returns:

The BaseContour instance containing the bPoint or None.

Raises:

AssertionError – If attempting to set the contour when it has already been set.

Example:

>>> contour = bPoint.contour
BaseBPoint.glyph: dynamicProperty

Get the bPoint’s parent glyph object.

This property is read-only.

The value must be a BaseGlyph instance or None.

Returns:

The BaseGlyph instance containing the bPoint or None.

Example:

>>> glyph = bPoint.glyph
BaseBPoint.layer: dynamicProperty

Get the bPoint’s parent layer object.

This property is read-only.

Returns:

The BaseLayer instance containing the bPoint or None.

Example:

>>> layer = bPoint.layer
BaseBPoint.font: dynamicProperty

Get the bPoint’s parent font object.

This property is read-only.

Returns:

The BaseFont instance containing the bPoint or None.

Example:

>>> font = bPoint.font

Identification

BaseBPoint.index: dynamicProperty

Get the index of the bPoint.

This property is read-only.

Returns:

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

Example:

>>> bPoint.index
0

Attributes

BaseBPoint.type: dynamicProperty

Get or set the bPoint’s type.

The value must be a str containing one of the following alternatives:

Type

Description

'curve' | A point where bcpIn and bcpOut are smooth (linked). 'corner' | A point where bcpIn and bcpOut are not smooth (unlinked).

Returns:

A str representing the type of the bPoint.

Points

BaseBPoint.anchor: dynamicProperty

Get or set the bPoint’s anchor point.

The value must be a Coordinate.

Returns:

a Coordinate representing the anchor point of the bPoint.

BaseBPoint.bcpIn: dynamicProperty

Get or set the bPoint’s incoming off-curve.

The value must be a Coordinate.

Returns:

A Coordinate representing the incoming off-curve of the bPoin.

BaseBPoint.bcpOut: dynamicProperty

Get or set the bPoint’s outgoing off-curve.

The value must be a Coordinate.

Returns:

A Coordinate representing the outgoing off-curve of the bPoin.

Transformations

BaseBPoint.transformBy(matrix: list[int | float] | tuple[float, float, float, float, float, float], origin: list[int | float] | tuple[int | float, int | float] | None = None) None

Transform the object according to the given matrix.

Parameters:
  • matrix – The Transformation Matrix to apply.

  • origin – The optional point at which the transformation should originate as a:ref:type-coordinate. Defaults to None, representing an origin of (0, 0).

Example:

>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))
BaseBPoint.moveBy(value: list[int | float] | tuple[int | float, int | float]) None

Move the object according to the given coordinates.

Parameters:

value – The x and y values to move the object by as a Coordinate.

Example:

>>> obj.moveBy((10, 0))
BaseBPoint.scaleBy(value: int | float | list[int | float] | tuple[float, float], origin: list[int | float] | tuple[int | float, int | float] | None = None) None

Scale the object according to the given values.

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

  • origin – The optional point at which the scale should originate as a Coordinate. Defaults to None, representing an origin of (0, 0).

Example:

>>> obj.scaleBy(2.0)
>>> obj.scaleBy((0.5, 2.0), origin=(500, 500))
BaseBPoint.rotateBy(value: int | float, origin: list[int | float] | tuple[int | float, int | float] | None = None) None

Rotate the object by the specified value.

Parameters:
  • value – The angle at which to rotate the object as an int or a float.

  • origin – The optional point at which the rotation should originate as a Coordinate. Defaults to None, representing an origin of (0, 0).

Example:

>>> obj.rotateBy(45)
>>> obj.rotateBy(45, origin=(500, 500))
BaseBPoint.skewBy(value: int | float | list[int | float] | tuple[float, float], origin: list[int | float] | tuple[int | float, int | float] | None = None) None

Skew the object by the given value.

Parameters:
  • value – The value by which to skew the object as either a single int or float corresponding to the x direction, or a tuple of two int or float values corresponding to the x and y directions.

  • origin – The optional point at which the rotation should originate as a Coordinate. Defaults to None, representing an origin of (0, 0).

Example:

>>> obj.skewBy(11)
>>> obj.skewBy((25, 10), origin=(500, 500))

Normalization

BaseBPoint.round() None[source]

Round the bPoint’s coordinates.

This applies to:

Example:

>>> bPoint.round()

Environment

BaseBPoint.naked() Any

Return the environment’s native object wrapped by the current object.

Raises:

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

Example:

>>> loweLevelObj = obj.naked()
BaseBPoint.changed(*args: Any, **kwargs: Any) None

Tell the environment that something has changed in the object.

The behavior of this method will vary from environment to environment.

Parameters:
  • *args – Any positional arguments.

  • **kwargs – Any keyword arguments.

Example:

>>> obj.changed()