fontlabapp.contours.extent
extent
Measure the vertical extent of a layer from its outline nodes.
What: vertical_extent(layer) returns (ymin, ymax) of every contour of
every shape of layer, or None when no contour has a node.
Why: FontLab keeps flLayer.boundingBox and flShape.boundingBox as a
cache. After a Python node move, the cache stays stale, also after
notifyChangesApplied (fl#8575, FontLab 9.0.9790). This module never reads
a boundingBox and never calls update(), so the read has no side effects.
How: each shape's contours are mapped through shape.transform (an affine
QTransform, read through m11() … m33()), so a component counts at its
placement, as in masters.layer_contours. Shapes without contours (stickers,
empty shapes) give nothing. Nodes come from contour.nodes() as node.x,
node.y and their kind: node.isOn() (on-curve), node.isCurve()
(cubic control, flNode::Curve) or else a quadratic control
(flNode::Off, node.isOff(); flnode.h). The kind decides each segment,
not contour.isTT: FontLab sets isTT when any node is a quadratic
control, so one contour can mix both kinds (flcontour.cpp). As in FontLab's
contour enumerator (flconturenum.h), an implied on-curve midpoint lies only
between two consecutive Off nodes. Each segment between two on-curve nodes
gives its end y values and its exact y extremes: the roots of the cubic
derivative in (0, 1) for two Curve controls, or the one extreme for one
Off control. A closed contour also gives its closing segment.
Not counted, by design: stroke thickness (maxThickness, which
flShape.boundingBox adds), because zones measure the outline; and the
per-contour contour.transform(), which is identity outside an interactive
transform (flshapedata.cpp).
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 |
|---|---|---|---|
CURVE |
attribute | ||
EPSILON |
attribute | ||
Node |
attribute | ||
OFF |
attribute | ||
ON |
attribute | ||
Point |
attribute | (shared captured text) | |
SEGMENT_CONTROLS |
attribute | ||
contour_ys |
function | (nodes: list[Node], closed: bool) -> list[float] |
Return the end and extreme y values of every segment of one contour. |
cubic_extremes |
function | (p0: float, p1: float, p2: float, p3: float) -> list[float] |
Return the values of a cubic Bezier coordinate at its turning points in (0, 1). |
quadratic_extremes |
function | (p0: float, p1: float, p2: float) -> list[float] |
Return the value of a quadratic Bezier coordinate at its turning point in (0, 1). |
segments |
function | (nodes: list[Node], closed: bool) -> Iterable[tuple[Point, ...]] |
Yield the line, quadratic and cubic segments of one contour, in order. |
vertical_extent |
function | (layer: Any) -> tuple[float, float] | None |
Return <code>(ymin, ymax)</code><code> of the outlines of </code><code>layer</code><code>, or </code><code>None</code> when empty. |