Skip to content

fontlabapp.studios.transform_studio.geometry

geometry

Qt-free outline snapshots, affine maths, edit simulation and the ghost overlay.

What: Layer/Shape/Contour/Node are read-only snapshots of one native layer (native.snapshot). Planners turn a snapshot into Change rows whose edit is a tuple of steps:

  • ("shape", shape, matrix, bake) sets a shape transform; bake folds it into the nodes (own outlines), otherwise it stays (components).
  • ("node", shape, contour, node, x, y, smooth) moves one node (shape-local coordinates; smooth None keeps it).
  • ("remove", shape, contour, indices, count) deletes nodes.
  • ("anchor", index, x, y) and ("advance", width).

simulate applies steps to a snapshot and ghost draws the result as a TGlyph overlay; verify compares a read-back snapshot with the plan. Why: the Studio boundary forbids importing fontlabapp.contours; this module privately repeats its affine contract (a, b, c, d, e, f = QTransform(m11, m12, m21, m22, dx, dy)). Shared by Transform Studio and Align & Nudge (fontlabapp.studios.align_nudge).

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
Affine attribute (shared captured text)
EPS attribute
IDENTITY attribute Affine (shared captured text)
MATRIX_TOLERANCE attribute
NODE_TOLERANCE attribute
ORIGIN_ERROR attribute
about function (linear: Affine, ox: float, oy: float) -> Affine <code>linear</code><code> applied around the point </code><code>(ox, oy)</code>.
anchor_steps function (layer: Layer, matrix: Affine) -> tuple[list[tuple], str] Anchor moves under <code>matrix</code> and the fl#8527 problem text (or "").
apply function (m: Affine, x: float, y: float) -> tuple[float, float]
concat function (first: Affine, then: Affine) -> Affine <code>first</code><code> followed by </code><code>then</code><code> (Qt </code><code>first &#42; then</code>).
corners function (shape: Shape) -> list[tuple[float, float]]
finite function (*values: float) -> bool
ghost function (layer: Layer) -> Overlay The layer's own outlines in glyph space as a TGlyph overlay (components are not drawn).
glyph_points function (shape: Shape) -> list[tuple[float, float]] Every node of <code>shape</code> in glyph space.
ink_box function (contours: Iterable[Sequence[tuple[float, float, bool]]]) -> tuple[float, float, float, float] | None Exact <code>(x, y, w, h)</code><code> of cubic/quadratic contours given as </code><code>(x, y, on)</code> lists in glyph space.
invert function (m: Affine) -> Affine
is_identity function (m: Affine) -> bool
is_translation function (m: Affine) -> bool
layer_ink function (layer: Layer, extra: Affine=IDENTITY) -> tuple[float, float, float, float] | None Ink box of the layer's own outlines after <code>extra</code> (components excluded).
plural function (count: int, word: str) -> str (shared captured text)
rotation function (degrees: float) -> Affine
simulate function (layer: Layer, steps: Iterable[tuple]) -> Layer The snapshot <code>layer</code><code> after </code><code>steps</code> (baked shapes get an identity transform).
subject function (names: Sequence[str]) -> str
transform_changes function (layer: Layer, matrix: Affine, anchors: bool, note: str, *, bake_only: bool=False) -> list[Change] Rows for <code>matrix</code><code> applied to every shape (and optionally anchors) of </code><code>layer</code>.
translate function (dx: float, dy: float) -> Affine
verify function (label: str, expected: Layer, actual: Layer, steps: Sequence[tuple]) -> list[str] Read-back problems: nodes and anchors beyond 0.5 unit, transforms beyond 1e-6, wrong counts.