Skip to content

fontlab.flShape · declarations 002

Back to fontlab.flShape

getContours

getContours() -> Any

list(flContour) getContours()

Returns every flContour that belongs to this shape as a Python list. This is the primary way to iterate over contours in a script.

Source: FontLab Proteus API documentation

getNodeAt

getNodeAt(index: int, nodetype: Any) -> Any

flNode/Nothing getNodeAt(int index, flNode::NodeType nodetype)

Returns the node at a global index across all contours, filtered to a specific node type (e.g., on-curve only). Returns None if no matching node exists at that index.

Source: FontLab Proteus API documentation

getSelected

getSelected(SelectionMode: Any) -> Any

list(flContour)/Nothing getSelected(SelectionMode)

Returns the contours (or nodes, depending on SelectionMode) that are currently selected in the UI. Returns None if nothing is selected.

Source: FontLab Proteus API documentation

getSquare

getSquare() -> float

double getSquare()

Returns the signed total area of all contours combined. The sign indicates the dominant winding direction. Useful for sorting shapes into outer (positive area) and inner/counter (negative area) groups.

Source: FontLab Proteus API documentation

getTransformationPermissions

getTransformationPermissions(*args: Any, **kwargs: Any) -> Any

(bool enbl_horz, bool enbl_vert, bool enbl_rotation) getTransformationPermissions()

Returns a tuple of three booleans indicating whether horizontal movement, vertical movement, and rotation are permitted on this shape. Some parametric shapes lock certain axes.

Source: FontLab Proteus API documentation

hasBody instance-attribute

hasBody: Any

bool

True if the shape contains at least one contour with drawing content. A shape can exist on a layer but have an empty or placeholder state; this property tells you if there's anything to render.

Source: FontLab Proteus API documentation

hasComponents instance-attribute

hasComponents: Any

bool

True if this shape references one or more component shapes (shapes from other glyphs). Check this before attempting to directly edit contours, since components cannot be edited until decomposed.

Source: FontLab Proteus API documentation

hasContours instance-attribute

hasContours: Any

bool

True if the shape has any contour data at all. Similar to hasBody but checks at a lower level — hasBody implies hasContours, but not vice versa.

Source: FontLab Proteus API documentation

hasGlobalAnchoring instance-attribute

hasGlobalAnchoring: Any

bool

True if this shape uses global anchoring — a system where the shape's position is determined by an anchor rather than a free transform. Common in diacritic components.

Source: FontLab Proteus API documentation

hasImage

hasImage(bitmap_only: bool) -> bool

bool hasImage(bool bitmap_only)

Returns True if this shape contains image data. With bitmap_only=True, returns True only for raster/bitmap images, not vector images.

Source: FontLab Proteus API documentation

hasPath instance-attribute

hasPath: Any

bool

True if the shape has a valid Qt painter path cached. If False, call ensurePaths() before trying to use closedPath or openedPath.

Source: FontLab Proteus API documentation

hasSelected

hasSelected(SelectionMode: Any) -> bool

bool hasSelected(SelectionMode)

Returns True if there is anything selected in this shape matching the given selection mode. A quick existence check before calling getSelected.

Source: FontLab Proteus API documentation

hasSmartAngle instance-attribute

hasSmartAngle: Any

bool

True if any nodes in this shape are smart-angle nodes (nodes that carry automatic corner angle data). These nodes are used with smart-corner features in FontLab.

Source: FontLab Proteus API documentation

haveActiveShape instance-attribute

haveActiveShape: Any

bool

True if a sub-shape within this composite is currently active. Only meaningful for composite shapes.

Source: FontLab Proteus API documentation

haveClosed instance-attribute

haveClosed: Any

bool

True if at least one closed contour exists in this shape. Closed contours are normal filled outlines.

Source: FontLab Proteus API documentation

haveData instance-attribute

haveData: Any

bool

True if the shape has any data at all — contours, composites, or images. Equivalent to not isEmpty.

Source: FontLab Proteus API documentation

haveUnclosed instance-attribute

haveUnclosed: Any

bool

True if any open contours exist. Shapes used with the Stroke element or for guides/rules may have open contours.

Source: FontLab Proteus API documentation

horzReflection

horzReflection() -> bool

bool horzReflection()

Returns True if this shape has a horizontal reflection flag set, meaning it is mirrored left-to-right.

Source: FontLab Proteus API documentation

image instance-attribute

image: Any

QImage

The bitmap image data for image-type shapes. Reading this property gives you a QImage object; writing it replaces the shape's image. Only meaningful when hasImage() returns True.

Source: FontLab Proteus API documentation

imagePtr instance-attribute

imagePtr: Any

QImage *

Low-level pointer to the image data. Used when interfacing with C++/Qt image-processing code. Most scripts should use the image property instead.

Source: FontLab Proteus API documentation

include

include(*args: Any, **kwargs: Any) -> Any

include(list(flShape) | flShape, [ flLayer remove_from])

Adds one or more shapes as children of this composite shape. If you pass a layer as the second argument, the shapes are simultaneously removed from that layer. This is how you build a composite element from existing free shapes.

Source: FontLab Proteus API documentation

includeTo

includeTo(ix: int, arg1: flShape) -> Any

includeTo(int ix, flShape)

Inserts a shape into the include list at a specific position rather than appending at the end. Lets you control the stacking order of sub-shapes within the composite.

Source: FontLab Proteus API documentation

includesList instance-attribute

includesList: Any

list(flShape)

The list of child shapes contained within this composite shape. Empty list for simple shapes. Equivalent to calling shapeData.includesList().

Source: FontLab Proteus API documentation

inkBox

inkBox(tx: Any = ...) -> QRectF

QRectF inkBox([QTransform tx = QTransform()])

Returns the bounding rectangle of the shape's actual ink (visible filled area), optionally transformed by tx. More accurate than boundingBox for shapes with open paths or strokes.

Source: FontLab Proteus API documentation

isCompatible

isCompatible(arg0: flShape, strong: bool) -> bool

bool isCompatible(flShape, bool strong)

Checks whether this shape and another are interpolation-compatible — meaning they have the same number of nodes in the same order. With strong=True, also checks start node alignment. Required for variable fonts.

Source: FontLab Proteus API documentation

isComponent instance-attribute

isComponent: Any

bool

True if this shape is a component reference — its drawing data comes from another glyph's shape, not from locally stored contours.

Source: FontLab Proteus API documentation

isComposite instance-attribute

isComposite: Any

bool

True if this shape is a composite — it contains other shapes as children in an include list.

Source: FontLab Proteus API documentation

isEmpty instance-attribute

isEmpty: Any

bool

True if the shape has no contours, no composites, and no image. An empty shape is essentially a placeholder.

Source: FontLab Proteus API documentation

isShape

isShape(arg0: flObject) -> bool

bool isShape(flObject)

Tests whether a generic flObject reference is actually an flShape. Handy when iterating a mixed-type list and you want to filter for shapes only.

Source: FontLab Proteus API documentation

isUnbindedDependencies instance-attribute

isUnbindedDependencies: Any

bool

True if this shape has unresolved dependency links — for example, a parametric element whose source data is missing. Call bindDependencies() to attempt resolution.

Source: FontLab Proteus API documentation

isUniform instance-attribute

isUniform: Any

bool

True if all contours in this shape wind in the same direction. Mixed winding (outer + inner/counter contours with correct opposite winding) is normal; this flag being True can indicate an issue with contour direction.

Source: FontLab Proteus API documentation

mergeTopComposite

mergeTopComposite() -> Any

mergeTopComposite()

Collapses the topmost composite level, merging its children's contours directly into this shape. Useful for selectively flattening one level of a nested composite without fully decomposing.

Source: FontLab Proteus API documentation

opacity instance-attribute

opacity: Any

double

Display opacity of the shape, from 0.0 (fully transparent) to 1.0 (fully opaque). Affects how the shape renders in the editor and in colour fonts.

Source: FontLab Proteus API documentation

openedPath instance-attribute

openedPath: Any

QPainterPath

A Qt painter path containing only the open contours. Open contours are common in stroke-based workflows and some decorative elements.

Source: FontLab Proteus API documentation

pen instance-attribute

pen: Any

QPen

The live-stroke pen: controls brush/color, width, join, miter limit, and basic caps. Qt.NoPen disables the stroke. For independent start/end caps and other native stroke settings, use penParameters.

Source: FontLab Proteus API documentation

penParameters instance-attribute

penParameters: Any

dict: stroke parameters (thickness, proportion, contrast, rotation, join, miter_limit, remove_overlap, cap0/cap1, cap_*0/1)

Read/write native stroke settings, including thickness, proportion, contrast, rotation, cap0/cap1, join, and miter limit. See Stroke scripting below for units, defaults, and replacement semantics.

Source: FontLab Proteus API documentation

prepareTransformationData

prepareTransformationData() -> Any

prepareTransformationData()

Caches the current geometry so that interactive transformations (rotate, scale) work smoothly. Must be called before applying a transform to this shape.

Source: FontLab Proteus API documentation

removeAnchor

removeAnchor(arg0: flAnchor) -> Any

removeAnchor(flAnchor)

Removes a specific anchor from this shape. The anchor object must be the one you obtained from getAnchors().

Source: FontLab Proteus API documentation

removeAnchorsForObject

removeAnchorsForObject(arg0: flObject) -> Any

removeAnchorsForObject(flObject)

Removes all anchors on this shape that are linked to the specified object. Useful for cleaning up anchors that referenced a guideline or node that has been deleted.

Source: FontLab Proteus API documentation

removeBackContour

removeBackContour() -> Any

removeBackContour()

Removes the contour that is at the back of the stacking order (the last one added, or the lowest in the list). Quick shortcut when you know you want to undo your most recent addContour.

Source: FontLab Proteus API documentation