fontlabapp.fontui.teaching_writers.node_slope_and_handles
node_slope_and_handles
Set selected node slopes and cubic handle lengths in a non-modal panel.
What: Copy a slope, use each master's italic angle, flip the slope or pivot at the top or bottom selected node. Set cubic handle proportions or Hobby tensions. How: Slope is dx/dy; selected nodes keep y. Each moved on-curve node carries its adjacent unselected handles by the same offset, including at a closed contour's wrap. Selected handles use their own slope targets. Curve modes require both segment endpoints selected. Handle rays stay fixed; Proportions measures length against the endpoint chord. Hobby uses the two endpoint tangent angles and independent positive tensions. Copy Proportions reads exactly one selected cubic. Closing cubics are included; open ends stay. Why: Contour > Align Points and Contour > Handles > Harmonize serve direct edits. This panel adds explicit reusable numbers, two handle tensions and a batch preview. Use: Select nodes, run the tool, choose the mode and inspect the table. Reload selection after changing glyphs. Each Apply is recorded as one Undo step. Benefit: Repeat the same numeric rule across selected glyphs and masters. Selection is read separately in each master. Automatic layers, shared outlines, scaled or rotated shapes and quadratic contours are kept. No node is inserted, deleted or retyped. Zero handle rays and zero chords are kept. General node conversion, retraction and Tunni editing remain native or existing tools. The preview lists each changed node's old and planned coordinates. Read-back uses the App comparison epsilon; native coordinate storage remains subject to FontLab's rounding preference.
Setup: FontLab 9, Python 3.11, Fly and App>=0.2.150.dev0.
Credit: Independent behaviour rewrite after Vassil Kateliev and Karandash Type Foundry, kateliev/TypeRig, MPL-2.0. Ideas: node_slope.py and curve.py toolbars. Repository: https://github.com/kateliev/TypeRig . No source code copied.
Classes
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 |
|---|---|---|---|
KEY |
attribute | ||
MODES |
attribute | ||
Move |
attribute | ||
Position |
attribute | ||
READBACK_TOLERANCE |
attribute | ||
TITLE |
attribute | ||
Targets |
attribute | ||
carry_handles |
function | (contours: list[ContourSnapshot], moves: Targets) -> Targets |
Carry adjacent unselected off-curves with their moved on-curve owner. |
changes |
function | (layer: Any, mode: str, first: float, second: float, top: bool, flip: bool) -> list[writer.Change] |
Keep unsafe items as rows and plan the remaining contour coordinates. |
coordinate_rows |
function | (contours: list[ContourSnapshot], moves: Targets) -> list[writer.Change] |
Show one exact old/planned coordinate pair per changed native node. |
handle_moves |
function | (contour: Any, mode: str, first: float, second: float) -> list[Move] |
Resolve positional handle targets against one retained node snapshot. |
handle_targets |
function | (contour: ContourSnapshot, mode: str, first: float, second: float) -> dict[int, tuple[float, float]] |
Keep tangent rays; key proportional or Hobby targets by node index. |
hobby_ratio |
function | (theta: float, phi: float) -> float |
Evaluate Hobby's tangent-angle velocity factor at unit tension. |
main |
function | () -> Any |
Show the retained panel; contain native read and deadline errors. |
panel_type |
function | () -> type |
Build the non-modal App panel only inside the native host. |
proportions |
function | (contour: Any) -> tuple[float, float] |
Read one selected cubic's handle lengths relative to its chord. |
segment_indices |
function | (contour: ContourSnapshot) -> list[tuple[int, ...]] |
Find cubic spans by position within the retained ordered snapshot. |
segments |
function | (contour: Any) -> list[list[Any]] |
Read selected cubic spans, including a closed contour's wrapped span. |
selected_contours |
function | () -> list[Any] |
Read one current layer for Copy actions; refuse ambiguous selections. |
slope_moves |
function | (nodes: list[Any], value: float, top: bool, flip: bool) -> list[Move] |
Resolve positional slope targets against this exact node snapshot. |
slope_of |
function | (nodes: list[Any]) -> float |
Measure dx/dy between the lowest and highest selected nodes. |
slope_targets |
function | (nodes: dict[Position, Any], value: float, top: bool, flip: bool) -> Targets |
Key selected-node slope targets by contour/node positions, keeping y. |
snapshot_contour |
function | (contour: Any) -> ContourSnapshot |
Read each native node getter once; reuse an existing snapshot unchanged. |