Skip to content

fontlab.flObject · declarations 001

Back to fontlab.flObject

changed

changed() -> Any

changed()

Marks this object as "dirty" — it has unsaved changes. FontLab uses this to decide whether to prompt for saving and to trigger redraws. After bulk edits in a script, calling changed() followed by fl.Update() ensures the interface reflects your work.

Source: FontLab Proteus API documentation

checkInitHistoryState

checkInitHistoryState(history_ix: int) -> Any

checkInitHistoryState(uint history_ix)

Checks whether the given state index is the initial (oldest) history state. Returns True if you are already at the beginning and cannot go back further.

Source: FontLab Proteus API documentation

clearAboveHistory

clearAboveHistory(history_ix: int) -> Any

clearAboveHistory(uint history_ix)

Removes all history states above the given index, discarding any redo states beyond that point. Useful when you want to commit a script's changes as the new canonical state and prevent re-doing past the script.

Source: FontLab Proteus API documentation

clearFlag

clearFlag(f: int) -> Any

clearFlag(uint f)

Clears (turns off) flag bit f. After this call, flag(f) will return False. Use this when you want to unmark a specific flag without touching other flags on the same object.

Source: FontLab Proteus API documentation

clearFlags

clearFlags() -> Any

clearFlags()

Clears all flag bits on this object at once, regardless of which ones were set. A useful reset between processing passes when you want a clean slate.

Source: FontLab Proteus API documentation

clone

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

Clone the object

Creates a deep copy of this object. The copy is completely independent — it gets a new unique ID and none of your changes to the clone will affect the original. Use this when you want to add a copy of a shape to a different layer without disturbing the source.

Source: FontLab Proteus API documentation

cloneObject

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

flObject cloneObject(const flObject&);

Creates a deep copy of the given object and returns it. The clone is fully independent — modifying it will not affect the original. This is the class-level version of the instance method clone().

Source: FontLab Proteus API documentation

createObject

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

flObject/Nothing createObject(int);

Allocates a new object of the given type ID and returns it as a generic flObject. The integer argument is the type constant (same system as .type). Returns None if the type is not recognized. You rarely need this — use the concrete subclass constructors instead.

Source: FontLab Proteus API documentation

currentHistoryState

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

currentHistoryIx()

Returns the index of the current history state. Think of this as the "now" pointer in the history timeline. Subtracting 1 and restoring gets you one undo step back.

Source: FontLab Proteus API documentation

flag

flag(f: int) -> Any

flag(uint f)

Returns True if bit flag f is currently set on this object, False otherwise. The argument is a small integer (1, 2, 4, 8, ...) identifying which flag bit to check. You define what each number means in your own scripts.

Source: FontLab Proteus API documentation

getProperties

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

Get object's properties list

Legacy object-valued property list (QList<flObject>); this is not a list of metadata keys and is empty for nodes.

Source: FontLab Proteus API documentation

getProperty

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

getProperty('key') - get object property by 'key' or number

Returns the stored QVariant converted to Python, or None when absent. Strings and numbers retain their types.

Source: FontLab Proteus API documentation

getPropertyFloat

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

getPropertyFloat('key') - get float object property by 'key'

Returns the value stored under the given key as a floating-point number. Saves you from manually calling float() on the string result of getProperty.

Source: FontLab Proteus API documentation

getPropertyInt

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

getPropertyInt('key') - get int object property by 'key'

Returns the value stored under the given key as an integer. A convenience wrapper that handles the string-to-int conversion automatically.

Source: FontLab Proteus API documentation

hasChanges instance-attribute

hasChanges: Any

bool

True if this object has unsaved changes that have not yet been written to disk. FontLab uses this to decide whether to show the "save?" prompt when closing.

Source: FontLab Proteus API documentation

hasHistoryState

hasHistoryState(history_ix: int) -> Any

hasHistoryState(uint history_ix)

Returns True if a history state at the given index exists for this object. Use this before calling restoreHistoryState to avoid errors when navigating near the start or end of the history.

Source: FontLab Proteus API documentation

hasHistoryStates instance-attribute

hasHistoryStates: Any

bool

True if this object has at least one recorded history state. If False, there is nothing to undo/redo for this object.

Source: FontLab Proteus API documentation

haveObject

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

bool haveObject(uint);

Given an object ID (an integer), returns True if an object with that ID currently exists in the font model. Useful for validating stored IDs before trying to use them — for example, after undo operations that might have removed an object.

Source: FontLab Proteus API documentation

historyStates

historyStates(accepted_state: bool) -> Any

historyStates(bool accepted_state)

Returns a list of history state indices for this object. Pass True to get only the committed (accepted) states; pass False to include pending/uncommitted states. Useful for understanding how many undo steps are available.

Source: FontLab Proteus API documentation

id instance-attribute

id: Any

object id

The unique integer identifier assigned to this object when it was created. No two live objects in the same session share an ID. Use this to track objects across operations or to look them up later with haveObject().

Source: FontLab Proteus API documentation

independedAll

independedAll() -> Any

independedAll()

Breaks all dependency links that make this object react to changes in other objects. After calling this, the object stands alone — useful before deleting or repurposing an object that was part of a linked structure.

Source: FontLab Proteus API documentation

initialHistoryState

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

initialHistoryIx()

Returns the index of the oldest available history state — in other words, how far back you can undo. This is the floor of the history range.

Source: FontLab Proteus API documentation

instanceType

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

int instanceType();

Returns the integer type identifier for this class. Every subclass of flObject has a unique type constant — this lets you check "what kind of object is this?" at the class level, before you even have an instance.

Source: FontLab Proteus API documentation

isChanged instance-attribute

isChanged: Any

bool

True if this object has been modified since the last explicit changed() call was processed. Slightly different from hasChanges — this one tracks the in-memory dirty state rather than the disk-save state.

Source: FontLab Proteus API documentation

isEqual

isEqual(arg0: flObject) -> Any

isEqual(flObject)

Compares this object to another for deep equality. Unlike Python's == (which compares references), isEqual checks whether the two objects have the same structural content. Two separately constructed shapes with identical contours will return True.

Source: FontLab Proteus API documentation

isNull instance-attribute

isNull: Any

bool

True if this object handle points to nothing — the C++ pointer is null. This should not happen in normal use, but can occur if you receive an object from a method that failed silently.

Source: FontLab Proteus API documentation

isPresent instance-attribute

isPresent: Any

bool

True if this object is currently part of its parent's collection — for example, a shape that is attached to a layer. When you remove a shape from a layer, isPresent becomes False even though the Python variable still holds a reference.

Source: FontLab Proteus API documentation

isReleased instance-attribute

isReleased: Any

bool

True if this object has been released and its underlying C++ resources have been freed. Accessing properties on a released object is unsafe. Always check isValid before using an object you did not just create yourself.

Source: FontLab Proteus API documentation

isValid instance-attribute

isValid: Any

bool

The safest single validity check. Returns True if the object exists, is not null, and has not been released. Check this before using any object that might have been deleted by an earlier operation in your script.

Source: FontLab Proteus API documentation

name instance-attribute

name: Any

object name

The human-readable name of this object. For a glyph this is the glyph name; for a layer it is the master name; for a shape you can assign any label you like. Setting this property does not affect the object's unique id.

Source: FontLab Proteus API documentation

propertyNames

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

propertyNames(): sorted snapshot of dynamic property keys

Returns a sorted snapshot of the dynamic property keys, including explicitly stored zero values. Pair with getProperty(key) to inspect values.

Source: FontLab Proteus API documentation

refCnt instance-attribute

refCnt: Any

object references count

The number of Python/C++ references currently holding onto this object. When refCnt drops to zero the object may be cleaned up. Primarily a debugging tool — you will rarely need to inspect this in production scripts.

Source: FontLab Proteus API documentation

release

release() -> Any

release()

Releases the internal reference this Python handle holds on the underlying C++ object. After calling this, the object may be garbage-collected if nothing else refers to it. You rarely need to call this explicitly — Python's reference counting handles cleanup.

Source: FontLab Proteus API documentation

remove

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

remove([flObject])

Removes this object from its parent container, or removes the given child object from this object. For example, calling shape.remove() removes it from its layer. This is the safe way to delete an object — it updates all internal bookkeeping.

Source: FontLab Proteus API documentation

removeChild

removeChild(arg0: flObject) -> Any

removeChild(flObject)

Removes a specific child object from this object's children list. Similar to remove(child) but makes the direction explicit — you are acting on a known parent and removing a known child.

Source: FontLab Proteus API documentation

restoreHistoryState

restoreHistoryState(history_ix: int) -> Any

restoreHistoryState(uint history_ix)

Rolls the object back to the history state at the given index. This is how you implement programmatic undo — get the current state index, subtract 1, and call this method.

Source: FontLab Proteus API documentation

setFlag

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

setFlag(uint f [, bool value])

Sets flag f to True (or to the given boolean value if provided). Equivalent to turning a bit on. Call setFlag(f, False) to turn it off, which is the same as calling clearFlag(f).

Source: FontLab Proteus API documentation

setProperty

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

setProperty('key', value) - set object property by 'key' or number

Stores a value under the given key. The value can be a string, int, or float — it is stored as a QVariant. If a property with the same key already exists, its value is replaced.

Source: FontLab Proteus API documentation

setPropertyFloat

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

setPropertyFloat('key', value) - set float object property by 'key'

Stores a float value under the given key, using float-appropriate serialization. Prefer this over setProperty when storing coordinates, weights, or other decimal values, so retrieval with getPropertyFloat round-trips cleanly.

Source: FontLab Proteus API documentation

setPropertyInt

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

setPropertyInt('key', value) - set int object property by 'key'

Stores an integer value under the given key. Use this for counters, indices, or any discrete numeric metadata so it round-trips cleanly with getPropertyInt.

Source: FontLab Proteus API documentation