Skip to content

fontlabapp.fontui.tglyph_model

tglyph_model

Qt-free model behind the TGlyph window: one glyph on one explicit layer.

What: read_glyph(font, name, layer) reads a glyph's contours, components, anchors and advance from font.getLayer(layer) through a point pen and returns plain values (never live glyph objects, which a FontLab commit invalidates). Components are decomposed through the same layer for drawing only; a missing base or a component cycle marks that component unavailable. When Fontport refuses the glyph itself (UnsupportedCapability while loading its component graph), own_glyph reads the own contours from an aborted edit_glyph staging block, which writes nothing. View maps font units to screen pixels (y up in the font, y down on the screen) with zoom about a point, pan and fit. hit_point finds the point under the cursor within a tolerance in screen pixels. signature describes the point structure (contour count, point types, components) without coordinates, so a live follow can keep the selection while points only move; fingerprint digests every value a refresh shows, for fontlabapp.fontui.livesync.Echo. Use: TGlyphModel(font, name, layer); fontlabapp.fontui.tglyph draws it. Why: geometry, hit-testing and change detection stay testable without Qt.

Classes

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
FIT_MARGIN attribute
HIT_TOLERANCE attribute
IDENTITY attribute
MAX_SCALE attribute
MIN_SCALE attribute
ZOOM_STEP attribute
bounds function (data: GlyphData | None) -> tuple[float, float, float, float] | None (xMin, yMin, xMax, yMax) of every contour and component point, or None.
default_layer function (font: Any) -> str The font's default layer name (<code>public.default</code> when it names none).
fingerprint function (data: GlyphData | None, metrics: Metrics | None=None, error: str='') -> str Digest every value TGlyph shows; equal digests mean nothing visible changed.
hit_point function (data: GlyphData | None, view: View, sx: float, sy: float, tolerance: float=HIT_TOLERANCE) -> tuple[int, int]… (contour, point) index of the nearest own point within <code>tolerance</code> pixels.
layer_names function (font: Any) -> list[str] The font's layer (master) names in order; the default layer alone when unknown.
neighbour function (order: list[str], name: str, step: int) -> str | None The glyph <code>step</code><code> places from </code><code>name</code><code> in </code><code>order</code>, wrapping; None when empty.
own_glyph function (font: Any, name: str, layer: str, reason: str) -> GlyphData | None Read <code>name</code>'s own contours when its components cannot load, or None.
read_glyph function (font: Any, name: str, layer: str) -> GlyphData Read <code>name</code><code> on </code><code>layer</code><code> of </code><code>font</code> into plain values.
signature function (data: GlyphData | None) -> tuple Point structure without coordinates: equal while points only move.