Skip to content

fontlabapp.components.writer · declarations 001

Back to fontlabapp.components.writer

base_of

base_of(shape: Any) -> str

Name of the glyph that a component shape refers to.

blocked_rows

blocked_rows(work: Work, facts: AutoFacts) -> list[tuple[str, Change]]

One blocking row per edited glyph that the geometry policy refuses.

A glyph that owns an auto layer, or is a base of one (also through other composites), is refused: FontLab rebuilds the auto composite and Undo does not restore it.

collect

collect(glyphs: Iterable[Any], masters: Iterable[str], planner: Planner) -> Plan

Run planner on every editable layer. Auto layers are listed, never edited.

components

components(layer: Any) -> list[Any]

Component shapes of the layer, in layer order.

copy_problem

copy_problem(package: Any, owner: tuple[str, str], shape: Any, master: str) -> str

Why the parts of shape cannot be copied safely, or "".

Walks every base level as FontLab's builder does. Each base needs a plain (not auto) layer whose shapes have affine transforms and are outlines or components; a loop back to a visited layer, or nesting deeper than MAX_DEPTH, is refused. owner is (glyph name, layer name) of the edit.

eject

eject(shape: Any) -> list[Any]

Detached copies of the shapes inside a component, placed by its transform.

One level only: a component inside the base stays a component. The copies exist before any history opens; the write only swaps them in.

half_up

half_up(value: float) -> int

Round half up: 14.5 -> 15 and -14.5 -> -14, on every platform.

keep_raw_state

keep_raw_state(source: Any, copy: Any) -> None

Restore what a native copy drops.

A copied outline gets its Smooth flags recomputed from geometry (fl#8516): copy back only the raw connection bits of every node. A copy also loses the stored element note (fl#8538) and can lose the element name: copy them back. All edits touch only the detached copy, never the source. The active (current element) state of the base is not copied into this glyph.

offset

offset(shape: Any) -> tuple[float, float]

Translation part of the shape transform, unrounded.

offset_text

offset_text(point: tuple[float, float]) -> str

'40, -12' for a preview cell.

part_counts

part_counts(package: Any, shape: Any, master: str) -> tuple[int, int]

(contours, components) that one eject of shape gives, read from its base.

parts_text

parts_text(contours: int, inner: int) -> str

'3 contours', '2 contours + 1 component'.

plain_move

plain_move(shape: Any) -> bool

True when the transform is a pure translation: no scale, slant or rotation.

Anchor arithmetic and offset copies are exact only for such components.

refreshed

refreshed(shape: Any) -> None

Rebuild the component cache first: its includes can describe an older base.

require_safe

require_safe(work: Work, facts: AutoFacts) -> None

Refuse the whole batch before any history exists, when Undo would fail.

A glyph that owns an auto layer or is a base of one (blocked_rows).

shape_index

shape_index(layer: Any, shape_id: Any) -> int

Position of the shape with shape_id in the layer. ValueError if gone.