RoboFab bPoint
Usage
g = CurrentGlyph() for aPt in g[0].bPoints: >>> < RbPoint for Special-Bold.A[0][0] >
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 Contours
Understanding Contours and outlines
The way outline data is organised in RoboFab, and how the various objects relate is described here: understanding contours.
Attributes
- anchor: the position of (oncurve) anchor. (x, y)
- bcpIn: the position of the incoming (offcurve) bezier control point. (x, y)
- bcpOut: the position of the outgoing (offcurve) bezier control point. (x, y)
- type: the type of the bPoint. Either corner or curve
Attribute examples
g = CurrentGlyph() for aPt in g[0].bPoints: print aPt.bcpIn, aPt.bcpOut, aPt.anchor >>> (0, -175) (611, 337) (0, 175) >>> (0, 0) (223, 641) (0, 0) >>> etc..
Methods
- copy(): return a deepcopy of the object.
- move((x, y)): move the anchor of the bPoint to (x,y). The relative coordinates of the bcpIn and bcpOut will remain the same, which means that in fact, they move the same distance.
- round(): round the coordinates to whole integers.
- select(state=True): select this point.
- transform(matrix): Transform this point. Use a Transform matrix object to mess with the point. See how to use transformations.
Method examples
#method examples