Skip to content

fontlab_pens._native

_native

Shared helpers for the native FontGate (fg*) and FontLab (fl*) pens.

Native pens target a layer or an element (shape), never a glyph. Targets are recognised by type(obj).__name__ only: an attribute lookup that falls through on a FontGate fgShape recurses until FontLab crashes, so nothing here probes native objects with hasattr/getattr(..., default) or formats them with repr()/str(). Error messages name the type only.

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
GLYPH_HINT attribute
StagedPoint attribute One point collected by StagingPointPen: ((x, y), segmentType, smooth, name).
check_transformation function (transformation: Any) -> tuple[float, ...] Return a finite 6-value affine tuple or raise ValueError.
emit_contour function (nodes: list[tuple[float, float, str, bool, str]], is_open: bool, pen: AbstractPointPen) -> None Send one contour to a point pen as UFO points (off-curves get segmentType None).
invert_transform function (transformation: Transform) -> Transform Return the inverse of a target's matrix, for writing in its coordinates.
layer_of function (glyph: Any, master: str) -> Any Return the layer of an fgGlyph or flGlyph named master; never guess one.
no_identifier function (identifier: str | None) -> None Reject UFO identifiers before any data is written: natives store none.
staged_node_kinds function (points: list[StagedPoint]) -> list[str] Classify each staged point as "move", "on", "cubic" or "quad".
target_kind function (target: Any, layer_type: str, element_type: str, glyph_type: str) -> str Return "layer" or "element" for a native target, judged by type name only.
validate function (points: list[StagedPoint]) -> None Raise IncompleteContour/PenError unless points form a valid pen contour.