RAnchor

class RAnchor()

An anchor object. This object is almost always created with BaseGlyph.appendAnchor. An orphan anchor can be created like this

>>> anchor = RAnchor()

changed()

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

obj.changed()

updateSelection(sender)

Update the selection.

addObserver(observer, methodName, notification)

Add an observer object. that will receive notification for the given methodName.

asDefcon()

Return the defcon object.

asFontParts()

Return a fontParts object

getRepresentation(name, **kwargs)

Get a representation by name.

Optionally arguments could be provided if the representation factory requires arguments.

holdChanges()

Capture changes and bundle them in a single change in a with statement.

performUndo()

Create a undo item and add it the the undo manager.

prepareUndo(undoTitle='')

Save the current state of the object.

releaseHeldChanges()

removeObserver(observer, notification)

Remove an observer object for a notification.

undo(undoTitle='')

Capture the current state of the object and create a undo item in a with statement.

Optionally an undoTitle can be provided.

Inherits from subclass: fontParts.fontshell.anchor.RAnchor

color

The anchor’s color. This will be a color or None.

>>> anchor.color
None
>>> anchor.color = (1, 0, 0, 0.5)

copyAttributes

font

The anchor’s parent BaseFont.

glyph

The anchor’s parent BaseGlyph.

index

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

>>> anchor.index
0

layer

The anchor’s parent BaseLayer.

name

The name of the anchor. This will be a string or None.

>>> anchor.name
'my anchor'
>>> anchor.name = None

x

The x coordinate of the anchor. It must be an integer/float.

>>> anchor.x
100
>>> anchor.x = 101

y

The y coordinate of the anchor. It must be an integer/float.

>>> anchor.y
100
>>> anchor.y = 101

position

The point position.

selected

The object’s selection state.

>>> obj.selected
False
>>> obj.selected = True

identifier

The unique identifier for the object. This value will be an identifier or a None. This attribute is read only.

>>> object.identifier
'ILHGJlygfds'

To request an identifier if it does not exist use object.getIdentifier()

naked()

isCompatible(other)

Evaluate interpolation compatibility with other.

>>> compatible, report = self.isCompatible(otherAnchor)
>>> compatible
True
>>> compatible
[Warning] Anchor: "left" + "right"
[Warning] Anchor: "left" has name left | "right" has name right

This will return a bool indicating if the anchor is compatible for interpolation with other and a string of compatibility notes.

round()

Round the anchor’s coordinate.

>>> anchor.round()

This applies to the following:

  • x
  • y

copyData(source)

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

moveBy(value)

Move the object.

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

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

rotateBy(value, origin=None)

Rotate the object.

>>> obj.rotateBy(45)
>>> obj.rotateBy(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).

scaleBy(value, origin=None)

Scale the object.

>>> obj.scaleBy(2.0)
>>> obj.scaleBy((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).

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

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. origin defines the point at with the transformation should originate. It must be a coordinate or None. The default is (0, 0).

generateIdentifier()

getParent()

setChanged()

update()

move(*args, **kwargs)

rotate(*args, **kwargs)

scale(*args, **kwargs)

skew(*args, **kwargs)

transform(*args, **kwargs)

translate(*args, **kwargs)

draw(pen)

drawPoints(pen)

setParent(parent)

getIdentifier()

Create a new, unique identifier for and assign it to the object. If the object already has an identifier, the existing one should be returned.

Last edited on 27/03/2024