Point

Description

Point represents one single point with a particular coordinate in a contour. It is used to access off-curve and on-curve points alike. Its cousin BPoint also provides access to incoming and outgoing bcps. Point is exclusively only one single point.

glyph = CurrentGlyph()
for contour in glyph:
        for point in contour.points:
                print point

Overview

Copy

BasePoint.copy Copy this object into a new object of the same type.

Parents

BasePoint.contour The point’s parent BaseContour.
BasePoint.glyph The point’s parent BaseGlyph.
BasePoint.layer The point’s parent BaseLayer.
BasePoint.font The point’s parent BaseFont.

Identification

BasePoint.name The name of the point.
BasePoint.identifier The unique identifier for the point.
BasePoint.index The index of the point within the ordered list of the parent glyph’s point.

Coordinate

BasePoint.x The x coordinate of the point.
BasePoint.y The y coordinate of the point.

Type

BasePoint.type The point type defined with a String.
BasePoint.smooth A bool indicating if the point is smooth or not.

Transformations

BasePoint.transformBy Transform the object.
BasePoint.moveBy Move the object.
BasePoint.scaleBy Scale the object.
BasePoint.rotateBy Rotate the object.
BasePoint.skewBy Skew the object.

Normalization

BasePoint.round Round the point’s coordinate.

Environment

BasePoint.naked Return the environment’s native object that has been wrapped by this object.
BasePoint.changed Tell the environment that something has changed in the object.

Reference

Copy

BasePoint.copy()

Copy this object into a new object of the same type. The returned object will not have a parent object.

Parents

BasePoint.contour

The point’s parent BaseContour.

BasePoint.glyph

The point’s parent BaseGlyph.

BasePoint.layer

The point’s parent BaseLayer.

BasePoint.font

The point’s parent BaseFont.

Identification

BasePoint.name

The name of the point. This will be a String or None.

>>> point.name
'my point'
>>> point.name = None
BasePoint.identifier

The unique identifier for the point. This value will be an Identifier. This attribute is read only.

>>> point.identifier
'ILHGJlygfds'

If the point does not have an identifier, one will be generated and assigned to the point when this attribute is requested.

BasePoint.index

The index of the point within the ordered list of the parent glyph’s point. This attribute is read only.

>>> point.index
0

Coordinate

BasePoint.x

The x coordinate of the point. It must be an Integer/Float.

>>> point.x
100
>>> point.x = 101
BasePoint.y

The y coordinate of the point. It must be an Integer/Float.

>>> point.y
100
>>> point.y = 101

Type

BasePoint.type

The point type defined with a String. The possible types are:

move An on-curve move to.
line An on-curve line to.
curve An on-curve cubic curve to.
qcurve An on-curve quadratic curve to.
offcurve An off-curve.
BasePoint.smooth

A bool indicating if the point is smooth or not.

>>> point.smooth
False
>>> point.smooth = True

Transformations

BasePoint.transformBy(matrix, origin=None)

Transform the object.

>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0))
>>> obj.transformBy((0.5, 0, 0, 2.0, 10, 0), origin=(500, 500))

matrix must be a Transformation Matrix. origin defines the point at with the transformation should originate. It must be a Coordinate or None. The default is (0, 0).

BasePoint.moveBy(value)

Move the object.

>>> obj.transformBy((10, 0))

value must be an iterable containing two Integer/Float values defining the x and y values to move the object by.

BasePoint.scaleBy(value, origin=None)

Scale the object.

>>> obj.transformBy(2.0)
>>> obj.transformBy((0.5, 2.0), origin=(500, 500))

value must be an iterable containing two Integer/Float values defining the x and y values to scale the object by. origin defines the point at with the scale should originate. It must be a Coordinate or None. The default is (0, 0).

BasePoint.rotateBy(value, origin=None)

Rotate the object.

>>> obj.transformBy(45)
>>> obj.transformBy(45, origin=(500, 500))

value must be a Integer/Float values defining the angle to rotate the object by. origin defines the point at with the rotation should originate. It must be a Coordinate or None. The default is (0, 0).

BasePoint.skewBy(value, origin=None)

Skew the object.

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

value must be rone of the following:

  • single Integer/Float indicating the value to skew the x direction by.
  • iterable cointaining type Integer/Float defining the values to skew the x and y directions by.

origin defines the point at with the skew should originate. It must be a Coordinate or None. The default is (0, 0).

Normalization

BasePoint.round()

Round the point’s coordinate.

>>> point.round()

This applies to the following:

  • x
  • y

Environment

BasePoint.naked()

Return the environment’s native object that has been wrapped by this object.

>>> loweLevelObj = obj.naked()
BasePoint.changed(*args, **kwargs)

Tell the environment that something has changed in the object. The behavior of this method will vary from environment to environment.

>>> obj.changed()