Skip to content

Common Types & Constants

Value Types

fdl.DimensionsInt(*, width=0, height=0)

Lightweight DimensionsInt value type.

duplicate()

Create a duplicate of this value.

format()

Format as 'W x H', using ints when whole numbers, else 2 decimal places.

fdl.DimensionsFloat(*, width=0.0, height=0.0)

Lightweight DimensionsFloat value type.

duplicate()

Create a duplicate of this value.

format()

Format as 'W x H', using ints when whole numbers, else 2 decimal places.

from_dimensions(dims) classmethod

Create DimensionsFloat from any Dimensions instance.

scale_by(factor)

Scale the dimensions by the provided factor (in-place).

to_int()

Convert to integer dimensions by truncation.

fdl.PointFloat(*, x=0.0, y=0.0)

Lightweight PointFloat value type.

format()

Format as '(X, Y)', using ints when whole numbers, else 2 decimal places.

fdl.Rect(*, x=0.0, y=0.0, width=0.0, height=0.0)

Lightweight Rect value type.


Rounding

fdl.RoundStrategy(*, even=RoundingEven.EVEN, mode=RoundingMode.UP)

Lightweight RoundStrategy value type.

fdl.DEFAULT_ROUNDING_STRATEGY = RoundStrategy(even='even', mode='up') module-attribute


Global Rounding Functions

fdl.set_rounding(strategy)

Set the global default rounding strategy (thread-safe).

fdl.get_rounding()

Get the current global default rounding strategy (thread-safe).


Custom Attribute Name Constants

These named constants identify first-class custom attributes set by canvas template application.

fdl.ATTR_SCALE_FACTOR = 'scale_factor' module-attribute

Custom attribute name for the template scale factor (float).

fdl.ATTR_CONTENT_TRANSLATION = 'content_translation' module-attribute

Custom attribute name for the template content translation (PointFloat).

fdl.ATTR_SCALED_BOUNDING_BOX = 'scaled_bounding_box' module-attribute

Custom attribute name for the template scaled bounding box (DimensionsFloat).