fontlabapp.fontui.tmetrics_model · declarations 001
Back to fontlabapp.fontui.tmetrics_model
DEFAULT_SIZE
module-attribute
DEFAULT_SIZE
DIRECTIONS
module-attribute
DIRECTIONS
KERN1
KERN1
KERN2
KERN2
MARGIN
module-attribute
MARGIN
METRIC_FIELDS
module-attribute
METRIC_FIELDS
NO_FONT_NOTE
module-attribute
NO_FONT_NOTE
NO_TEXT_NOTE
module-attribute
NO_TEXT_NOTE
ROW_GAP
module-attribute
ROW_GAP
SHAPED_NOTE
module-attribute
SHAPED_NOTE
break_rows
break_rows(run: tuple[PlacedGlyph, ...], widths: list[float], width: float | None, direction: str) -> list[tuple[int, float]]
Return (row, x) per glyph of run (visual order), rows at most width.
Rows break in reading order (right to left for RTL) and each row restarts
at x 0 on its visual left. A glyph wider than width gets its own row.
widths are the space each glyph takes (advance plus kerning).
fingerprint
fingerprint(font: Any, names: list[str] | tuple[str, ...], read: Any = None) -> str
Digest what the window shows of font: names, metrics, kerning, features
and the width, Unicodes and outline of each glyph in names.
Never raises: unreadable parts digest as their error type.
kerning_pair
kerning_pair(font: Any, left: str, right: str) -> PairReadout
Look up the effective kerning of left/right and which key gives it.
Precedence follows UFO: glyph-glyph, glyph-group, group-glyph, group-group.
read_metrics
read_metrics(font: Any) -> Metrics
Read upm and vertical metrics from font.info; bad values become None.
sidebearings
sidebearings(font: Any, name: str, read: Any = None) -> tuple[float | None, float | None, float | None]
Return (width, lsb, rsb) of glyph name; None where unknown.
read replaces :func:outline (a per-refresh cache).
write_metric
write_metric(font: Any, name: str, metric: str, value: float, *, layer: str | None = None, undo_name: str | None = None) -> bool
Set metric (lsb, rsb or width) of glyph name to value.
One font.edit_glyph(name, layer=<layer>, undo_name=<undo_name>) per
call. layer defaults to font.defaultLayerName; a different layer
reads its metrics from font.getLayer(layer). undo_name defaults to
"TMetrics: <LSB|RSB|width> <name>". LSB shifts
contours, components and anchors horizontally and grows the width by the
same amount, keeping RSB; RSB and width change only the advance. Return
False (no write) when the value already holds; raise ValueError for an
unknown field, a non-finite value, a missing glyph or a sidebearing of an
empty glyph, and TypeError for a font without edit_glyph.