Skip to content

fontlabapp.metrics.zones.native · declarations 001

Back to fontlabapp.metrics.zones.native

BOUNDS_GLYPHS module-attribute

BOUNDS_GLYPHS

RESTORED_TEXT module-attribute

RESTORED_TEXT

STALE_TEXT module-attribute

STALE_TEXT

TITLE module-attribute

TITLE

apply

apply(before: Snapshot, changes: tuple[Change, ...], *, title: str = TITLE) -> Snapshot

Write every changed master as ONE Undo step named title; return the new baseline.

Refuse rows first (RowRefusal), then off the GUI thread or without an active Font window (font_history.require_font_window), before any master switch. Check that the font still equals before and that every row can be stored as planned, then font_history.commit_masters. Print the queued glyph ids note to Output (edit_guards.disclose). Then read back every master and the current master again (capture); a difference or a failed read raises history.unstored_error, whose rule this module keeps: the text makes no claim about Undo. Return before with each changed master's zones replaced by its verified plan. No ValueError is raised after commit_masters returns, so a caller may treat a ValueError as a refusal made before any write.

backend

backend(package_id: int | None = None, *, title: str = TITLE) -> Backend

Return the native zone_editor.Backend for package_id or the current font.

Its apply names the Undo step title (default TITLE; the Vertical Metrics & Zones app passes its own label).

bounds

bounds(snapshot: Snapshot, master: str) -> tuple[Extent, Extent]

Return the vertical extents of o and O in master.

A missing glyph, layer or a flat layer gives None. Reads findName, findLayer and the outline nodes (outline_extent.vertical_extent), never the cached boundingBox, which stays stale after a Python node move (fl#8575).

capture

capture(expected_id: int | None = None) -> Snapshot

Read every master of the current font; restore the starting master.

expected_id: the flPackage.id to require (default: the current font). Raise ValueError without a font or for unreadable values, and TimeoutError after CAPTURE_SECONDS. Calls setMaster(name, False) only; no history, no refresh.

check

check(snapshot: Snapshot) -> None

Refuse with ValueError(STALE_TEXT) unless the font equals snapshot.

read_zones

read_zones(package: Any) -> Zones

Return the zones of the selected master as plain values.