Skip to content

fontlabapp.qt.painting.view · declarations 001

Back to fontlabapp.qt.painting.view

Side module-attribute

Side

glyph_point

glyph_point(glyph: Any, block: Any, point: Any) -> tuple[float, float]

Map a canvas-unit point into glyph units of one occurrence.

The glyph-item transform, then the text-block transform, maps glyph units to canvas units (b: EditorPainters, tools.bridge); this applies the inverse. canvas.mousePosition() is already in canvas units (a-src flvisual.cpp); a viewport point needs mapFromViewport first. Raises ValueError for a non-invertible or non-finite map.

neighbours

neighbours(block: Any, index: int, info: Any, report: Callable[[Exception], object]) -> tuple[Side, Side]

Return (prev, next) beside paragraph glyph index (info).

block.getPrevGlyphInLine / getNextGlyphInLine take the paragraph index and return None across a line break (a-stub; a-src fltextblock.cpp compares lineIndex). Kerning is kerningOffset(True) / transform.m11() (a-src metrics tool): the layout value, classes applied, plus any drag offset, in font units; it is 0 when the block's kerningProcessing is off. A mirrored slot (negative m11) flips its sign. The pair (prev, this) is read from prev and (this, next) from info; that side convention is (c), unverified natively. A missing or null neighbour glyph gives None. Each side fails alone: an unusable scale, a non-finite kerning or a failing lookup makes that side None and goes to report; the other side is kept.

px_per_unit

px_per_unit(to_view: Callable[[Any], Any], point_type: Callable[[float, float], Any]) -> float

Return the view length of one glyph-unit x step through to_view.

to_view maps a glyph point through the glyph-item, text-block and canvas-viewport maps (b: EditorPainters._contexts). This is not canvas.scale(), which omits the glyph and block scale. Raises ValueError when the mapped length is not finite.