fontlab.flContour
flContour
A contour is the closed or open path that forms a letter's shape. Everything you see when you look at a glyph in the editor — the outer edge of an "H", the bowl of a "p", the counter inside an "O" — is a contour. Each contour is made up of an ordered sequence of flNode objects connected by curve and line segments. The contour is the level at which you think about the overall shape of a letter part, while nodes are the individual control points that define exactly where the path goes.
Inherits from flObject.
What Is a Contour?
Open vs. closed contours. Most glyphs consist entirely of closed contours — the path's last node connects back to its first node, enclosing an area. Closed contours are what you use for all regular letterforms. An open contour, by contrast, has two free endpoints that don't connect. Open contours appear in some decorative or component-based designs, in stroke-based workflows where a skeleton is later expanded, and in glyphs built from paths that are meant to be processed further rather than filled directly. The closed property tells you which kind you have.
Winding direction and why it matters. In digital type, a filled shape is defined not just by its path but by the direction the path travels — clockwise or counter-clockwise. FontLab follows the PostScript convention: outer contours wind counter-clockwise and counter-shapes (holes) wind clockwise. The letter "O", for example, is built from two contours: the outer oval winds counter-clockwise, and the inner counter-oval winds clockwise — together they create a filled ring. If you get the directions wrong, the font renderer may fill the hole or leave the outer shape empty. The clockwise property and the setStartPoint method (combined with a direction reversal) are your tools for managing this. When scripting, always verify and normalize winding direction after building contours programmatically.
Tutorial: Building the Letter "O" from Two Contours
The letter "O" is the classic test case for understanding contour structure in font design. It requires exactly two contours: the outer oval (counter-clockwise, the positive shape) and the inner counter-oval (clockwise, the hole). This tutorial builds a simplified circular "O" from scratch using flContour and flNode, demonstrating the key concepts of contour construction, node types, smooth nodes, and winding direction.
import fontlab as fl
from fontlab import flContour, flNode
font = fl.CurrentFont()
glyph = font['O']
layer = glyph.layers[0]
shape = layer.shapes[0]
# ── Step 1: Understand the existing "O" ─────────────────────────────────────
# A real "O" glyph will already have two contours. Let's inspect them to
# understand what winding direction and node count to expect.
for i, contour in enumerate(shape.contours):
direction = "clockwise (inner)" if contour.clockwise else "counter-clockwise (outer)"
print(f"Contour {i}: {contour.nodesCount} nodes, {direction}, closed={contour.closed}")
# ── Step 2: Build the outer oval (counter-clockwise) ────────────────────────
# A circle in Bézier representation needs 4 on-curve nodes (at 12, 3, 6, 9 o'clock)
# and 8 off-curve handles. The magic constant 0.5523 gives excellent circle approximation.
# We place nodes counter-clockwise: top → left → bottom → right.
k = 0.5523 # Bézier circle approximation constant
cx, cy = 250, 350 # center of the O
rx, ry = 200, 250 # horizontal and vertical radii
outer = flContour()
outer.closed = True
# Top on-curve node (12 o'clock), going counter-clockwise
outer.add(flNode(cx, cy + ry, nodeType='on')) # top
outer.add(flNode(cx - rx*k, cy + ry, nodeType='off')) # outgoing handle
outer.add(flNode(cx - rx, cy + ry*k, nodeType='off')) # incoming handle
outer.add(flNode(cx - rx, cy, nodeType='on')) # left
outer.add(flNode(cx - rx, cy - ry*k, nodeType='off')) # outgoing handle
outer.add(flNode(cx - rx*k, cy - ry, nodeType='off')) # incoming handle
outer.add(flNode(cx, cy - ry, nodeType='on')) # bottom
outer.add(flNode(cx + rx*k, cy - ry, nodeType='off')) # outgoing handle
outer.add(flNode(cx + rx, cy - ry*k, nodeType='off')) # incoming handle
outer.add(flNode(cx + rx, cy, nodeType='on')) # right
outer.add(flNode(cx + rx, cy + ry*k, nodeType='off')) # outgoing handle
outer.add(flNode(cx + rx*k, cy + ry, nodeType='off')) # incoming handle
# (path closes back to the top node)
print(f"Outer contour: {outer.nodesCount} nodes, clockwise={outer.clockwise}")
# ── Step 3: Make the on-curve nodes smooth ───────────────────────────────────
# Setting smooth=True on the on-curve nodes ensures the handles are treated as
# collinear — producing the fluid, tangent-continuous curve transitions that
# make a circle look like a circle, not a polygon.
for node in outer.nodes():
if node.isOn():
node.smooth = True
# ── Step 4: Build the inner counter (clockwise) ─────────────────────────────
# The inner oval is smaller and must wind in the OPPOSITE direction to create
# a hole. We build it clockwise: top → right → bottom → left.
# Using smaller radii for the counter.
irx, iry = 130, 170 # inner radii
inner = flContour()
inner.closed = True
# Top on-curve node, going CLOCKWISE: top → right → bottom → left
inner.add(flNode(cx, cy + iry, nodeType='on'))
inner.add(flNode(cx + irx*k, cy + iry, nodeType='off'))
inner.add(flNode(cx + irx, cy + iry*k, nodeType='off'))
inner.add(flNode(cx + irx, cy, nodeType='on'))
inner.add(flNode(cx + irx, cy - iry*k, nodeType='off'))
inner.add(flNode(cx + irx*k, cy - iry, nodeType='off'))
inner.add(flNode(cx, cy - iry, nodeType='on'))
inner.add(flNode(cx - irx*k, cy - iry, nodeType='off'))
inner.add(flNode(cx - irx, cy - iry*k, nodeType='off'))
inner.add(flNode(cx - irx, cy, nodeType='on'))
inner.add(flNode(cx - irx, cy + iry*k, nodeType='off'))
inner.add(flNode(cx - irx*k, cy + iry, nodeType='off'))
# Make on-curve nodes smooth
for node in inner.nodes():
if node.isOn():
node.smooth = True
print(f"Inner contour: {inner.nodesCount} nodes, clockwise={inner.clockwise}")
# ── Step 5: Verify winding directions ────────────────────────────────────────
# Before adding the contours, make sure winding is as expected.
# Outer should be counter-clockwise (False), inner should be clockwise (True).
# getSquare() returns positive for CCW, negative for CW.
print(f"Outer area (positive = CCW): {outer.getSquare():.1f}")
print(f"Inner area (negative = CW): {inner.getSquare():.1f}")
# ── Step 6: Add both contours to the shape and update ───────────────────────
# clearNodes on existing contours first if this is a re-run of the script:
for existing in list(shape.contours):
shape.removeContour(existing)
shape.addContour(outer)
shape.addContour(inner)
fl.Update()
print("Done! The letter O has been rebuilt.")
Common Scripting Patterns
These self-contained examples solve the tasks that come up most often when working with contours in scripts.
Reverse winding direction of all counter-shapes
When importing outlines, the winding direction can come in wrong. This script identifies any clockwise outer contour (which should be counter-clockwise) and any counter-clockwise inner contour (which should be clockwise) and fixes them. The heuristic used here is area: the largest contour by area is assumed to be the outer shape.
import fontlab as fl
font = fl.CurrentFont()
glyph = font['O']
layer = glyph.layers[0]
for shape in layer.shapes:
contours = shape.contours
if not contours:
continue
# Find the contour with the largest absolute area — that's the outer shape.
areas = [(abs(c.getSquare()), c) for c in contours]
areas.sort(reverse=True)
outer_contour = areas[0][1]
for area, contour in areas:
is_outer = (contour is outer_contour)
# Outer should be CCW (clockwise=False); inners should be CW (clockwise=True)
if is_outer and contour.clockwise:
contour.reverse()
print(f"Reversed outer contour in '{glyph.name}'")
elif not is_outer and not contour.clockwise:
contour.reverse()
print(f"Reversed inner contour in '{glyph.name}'")
fl.Update()
Find all open contours in the font
Open contours are usually unintentional in a production font. This script lists every open contour by glyph name so you can investigate and close them.
import fontlab as fl
font = fl.CurrentFont()
open_found = []
for glyph in font.glyphs:
for layer in glyph.layers:
for shape in layer.shapes:
for contour in shape.contours:
if not contour.closed:
first = contour.getFirstPoint()
last = contour.getLastPoint()
open_found.append(
f"{glyph.name} [{layer.name}]: "
f"open contour with {contour.nodesCount} nodes, "
f"start=({first.x():.0f},{first.y():.0f}), "
f"end=({last.x():.0f},{last.y():.0f})"
)
if open_found:
print(f"Found {len(open_found)} open contour(s):")
for line in open_found:
print(" ", line)
else:
print("No open contours found.")
Add extremum nodes to all contours
Extremum nodes — points at the topmost, bottommost, leftmost, and rightmost positions of a curve — are required for correct PostScript hinting. This script inserts them where they are missing by using insertNodeTo at the parametric position of each extremum.
import fontlab as fl
font = fl.CurrentFont()
glyph = font['O']
layer = glyph.layers[0]
for shape in layer.shapes:
for contour in shape.contours:
nodes = contour.nodes()
for node in nodes:
if node.isOn():
# isExtreme(x=False) checks vertical extremes (top/bottom)
# isExtreme(x=True) checks horizontal extremes (left/right)
if not node.isExtreme(x=False) and not node.isExtreme(x=True):
pass # node is not at an extreme; no action needed
# The above just inspects — to *add* missing extremes, use:
# FontLab has a built-in method on the shape for this:
# shape.addExtremes() # adds extremum nodes to all contours in the shape
fl.Update()
Simplify all contours by removing redundant nodes
After auto-tracing or importing from SVG, outlines often contain far too many nodes. This script applies the simplify method to each contour to reduce node count while preserving the visual shape within a tolerance of 1 em unit.
import fontlab as fl
font = fl.CurrentFont()
tolerance = 1.0 # maximum deviation from original shape, in em units
for glyph in font.glyphs:
for layer in glyph.layers:
for shape in layer.shapes:
original_count = sum(c.nodesCount for c in shape.contours)
for contour in shape.contours:
contour.simplify(
tolerance,
lossy=False, # keep within tolerance
extremes=True # always preserve extreme nodes
)
new_count = sum(c.nodesCount for c in shape.contours)
if new_count < original_count:
print(f"{glyph.name}: {original_count} → {new_count} nodes")
fl.Update()
Check contour compatibility across masters for variable fonts
Variable font masters must have the same number and type of nodes on each corresponding contour. This script compares the first two masters of a variable font and reports any incompatible glyphs.
import fontlab as fl
font = fl.CurrentFont()
glyphs = font.glyphs
for glyph in glyphs:
if len(glyph.layers) < 2:
continue
layer_a = glyph.layers[0]
layer_b = glyph.layers[1]
contours_a = [c for s in layer_a.shapes for c in s.contours]
contours_b = [c for s in layer_b.shapes for c in s.contours]
if len(contours_a) != len(contours_b):
print(f"INCOMPATIBLE {glyph.name}: "
f"{len(contours_a)} vs {len(contours_b)} contours")
continue
for i, (ca, cb) in enumerate(zip(contours_a, contours_b)):
if not ca.isCompatible(cb, strong=True):
print(f"INCOMPATIBLE {glyph.name} contour {i}: "
f"{ca.nodesCount} vs {cb.nodesCount} nodes")
flContour.FigureType
Use the flContour.FigureType dictionary with subscription.
| Key | Native value | Description |
|---|---|---|
figureEllipse |
flContour::FigureType::figureEllipse |
Native enum value. |
figureRectangle |
flContour::FigureType::figureRectangle |
Native enum value. |
Constructors: flContour() flContour(flObject) flContour(flContour) flContour(fgContour) flContour(id) flContour(list(Node)[, bool closed=false]) flContour(list(QPointF)[, flNode::NodeType=flNode::On[, bool closed=false]]) flContour(QRectF) flContour(QLineF)
Native bases: object
Captured native MRO: flContour, object
Native new allocation evidence (not an init overload): (args, *kwargs) Create and return a new object. See help(type) for accurate signature.
Supplemental documentation:
A closed or open path made of flNode objects. The captured declaration exposes nodes and closed. Obtain contours with the getContours method of a layer.
Example::
for contour in layer.getContours():
for node in contour.nodes:
print(node.x, node.y)
Source: FontLab Proteus API documentation
Source: generated/fontlab.py: flContour captured declaration
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 |
|---|---|---|---|
FigureType |
attribute | dict |
|
__init__ |
function | (self, /, *args: Any, **kwargs: Any) -> None |
Initialize self. (shared captured text) |
add |
function | (self, QPointF: Any) -> Any |
Appends a single node to the end of the contour. |
append |
function | (self, flContour: Any) -> Any |
Appends a batch of nodes from a list or from another contour onto the end of this contour. |
appendMapped |
function | (self, flContour: Any, arg1: QTransform) -> Any |
Like append, but applies a transformation matrix to each incoming node's coordinates before adding it. |
applyTransform |
function | (self) -> Any |
Bakes the contour's accumulated transform matrix into its node coordinates, then resets the matrix to identity. |
assign |
function | (self, *args: Any, **kwargs: Any) -> Any |
Completely replaces this contour's content with the nodes from another contour, a fontgate contour, or a list. |
assignOwner |
function | (self) -> Any |
Re-attaches this contour to its owning flShape. |
at |
function | (self, index: int) -> flNode |
Returns the node at the given index. |
autoG2 |
function | (self, tolerance: float) -> Any |
Automatically applies G2 continuity to any smooth nodes whose handles are within tolerance of the G2-optimal position. |
beautify |
function | (self, precision: Any=...) -> bool |
Applies FontLab's automatic curve-quality improvement algorithm to the entire contour. |
bindDependencies |
function | (self) -> Any |
Rebuilds internal links between this contour and any dependent objects (such as component references). |
boundingBox |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns the axis-aligned bounding box of the contour, optionally after applying a transform. |
bounds |
attribute | Any |
The bounds of the contour as tuple (xMin, yMin, xMax, yMax) or None |
breakContour |
function | (self, *args: Any, **kwargs: Any) -> Any |
(flContour, flNode, flNode)/Nothing breakContour(flNode) | flContour/Nothing breakContour(int node_ix) |
breakContourExpanded |
function | (self, *args: Any, **kwargs: Any) -> Any |
FlContour/Nothing breakContourExpanded(int node_ix | flNode [, float extrapolate_d] |
calculate |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns the exact point on the contour at parameter t. |
changed |
function | (self) -> Any |
(shared captured text) |
checkInitHistoryState |
function | (self, history_ix: int) -> Any |
(shared captured text) |
checkSmooth |
function | (self) -> Any |
Scans the contour's nodes and corrects any smooth flags that are inconsistent with the actual handle geometry. |
clearAboveHistory |
function | (self, history_ix: int) -> Any |
(shared captured text) |
clearFlag |
function | (self, f: int) -> Any |
(shared captured text) |
clearFlags |
function | (self) -> Any |
(shared captured text) |
clearNodes |
function | (self) -> Any |
Removes every node from the contour, leaving it empty. |
clockwise |
attribute | Any |
Bool indicating if the contour’s winding direction is clockwise |
clone |
function | (self, *args: Any, **kwargs: Any) -> Any |
Clone the object (shared captured text) |
cloneMapped |
function | (self, *args: Any, **kwargs: Any) -> Any |
Creates a transformed copy of the contour (or a portion of it). |
cloneMappedByT |
function | (self, tx: QTransform, t0: float, t1: float) -> flContour |
Like cloneMapped but uses standard t coordinates to specify the range. |
cloneObject |
function | (*args: Any, **kwargs: Any) -> Any |
(shared captured text) |
cloneSelected |
function | (self, ignore_alone: Any=...) -> Any |
Clones only the selected portions of the contour, returning them as separate contour objects. |
closed |
attribute | Any |
Closed attribute |
closedT1 |
attribute | Any |
ClosedT1 attr |
compare |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deeply compares two contours for shape equality within error tolerance, and returns the offset vector between them if they match. |
contains |
function | (self, QPointF: Any) -> bool |
Returns True if the given point or the entirety of the given contour lies inside this contour's filled area. |
convertExToT |
function | (self, arg0: float) -> float |
Converts an extended-parameter ex_t back to a standard t value. |
convertTTtoCurve |
function | (self) -> Any |
Converts a TrueType-flavored contour (using quadratic off-curve nodes) to PostScript-style cubic Bézier curves. |
convertToFgContour |
function | (self, *args: Any, **kwargs: Any) -> Any |
Exports this contour to a low-level fgContour object (the underlying fontgate representation). |
convertTtoEx |
function | (self, arg0: float) -> float |
Converts a standard t value to the extended-parameter format ex_t. |
createObject |
function | (*args: Any, **kwargs: Any) -> Any |
FlObject/Nothing createObject(int); (shared captured text) |
currentHistoryState |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
curvature |
function | (self, arg0: float) -> float |
Returns the curvature (in 1/units) at t. |
derivative |
function | (self, arg0: float) -> QPointF |
Returns the first derivative (tangent vector) at t. |
distanceBetween |
function | (self, t0: float, step: Any=...) -> float |
Estimates the arc distance between two parameter values by numerical integration. |
draw |
function | (self, pen: Any) -> Any |
Draw the contour’s outline data to the given type-pen |
drawPoints |
function | (self, *args: Any, **kwargs: Any) -> Any |
Draw the contour’s outline data to the given type-point-pen |
extrapolateFirst |
function | (self, arg0: float) -> Any |
Extends the open contour from its first node by the given distance along the tangent direction. |
extrapolateLast |
function | (self, arg0: float) -> Any |
Extends the open contour from its last node by the given distance along the tangent direction. |
fastAppend |
function | (self, *args: Any, **kwargs: Any) -> Any |
A performance-optimized version of append that batches the work and skips intermediate update notifications. |
fastClone |
function | (self, ex_t0: float, ex_t1: float) -> flContour |
Creates a new contour that covers the portion of this contour between ex_t0 and ex_t1 (in extended-parameter coordinates). |
fastCloneByT |
function | (self, t0: float, t1: float) -> flContour |
Same as fastClone but uses standard t parameter coordinates. |
find |
function | (self, *args: Any, **kwargs: Any) -> Any |
Searches for a node whose position is within tolerance units of p and matches the given type. |
findNearest |
function | (self, *args: Any, **kwargs: Any) -> Any |
(float out_nearest_t, float dist)/Nothing findNearest(QPointF shape_p[, int orientation=0]) |
findNearestNode |
function | (self, *args: Any, **kwargs: Any) -> Any |
(flNode, float new_maxd)/Nothing findNearestNode(QPointF p, flNode::NodeType node_type, float maxd) |
findNearestOn |
function | (self, p: QPointF, base_t: float) -> Any |
Float out_nearest_t/Nothing findNearestOn(QPointF p, float base_t) |
findNode |
function | (self, name: Any) -> Any |
FlNode/Nothing findNode(uint id | string name) |
first |
attribute | Any |
First node |
flObjectFlags |
attribute | dict |
(shared captured text) |
flag |
function | (self, f: int) -> Any |
(shared captured text) |
font |
attribute | Any |
The contour’s parent font |
getBoundedT |
function | (self, param_t: float, radius: float) -> float |
Returns t adjusted to stay at least radius arc-units away from any segment boundary. |
getChangesRect |
function | (self) -> QRectF |
Returns the rectangle that covers the area most recently modified in this contour. |
getFirstPoint |
function | (self, *args: Any, **kwargs: Any) -> Any |
QPointF/Nothing getFirstPoint([int =0]) |
getLastPoint |
function | (self, *args: Any, **kwargs: Any) -> Any |
QPointF/Nothing getLastPoint([int =0]) |
getLength |
function | (self, int: Any=10) -> float |
Estimates the arc length of the entire contour, or of the portion between t0 and t1. |
getLengthSquareBRect |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns three things at once: the enclosed area, the arc length, and the bounding rectangle for the contour segment between t0 and t1. |
getNext |
function | (self, *args: Any, **kwargs: Any) -> Any |
FlNode/Nothing getNext(index[, flNode::NodeType=flNode::On]) |
getNextT |
function | (self, *args: Any, **kwargs: Any) -> Any |
Advances base_t forward by arc-length offset along the contour. |
getNodeAt |
function | (self, *args: Any, **kwargs: Any) -> Any |
FlNode/Nothing getNodeAt(int idx[, flNode::NodeType = flNode::AnyNodeMask]) |
getPoint |
function | (self, *args: Any, **kwargs: Any) -> Any |
QPointF/Nothing getPoint(int idx[, flNode::NodeType = flNode::On]) |
getPrev |
function | (self, *args: Any, **kwargs: Any) -> Any |
FlNode/Nothing getPrev(index[, flNode::NodeType=flNode::On]) |
getPrevT |
function | (self, *args: Any, **kwargs: Any) -> Any |
Same as getNextT but moves backward along the contour. |
getProperties |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get object's properties list (shared captured text) |
getProperty |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get object property by 'key' or number (shared captured text) |
getPropertyFloat |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get float object property by 'key' (shared captured text) |
getPropertyInt |
function | (self, *args: Any, **kwargs: Any) -> Any |
Get int object property by 'key' (shared captured text) |
getSegment |
function | (self, i0: int, i1: int, left: bool) -> Any |
Extracts the subsequence of nodes between indices i0 and i1. |
getSelectedBoundingBox |
function | (self) -> QRectF |
Returns the bounding box that encloses all currently selected nodes. |
getSelectedNodes |
function | (self) -> Any |
Returns only the nodes that are currently selected. |
getSquare |
function | (self) -> float |
Returns the signed area enclosed by the contour using the shoelace formula. |
getT |
function | (self, arg0: flNode) -> float |
Returns the parameter t corresponding to a specific node. |
getUpdateRect |
function | (self, ex_t: float) -> QRectF |
Returns the bounding rectangle around the area of the contour that would be affected by a change at extended-parameter position ex_t. |
glyph |
attribute | Any |
The contour’s parent glyph |
hasChanges |
attribute | Any |
(shared captured text) |
hasCorners |
attribute | Any |
True if the contour contains any corner (non-smooth) on-curve nodes. |
hasHistoryState |
function | (self, history_ix: int) -> Any |
(shared captured text) |
hasHistoryStates |
attribute | Any |
(shared captured text) |
hasIntersPoints |
function | (self, arg0: flContour) -> bool |
Returns True if this contour and the given contour have any intersection points. |
hasSelected |
function | (self, SelectionMode: Any) -> bool |
Returns True if at least one node satisfying the given SelectionMode criteria is selected. |
hasSmartAngle |
attribute | Any |
True if any node in the contour has the Smart Angle feature active. |
haveObject |
function | (*args: Any, **kwargs: Any) -> Any |
(shared captured text) |
historyStates |
function | (self, accepted_state: bool) -> Any |
(shared captured text) |
id |
attribute | Any |
Object id (shared captured text) |
improve |
function | (self) -> bool |
A single pass of FontLab's handle-improvement algorithm, focusing on tension and balance. |
indentParamT |
function | (self, base_t: float, step: Any=...) -> float |
Returns a t value that is indent arc-units away from base_t, useful for placing marks or nodes inset from a reference position. |
independedAll |
function | (self) -> Any |
(shared captured text) |
initialHistoryState |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
inkBox |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns the ink bounding box — the tightest rectangle around the filled area of the contour. |
insert |
function | (self, *args: Any, **kwargs: Any) -> Any |
Inserts one node or a list of nodes at the given position, shifting existing nodes to make room. |
insertNodeTo |
function | (self, t: float) -> flNode |
Inserts a new node at the exact parametric position t, splitting the segment at that point. |
insertSafeNodeTo |
function | (self, t: float, dst: float) -> flNode |
Like insertNodeTo, but only inserts the node if it is at least dst em units away from any existing node, preventing the creation of degenerate near-zero segments. |
instanceType |
function | (*args: Any, **kwargs: Any) -> Any |
(shared captured text) |
isAllNodesSelected |
function | (self) -> bool |
Returns True only if every single node in the contour is currently selected. |
isChanged |
attribute | Any |
(shared captured text) |
isCompatible |
function | (self, arg0: flContour, strong: bool) -> bool |
Returns True if the given contour has the same number and type of nodes as this one — a requirement for variable font interpolation. |
isComplete |
attribute | Any |
True if the contour is in a fully initialized and consistent state — all node links valid and indices up to date. |
isEqual |
function | (self, arg0: flObject) -> Any |
(shared captured text) |
isFirst |
function | (self, arg0: flNode) -> bool |
Returns True if the given node is the start (first) node of this contour. |
isLast |
function | (self, arg0: flNode) -> bool |
Returns True if the given node is the last node in this contour. |
isNull |
attribute | Any |
(shared captured text) |
isPresent |
attribute | Any |
(shared captured text) |
isReleased |
attribute | Any |
(shared captured text) |
isSelected |
function | (self, arg0: float) -> bool |
Returns True if the contour is considered "selected" — meaning enough of its nodes are selected within the given tolerance. |
isTT |
attribute | Any |
Is truetype |
isValid |
attribute | Any |
(shared captured text) |
last |
attribute | Any |
Last node |
layer |
attribute | Any |
The contour’s parent layer |
mapParamT |
function | (self, arg0: float, arg1: float, arg2: float) -> float |
Remaps a t value from one parametric range to another. |
move |
function | (self, arg0: QPointF) -> Any |
Translates the entire contour — every node — by the given offset vector. |
name |
attribute | Any |
Object name (shared captured text) |
nodes |
function | (self) -> Any |
Returns a fresh list containing every node in the contour — both on-curve and off-curve. |
nodesCount |
attribute | Any |
Nodes count |
normalAt |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns the angle of the normal (perpendicular to the tangent) at t. |
normalPoint |
function | (self, t: float, length: float) -> QPointF |
Returns a point that is length units away from the contour at t, measured along the normal direction. |
normalizeExT |
function | (self, arg0: float) -> float |
Normalizes an extended-parameter value to lie within the valid range of the contour. |
paramT0 |
attribute | Any |
ParamT0 attr |
paramT1 |
attribute | Any |
ParamT1 attr |
path |
function | (self) -> QPainterPath |
Returns the full contour as a QPainterPath object, which can be used with Qt's drawing primitives or for hit-testing. |
pointInside |
function | (self, pt: QPointF) -> Any |
Bool indicating if the point pt in the black area of the contour |
pointf |
function | (self, index: int) -> QPointF |
A quick way to get the position of the on-curve node at index without retrieving the full node object. |
prevLast |
attribute | Any |
Last but one node |
propertyNames |
function | (self, *args: Any, **kwargs: Any) -> Any |
PropertyNames(): sorted snapshot of dynamic property keys (shared captured text) |
refCnt |
attribute | Any |
Object references count (shared captured text) |
release |
function | (self) -> Any |
(shared captured text) |
remove |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
removeAt |
function | (self, index: int) -> Any |
Removes the node at the given index. |
removeChild |
function | (self, arg0: flObject) -> Any |
(shared captured text) |
removeLast |
function | (self) -> Any |
Removes the last node in the contour. |
removeNodesBetween |
function | (self, prev: flNode, next: flNode) -> Any |
Removes all nodes that lie between prev and next in the node sequence. |
removeOne |
function | (self, arg0: flNode) -> Any |
Removes a specific node object from the contour. |
replace |
function | (self, old_node: flNode, new_node: flNode) -> Any |
Swaps one specific node for another, preserving its position in the contour. |
restoreHistoryState |
function | (self, history_ix: int) -> Any |
(shared captured text) |
reverse |
function | (self) -> Any |
Reverse the direction of the contour |
reversed |
attribute | Any |
True if the contour has been reversed relative to its original orientation. |
secondDerivative |
function | (self, arg0: float) -> QPointF |
Returns the second derivative at t, which is used for curvature calculations. |
segment |
function | (self, t: float) -> Any |
CurveEx/Nothing segment(float t) |
segments |
function | (self) -> Any |
Returns all the Bézier segments of the contour as a list of CurveEx objects. |
selectedPath |
function | (self) -> QPainterPath |
Returns only the selected portions of the contour as a QPainterPath. |
selection |
attribute | Any |
Selection list (list<bool>) |
selectionChanged |
function | (self) -> Any |
Notifies FontLab's display system that the selection state has changed and the view should be updated. |
setFlag |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
setNext |
function | (self, int: Any, arg1: QPointF) -> flNode |
Sets the position of the off-curve handle after the on-curve node at index. |
setPoint |
function | (self, index: int, p: QPointF) -> flNode |
Moves the node at index to position p and returns the updated node. |
setPrev |
function | (self, int: Any, arg1: QPointF) -> flNode |
Sets the position of the off-curve handle before the on-curve node at index. |
setProperty |
function | (self, *args: Any, **kwargs: Any) -> Any |
Set object property by 'key' or number (shared captured text) |
setPropertyFloat |
function | (self, *args: Any, **kwargs: Any) -> Any |
Set float object property by 'key' (shared captured text) |
setPropertyInt |
function | (self, *args: Any, **kwargs: Any) -> Any |
Set int object property by 'key' (shared captured text) |
setSelectedNodes |
function | (self, bool: Any) -> Any |
Selects all nodes if True, or deselects all nodes if False. |
setStartPoint |
function | (self, i: int) -> bool |
Rotates the contour's node list so that the node at index i becomes the first node. |
simplify |
function | (self, precision: float, lossy: bool, extremes: bool) -> Any |
Removes unnecessary nodes while keeping the contour's shape within precision em units of the original. |
tag |
function | (self, *args: Any, **kwargs: Any) -> Any |
(shared captured text) |
takeNodes |
function | (self) -> Any |
Removes all nodes from the contour and returns them as a list. |
tangent |
function | (self, t: float) -> float |
Returns the tangent angle at t in degrees, measured from the positive X axis. |
toBeziers |
function | (self, tolerance: float) -> Any |
Approximates any spline segments in the contour as standard cubic Bézier curves, within the given tolerance in em units. |
toSplines |
function | (self, tolerance: float, short_splines: bool) -> Any |
The reverse of toBeziers — converts cubic Bézier curves to quadratic splines for TrueType output. |
transform |
attribute | Any |
Transform matrix |
type |
attribute | Any |
Object type (shared captured text) |
unselectAll |
function | (self) -> Any |
Deselects every node in the contour. |
unselectedPath |
function | (self) -> QPainterPath |
Returns the unselected portions of the contour as a QPainterPath. |
update |
function | (self) -> Any |
(shared captured text) |
updateG2 |
function | (self, all_nodes: bool) -> Any |
Recalculates G2 curvature-continuity flags across the contour. |
updateHobby |
function | (self, all_nodes: bool) -> Any |
Updates Hobby-spline tension data for the contour. |
updateIndices |
function | (self) -> Any |
Recalculates all cached node index values. |
validateExT |
function | (self, *args: Any, **kwargs: Any) -> Any |
Same as validateT but for extended-parameter values. |
validateIndex |
function | (self, *args: Any, **kwargs: Any) -> Any |
Clamps a node index to the valid range [0, nodesCount-1] and reports whether clamping occurred. |
validateSmartR |
function | (self, *args: Any, **kwargs: Any) -> Any |
Validates a Smart Angle radius for the node at node_ix, returning the clamped radius, the maximum available radius given the neighboring geometry, and a flag indicating if clamping occurred. |
validateT |
function | (self, *args: Any, **kwargs: Any) -> Any |
Clamps t to the valid range for this contour and returns both the clamped value and a flag indicating whether it was changed. |
validatedT |
function | (self, t: float) -> float |
A simpler version of validateT that returns just the clamped t without the changed-flag. |
verifySmooth |
function | (self) -> Any |
Similar to checkSmooth but performs stricter validation and may raise an assertion if inconsistencies are found. |