Skip to content

fontlabapp.fontui.tmetrics_model.TMetricsModel

TMetricsModel dataclass

Shaped text over font with rows, a visual selection and readouts.

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
cell_at function (self, geometry: Geometry, x: float, y: float) -> int | None Return the cell index under pixel <code>(x, y)</code>, or None.
cells attribute tuple[Cell, ...]
fingerprint function (self) -> str Digest the font state behind the current cells, plus the target layer's glyphs.
font attribute Any (shared captured text)
geometry function (self, viewport_width: float=0.0) -> Geometry Map cells to pixels for a canvas at least <code>viewport&#95;width</code> wide.
glyph_readout function (self) -> GlyphReadout | None Return the selected glyph's advance and sidebearings, or None.
layer attribute str | None (shared captured text)
metrics attribute Metrics (shared captured text)
move function (self, step: str) -> bool Move the selection: <code>left</code><code>/</code><code>right</code><code> visually, </code><code>home</code><code>/</code><code>end</code> logically.
outline_of function (self, font: Any, name: str) -> Any <code>outline(font, name)</code>, built once per scope; failures are not remembered.
outline_scope function (self, kept: dict[Any, Any] | None=None) -> Iterator[None] Share one outline per glyph across every read inside the block (one refresh).
pair_readout function (self) -> PairReadout | None Return the kerning pair ending at the selected glyph, or None at the start.
plain_font attribute (self) -> Any The font itself, without the read memo TMetrics wraps it in.
reshape function (self) -> None Shape the text again from the font (after edits or setting changes).
result attribute shaping.GlyphRunResult | None
rows attribute (self) -> int Return the number of rows (0 without cells).
select function (self, index: int | None) -> bool Select cell <code>index</code> (None clears); return True when it changed.
selected attribute int | None
selected_cell function (self) -> Cell | None Return the selected cell, or None.
set_wrap_width function (self, width: float | None) -> bool Set the row width in font units; return True when the rows changed.
settings attribute Settings
source attribute (self) -> Any The glyph set read for metrics and outlines: <code>font.getLayer(layer)</code>, else the font.
status attribute str
update function (self, **changes: Any) -> None Replace settings fields and re-shape, keeping the selection index.
wrap_width attribute float | None