fontlabapp.fontui.tmetrics.TMetrics · declarations 001
Back to fontlabapp.fontui.tmetrics.TMetrics
__init__
__init__(font: Any, parent: Any = None, on_open_glyph: Any = None, text: str | None = None, *, controls: bool = True, layer: str | None = None, label_prefix: str = 'TMetrics', hint_check: Any = None, read_only: bool = False, host: Host | None = None)
controls=False hides the input rows (an app shell drives the text).
layer is the explicit target layer of every metric write (None: the
font's default layer); kerning writes name it as their master.
label_prefix starts every Undo name. hint_check(glyph, layer)
returns a fontui.hinting.HintState; on a hinted layer LSB/RSB edits
are off while advance width and kerning still work.
read_only=True refuses every metric and kerning write (edit fields
and Alt+arrow nudges) with a status message: a pure text preview.
choose_layer
choose_layer() -> None
Select the explicit layer for outlines and metrics; guard current-master kerning.
close
close() -> None
Drop the callback and the font, then disconnect everything owned.
commit
commit(target: str, text: str) -> bool
Write text to target (lsb/rsb/width/kerning) of the selection.
Return True after a verified write. Failures (parse, guard, backend, readback) go to the status line and leave the model unchanged.
commit_text
commit_text() -> bool
Return sends literal text to the bound FontLab glyph window when available.
follow
follow() -> None
Follow callback: refresh unless the font still shows our own last write.
follow_text
follow_text() -> None
Glyph-window text poll: adopt new text; the font itself did not change.
highlight_cell
highlight_cell(index: int) -> bool
Select the glyph cell at index in the shaped line; True when it exists.
highlight_pair
highlight_pair(left: str, right: str) -> bool
Select the first left glyph followed by right; True when found.
hint_state
hint_state(name: str | None = None) -> Any
The hint state of name (default: the selected glyph) on the target layer.
key_press
key_press(key: Any, modifiers: Any = 0) -> bool
Canvas keys: Alt(+Ctrl)(+Shift)+Left/Right nudge, else selection; never raise.
nudge
nudge(target: str, step: float) -> bool
Add step to the selected glyph's RSB (rsb) or the pair kerning (kerning).
open_at
open_at(x: float, y: float) -> None
Call on_open_glyph(name) for the glyph under (x, y); errors go to the status.
reflow
reflow() -> None
Re-break rows for the current viewport width (after a resize).
refresh
refresh() -> None
Re-read the font and re-shape, keeping text, selection and scroll.
Call this after changing the font. Typing and view settings use
_reshape, which reuses the whole-font reads of the last refresh.
select_at
select_at(x: float, y: float) -> None
Select the glyph under canvas pixel (x, y); a miss keeps the selection.
select_key
select_key(key: Any) -> bool
Move the selection for Left/Right/Home/End; return True when handled.
set_layer
set_layer(layer: str | None) -> None
Make layer the explicit target of later writes and recheck the hint guard.
set_text
set_text(text: str) -> None
Show text (characters or /names) and reshape, as TMetrics(text=...) does.
set_view
set_view(size: float | None = None, kerning: bool | None = None) -> float
Set the drawing size (px/em, clamped to 8..512) and the kerning toggle; reshape once.
None leaves that setting as it is. Return the size in effect.