Skip to content

fontlabapp.masters.layers.writer · declarations 001

Back to fontlabapp.masters.layers.writer

Planner module-attribute

Planner

Work module-attribute

Work

apply_work

apply_work(work: Work, title: str, facts: AutoFacts, edit: Editor, *, allow_bases: bool = False) -> dict[str, Any]

Write all edits as ONE native Undo step through history.commit.

edit.prepare builds every native object BEFORE history opens. edit.write changes one layer; the write strategy decides what is kept. edit.retain names the native objects that the write removes (for a removed component: the component, its data and its builder); history.commit puts them first in the notification with deep history (fl#7641). An editor that removes nothing returns no objects, and the notification is the two-argument one. edit.check reads the font back and returns one text per edit that FontLab did not keep.

Auto layers are never in work; facts is a fresh history.scan_auto_facts. allow_bases passes the user's consent to edit bases of automatic composites to history.commit. No rollback is attempted: a failure after history started raises history.PartialWriteError ("... use Edit > Undo").

fmt

fmt(value: float, places: int | None = None) -> str

Short number text: 700.0 -> 700.

places None keeps every digit that :g shows (the component scripts). places 2 rounds first: 12.254 -> 12.25 (the outline scripts).

layer_of

layer_of(glyph: Any, master: str) -> Any | None

Existing master layer, or None. Never creates a layer.

plural

plural(count: int, word: str) -> str

'1 layer', '2 layers'.

settle

settle(layer: Any) -> None

Mark the layer changed and let FontLab rebuild its caches.

update() returning False means FontLab refused the new geometry.

shown

shown(names: list[str]) -> str

'a, b, c …' for long lists: the first SHOWN_NAMES names.