Skip to content

fontlab.flProperty

flProperty

Base class for axis-aware attributes.

What is flProperty?

In a variable font, certain values — a node's x-coordinate, a guideline's position, a stem width — need to change smoothly as you move between masters. Instead of storing a single fixed number, these attributes store an flProperty object: a "smart slot" that knows the attribute's name and can hold an expression formula to be evaluated at any point in design space.

flProperty is the root base class. It is never used directly — you will always encounter one of its concrete subclasses: flPropertyDouble (for a single number) or flPropertyPoint (for an x,y coordinate). Understanding this base class helps you write scripts that inspect or modify axis-driven values in parametric shapes and smart components.

Tutorial

Properties come up when you inspect the properties map on a parametric shape or guideline. This example shows how to walk through a shape's properties and read each one's attribute name.

import fontlab as fl

# ============================================================
# Inspect axis-driven properties on a parametric shape.
# Parametric shapes (smart corners, engraving elements) store
# their driven values in a flPropertiesProcessor.
# ============================================================

font  = fl.CurrentFont()
glyph = font['A']
layer = glyph.layers[0]

for shape in layer.shapes:
    processor = shape.propertiesProcessor   # may be None
    if processor is None:
        continue
    props = processor.properties   # dict-like: attr_name → property
    if not props:
        continue
    print(f"Shape has {len(props)} axis-driven property/ies:")
    for attr_name, prop in props.items():
        # prop.objectAttr tells you which attribute it controls:
        print(f"  attr='{prop.objectAttr}'")
        # Cast to flPropertyDouble to read the value:
        try:
            value = prop.value
            expr  = prop.expression.expression if prop.expression else ""
            print(f"    value={value:.2f}  formula='{expr}'")
        except AttributeError:
            print(f"    (not a scalar property)")

Common Scripting Patterns

Check whether any property on a shape has an active expression

import fontlab as fl

font  = fl.CurrentFont()
glyph = font['A']
layer = glyph.layers[0]

for shape in layer.shapes:
    proc = getattr(shape, "propertiesProcessor", None)
    if not proc:
        continue
    for attr, prop in proc.properties.items():
        try:
            if prop.expression and prop.expression.hasExpression():
                print(f"'{glyph.name}' / '{attr}' is formula-driven: "
                      f"'{prop.expression.expression}'")
        except AttributeError:
            pass

Inherited binding members: flObject.

Constructors:

Native bases: object

Captured native MRO: flProperty, 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 property object. The captured declaration exposes the property accessors getProperty, getPropertyInt, getPropertyFloat, setProperty, setPropertyInt and setPropertyFloat, and the attribute objectAttr. It is created with no captured constructor overloads. It also carries the shared object members name, id, type, isValid, release and remove.

Source: FontLab Proteus API documentation

Source: generated/fontlab.py: flProperty 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
__init__ function (self, /, *args: Any, **kwargs: Any) -> None Initialize self. (shared captured text)
changed function (self) -> Any (shared captured text)
checkInitHistoryState function (self, history_ix: int) -> Any (shared captured text)
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)
clone function (self, *args: Any, **kwargs: Any) -> Any Clone the object (shared captured text)
cloneObject function (*args: Any, **kwargs: Any) -> Any (shared captured text)
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)
flObjectFlags attribute dict (shared captured text)
flag function (self, f: int) -> Any (shared captured text)
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)
hasChanges attribute Any (shared captured text)
hasHistoryState function (self, history_ix: int) -> Any (shared captured text)
hasHistoryStates attribute Any (shared captured text)
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)
independedAll function (self) -> Any (shared captured text)
initialHistoryState function (self, *args: Any, **kwargs: Any) -> Any (shared captured text)
instanceType function (*args: Any, **kwargs: Any) -> Any (shared captured text)
isChanged attribute Any (shared captured text)
isEqual function (self, arg0: flObject) -> Any (shared captured text)
isNull attribute Any (shared captured text)
isPresent attribute Any (shared captured text)
isReleased attribute Any (shared captured text)
isValid attribute Any (shared captured text)
name attribute Any Object name (shared captured text)
objectAttr attribute Any The attribute name (key) on the owning object that this property represents.
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)
removeChild function (self, arg0: flObject) -> Any (shared captured text)
restoreHistoryState function (self, history_ix: int) -> Any (shared captured text)
setFlag function (self, *args: Any, **kwargs: Any) -> Any (shared captured text)
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)
tag function (self, *args: Any, **kwargs: Any) -> Any (shared captured text)
type attribute Any Object type (shared captured text)
update function (self) -> Any (shared captured text)