fontlabapp.studios._contours
_contours
Shared contour helpers for the studios (Scriptmix TODO:46–47).
What: the contour-selection scaffold that four Scriptmix scripts repeated
(selected_contours, the NodeEditor write/check pair as
write_moves/check_moves and chosen_masters), the selection planner
that three of them repeated with only a different linear map
(selection_matrix/selection_changes/write_selection/
check_selection) and the five identical spans helpers.
Why: the studio boundary forbids fontlabapp.contours; studios that edit
selected contours or walk native segments import these instead of copying
them again. Script-specific transforms and controls stay with each caller:
the linear map is an argument. Used by the Outline Doctor (spans) and
by later studios (Issue 242 T20).
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 |
|---|---|---|---|
Linear |
attribute | ||
Move |
attribute | (shared captured text) | |
UNDO_HINT |
attribute | (shared captured text) | |
XY |
attribute | (shared captured text) | |
check_moves |
function | (layer: Any, moves: Iterable[Move]) -> None |
<code>NodeEditor.check</code>: raise RuntimeError when a node differs after whole-unit rounding. |
check_selection |
function | (layer: Any, steps: Iterable[tuple[list[Move], list[tuple[Any, Affine]]]]) -> None |
<code>SelectionEditor.check</code>: read every moved node and component matrix back. |
chosen_masters |
function | (masters: Sequence[str], all_masters: bool, occurrences: Iterable[tuple[Any, str, str]]=(), package_id: Any=N… |
Master names to edit and the selected (glyph, layer) pairs (None when every layer). |
node_spans |
function | (nodes: Sequence[Any], is_on: Callable[[Any], bool]) -> list[list[Any]] |
Segments of one closed node cycle: each starts and ends on-curve. |
selected_contours |
function | (layer: Any) -> list[tuple[Any, Any, list[Any]]] |
Selected own contours as (shape, contour, nodes); refuse locked or shared outlines. |
selection_changes |
function | (layer: Any, value: float, linear: Linear) -> list[Change] |
Plan selected nodes and selected component transforms in glyph coordinates. |
selection_matrix |
function | (value: float, centre: XY, linear: Linear) -> Affine |
Map glyph coordinates with <code>linear(value)</code><code> about </code><code>centre</code>. |
spans |
function | (contour: Any) -> list[list[Any]] |
Native <code>flContour</code> segments (Make Compatible, Comb, Straighten All Curves, Superaligner, Curve All Straights). |
write_moves |
function | (moves: Iterable[Move]) -> None |
<code>NodeEditor.write</code>: assign coordinates on the original node objects. |
write_selection |
function | (steps: Iterable[tuple[list[Move], list[tuple[Any, Affine]]]]) -> None |
<code>SelectionEditor.write</code>: node moves, then whole component matrices. |