fontlabapp.contours.copy
copy
Contour copies and Qt path contours of the Contours generator scripts.
What: Shadow Copy, Small Caps From Capitals, Superior & Inferior Figures and
Tabular Figure Copies copy the contours of a layer through a transform;
Outline Effect turns a stroked QPainterPath back into FontLab contours.
This module holds those shared parts:
contour_shapesgives the own (non-component) shapes that hold contours.copy_contourscopies their contours: first the element transform, then the caller's transform.repair_nodescopies the node names and raw node flags back onto each copy.path_contoursbuilds closedflContourobjects from the elements of aQPainterPath.
How: a contour copy is contour.cloneMapped(...). FontLab's contour copy
can drop node names and raw node flags (fl#8569). repair_nodes copies
only these two fields back: the node names and raw node flags. Other node
properties, contour names and element names and notes are not copied by
copy_contours. restore_shape repairs a whole detached shape, including
its shape-data name/note and contour names. It keeps clone selection bits
by default; keep_view_state=True restores source selection and active flags.
Why: the code was a private copy in five scripts. contour_shapes is not
fontlabapp.contours.writer.outline_shapes: that one returns the shapes
that an outline script may edit in place, and it keeps shared and scaled
shapes out. A copy can use those shapes too, because it maps every contour
through its element transform.
This module imports only the standard library at load time. path_contours
loads fontlab and PythonQt when it runs, so FontLab's 5-second cold
import stays fast. Offline tests do not prove native FontLab behaviour.
How to use (a script)::
import fly.ap.contours.copy as contour_copy
copies = contour_copy.copy_contours(layer, move) # read before history
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
LINE_TO |
attribute | ||
MOVE_TO |
attribute | ||
SELECTED |
attribute | ||
contour_shapes |
function | (layer: Any) -> list[Any] |
Return the non-component shapes of <code>layer</code> that hold contours, in layer order. |
copy_contours |
function | (layer: Any, transform: Any) -> list[Any] |
Return repaired copies of the layer contours: element transform, then <code>transform</code>. |
path_contours |
function | (path: Any) -> list[Any] |
Return closed flContours from the elements of a QPainterPath. |
repair_nodes |
function | (source: Any, copy: Any) -> None |
Copy the node names and raw node flags of <code>source</code> onto its copy. |
restore_shape |
function | (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. |