fontlabapp.fontui.tmetrics_model.TMetricsModel · declarations 001
Back to fontlabapp.fontui.tmetrics_model.TMetricsModel
cell_at
cell_at(geometry: Geometry, x: float, y: float) -> int | None
Return the cell index under pixel (x, y), or None.
fingerprint
fingerprint() -> str
Digest the font state behind the current cells, plus the target layer's glyphs.
geometry
geometry(viewport_width: float = 0.0) -> Geometry
Map cells to pixels for a canvas at least viewport_width wide.
RTL rows are right-aligned; LTR rows start at the left margin.
glyph_readout
glyph_readout() -> GlyphReadout | None
Return the selected glyph's advance and sidebearings, or None.
move
move(step: str) -> bool
Move the selection: left/right visually, home/end logically.
outline_of
outline_of(font: Any, name: str) -> Any
outline(font, name), built once per scope; failures are not remembered.
outline_scope
outline_scope(kept: dict[Any, Any] | None = None) -> Iterator[None]
Share one outline per glyph across every read inside the block (one refresh).
Outside a scope each read builds afresh, so a follow poll always sees the font as it is.
kept carries the outlines over to later scopes (typing reuses them);
the caller clears it whenever the font may have changed.
pair_readout
pair_readout() -> PairReadout | None
Return the kerning pair ending at the selected glyph, or None at the start.
plain_font
property
plain_font: Any
The font itself, without the read memo TMetrics wraps it in.
reshape
reshape() -> None
Shape the text again from the font (after edits or setting changes).
rows
property
rows: int
Return the number of rows (0 without cells).
select
select(index: int | None) -> bool
Select cell index (None clears); return True when it changed.
selected
class-attribute
instance-attribute
selected: int | None
set_wrap_width
set_wrap_width(width: float | None) -> bool
Set the row width in font units; return True when the rows changed.
source
property
source: Any
The glyph set read for metrics and outlines: font.getLayer(layer), else the font.
Shaping, kerning and font info always come from the font; a missing layer reads as the font so the view stays usable and the status names it.
status
class-attribute
instance-attribute
status: str
update
update(**changes: Any) -> None
Replace settings fields and re-shape, keeping the selection index.
wrap_width
class-attribute
instance-attribute
wrap_width: float | None