Skip to content

fontlab_pens._native · declarations 001

Back to fontlab_pens._native

GLYPH_HINT module-attribute

GLYPH_HINT

fontlab_pens.StagedPoint module-attribute

StagedPoint

One point collected by StagingPointPen: ((x, y), segmentType, smooth, name).

check_transformation

check_transformation(transformation: Any) -> tuple[float, ...]

Return a finite 6-value affine tuple or raise ValueError.

emit_contour

emit_contour(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).

fontlab_pens.invert_transform

invert_transform(transformation: Transform) -> Transform

Return the inverse of a target's matrix, for writing in its coordinates.

Raises ValueError (not ZeroDivisionError) for a singular matrix, because no point can be written through it.

fontlab_pens.layer_of

layer_of(glyph: Any, master: str) -> Any

Return the layer of an fgGlyph or flGlyph named master; never guess one.

no_identifier

no_identifier(identifier: str | None) -> None

Reject UFO identifiers before any data is written: natives store none.

fontlab_pens.staged_node_kinds

staged_node_kinds(points: list[StagedPoint]) -> list[str]

Classify each staged point as "move", "on", "cubic" or "quad".

An off-curve point (segmentType None) is "cubic" when the next on-curve point is a "curve", else "quad"; wrapping around for closed contours.

target_kind

target_kind(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

validate(points: list[StagedPoint]) -> None

Raise IncompleteContour/PenError unless points form a valid pen contour.

A "move" after the first point is rejected. fontTools raises for it after a leading move but silently re-reads [line, move, ...] as an open contour; natively it would store a mid-contour Move node, so it is refused here.