Skip to content

fontlab.flPropertyDouble

flPropertyDouble

Scalar axis-driven attribute.

What is flPropertyDouble?

flPropertyDouble wraps a single numeric value (like a node's x-coordinate, a corner radius, or a stem width) and pairs it with an optional formula that computes the value from axis coordinates. When the designer moves the design-space location slider, the expression is re-evaluated and the owning object's attribute updates automatically.

This is the most commonly encountered property type in parametric FontLab shapes — smart corners, engraving elements, and scriptable parametric components all expose their numeric parameters as flPropertyDouble objects.

Tutorial

The most practical use of flPropertyDouble in scripting is reading and optionally overriding a parametric shape's numeric parameters.

import fontlab as fl

# ============================================================
# Read all scalar axis-driven values from a parametric shape.
# This prints each parameter name, its current value, and the
# formula (if any) that is driving it.
# ============================================================

font  = fl.CurrentFont()
glyph = font['A']   # use a glyph that has smart-corner shapes
layer = glyph.layers[0]

for shape in layer.shapes:
    proc = getattr(shape, "propertiesProcessor", None)
    if proc is None:
        continue
    print(f"Shape properties ({len(proc.properties)}):")
    for attr, prop in proc.properties.items():
        try:
            val  = prop.value
            expr = prop.expression.expression if prop.expression else ""
            driven = "formula-driven" if expr else "fixed"
            print(f"  {attr:15s} = {val:8.2f}  ({driven})"
                  + (f"  formula: '{expr}'" if expr else ""))
        except AttributeError:
            pass  # not a scalar property

# ============================================================
# Override a parametric value with a fixed number.
# Useful when you want to "freeze" a parameter at a specific
# value regardless of where the design-space slider is.
# ============================================================

for shape in layer.shapes:
    proc = getattr(shape, "propertiesProcessor", None)
    if proc is None:
        continue
    for attr, prop in proc.properties.items():
        if attr == "radius":   # example: freeze the corner radius
            prop.value = 50.0
            print(f"Set {attr} = 50.0 (fixed)")

# Re-evaluate to apply the new value:
if layer.shapes and layer.shapes[0].propertiesProcessor:
    layer.shapes[0].propertiesProcessor.process()
    fl.Update()

Common Scripting Patterns

Collect all formula-driven scalar values across the font

import fontlab as fl

font = fl.CurrentFont()
for glyph in font.glyphs:
    for layer in glyph.layers:
        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}/{layer.name}/{attr}: "
                              f"'{prop.expression.expression}'")
                except AttributeError:
                    pass

objectAttr is registered on flProperty, but not inherited into the current flPropertyDouble binding. Do not assume the C++ inheritance tree exposes every base property in Python.

Inherited binding members: flObject.

Constructors:

Native bases: object

Captured native MRO: flPropertyDouble, 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 numeric property. The captured declaration exposes the attributes value, expression. It is created with no captured constructor overloads. It also carries the shared object members changed, clone, cloneObject, getProperty, setProperty, release, remove and update and the shared attributes id, name, type, isValid and isNull.

Source: FontLab Proteus API documentation

Source: generated/fontlab.py: flPropertyDouble 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)
expression attribute Any The formula that computes this property's value.
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)
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)
value attribute Any The current numeric value of this property.