fontlabapp.glyphs.names.model · declarations 001
Back to fontlabapp.glyphs.names.model
commit
commit(title: str, entries: list[Entry], mutate: Callable[[], Iterable[Any] | None], *, operation: Operation, facts: Facts, read_back: Callable[[], Iterable[str]] | None = None, window: int | None = None, native: Any = None, stamp: Any = None) -> Committed
Run mutate as ONE Undo step over entries (history.commit).
Every layer of every entry glyph and the glyphs themselves get
checkInitHistoryState(0) and go into the one notification (layers
first, then glyphs). facts comes from fresh_facts. For Unicode
writes pass window=facts.package_id: the Font-window and no-editor
guards then run first. Refusals raise ValueError before any history
call; later failures raise history.PartialWriteError.
editable
editable(facts: Facts, names: Iterable[str], operation: str) -> tuple[list[str], dict[str, str]]
Split names into (names that may be edited, {refused name: reason}).
fresh_facts
fresh_facts(package_id: int, *, native: Any = None) -> Facts
Scan again just before a write. Refuse a switched font; disclose queued updates.
package_id is the id from the scan that the preview showed. Raise
ValueError when the current font is another one. commit reads the
queue immediately before writing and reports its ids and note.
refusal
refusal(facts: Facts, name: str, operation: str) -> str
Return why operation must not edit glyph name, or "".
Texts, checked in this order: "not in font", "has no layers", then
the history.refusal policy ("has auto layers", "base of auto
X, Y…"). An unknown operation raises ValueError.
scan
scan(native: Any = None) -> Facts
Read every glyph and every layer dependency of the current font.
native is the fontlab module (default: the native one). Raise
ValueError("Open a font first.") with no font and ValueError when
a record and its FontLab glyph disagree on name or id.