fontlabapp.contours.copy · declarations 001
Back to fontlabapp.contours.copy
LINE_TO
LINE_TO
MOVE_TO
MOVE_TO
SELECTED
module-attribute
SELECTED
contour_shapes
contour_shapes(layer: Any) -> list[Any]
Return the non-component shapes of layer that hold contours, in layer order.
copy_contours
copy_contours(layer: Any, transform: Any) -> list[Any]
Return repaired copies of the layer contours: element transform, then transform.
transform is a QTransform. Call this before history starts: it
only reads the layer, so a failed copy changes nothing.
path_contours
path_contours(path: Any) -> list[Any]
Return closed flContours from the elements of a QPainterPath.
MoveTo starts a contour, LineTo adds an on-curve node, CurveTo adds two cubic handles ("curve" nodes) and the end point. A closing point that repeats the start replaces the start node. Pieces with fewer than three nodes are dropped (the Qt stroker can leave such stubs).
repair_nodes
repair_nodes(source: Any, copy: Any) -> None
Copy the node names and raw node flags of source onto its copy.
A FontLab contour copy can drop node names and raw node flags (fl#8569).
Only these two fields are copied back (name and nodeState); the
selection bit is cleared. A copy with another node count raises
RuntimeError: the nodes cannot be paired.
restore_shape
restore_shape(source: Any, clone: Any, keep_view_state: bool = False, indexes: Sequence[int] | None = None) -> None
Restore fields that FontLab can drop from a detached shape clone.
Call after cloning and before adding the clone to a layer. Copy the
shape-data note/name, contour names, node names and raw connection flags.
By default keep clone node selection bits and shape view state. With
keep_view_state=True, copy full source nodeState and shape active and
selected flags. Pass indexes to pair a subset of source contours
with clone contours, in that order; None pairs all source contours.
Example: restore_shape(source, clone, True, indexes=[2, 0]).
Use only a detached clone; mismatched counts raise RuntimeError to avoid
storing flags on the wrong nodes.