FL.objects.Component.Component

class FL.objects.Component.Component(component_or_index: Component | int | None = None, delta: Point | None = None, scale: Point | None = None)

Bases: Copyable

Component - class to represent glyph component

Components are defined by the glyph index which they reference, Shift of components origin point and scale factor of a component Scale is measured in relation to 1.0, so 100% scale is 1.0 and 60% - 0.6 This class is Multiple Master - compatible

__init__(component_or_index: Component | int | None = None, delta: Point | None = None, scale: Point | None = None) None
Component()

generic constructor, creates an empty Component

Component(Component)

copy constructor

Component(index)

creates component referencing glyph index with zero shift and 100% scale

Component(index, Point(integer) delta)

creates component referencing glyph index with delta shift and 100% scale

Component(index, Point(integer) delta, Point(float) scale)

creates component referencing glyph index with delta shift and scale factor defined by scale

Parameters:
  • component_or_index (Component | int | None, optional) – _description_. Defaults to None.

  • delta (Point | None, optional) – _description_. Defaults to None.

  • scale (Point | None, optional) – _description_. Defaults to None.

Methods

Get([f])

Creates a glyph from component applying delta and scale transformations.

Paste()

Appends component to a parent glyph as a set of outlines.

__init__([component_or_index, delta, scale])

Component()

fake_deserialize(num_masters, data)

fake_serialize()

Attributes

delta

deltas

list of shift values for each master

index

referencing glyph index

parent

parent object, Glyph

scale

scale factor

scales

list of scale values for each master

Get(f: Font | None = None) Glyph

Creates a glyph from component applying delta and scale transformations.

Font parameter is not needed when component has a parent FIXME: Apparently, the font parameter is always needed

Parameters:

f (Font | None, optional) – _description_. Defaults to None.

Paste() None

Appends component to a parent glyph as a set of outlines.

Component must have a parent

property deltas: list[Point]

list of shift values for each master

Setting the list, or only one item of the list doesn’t work in FL. You need to get one of the points and modify it directly

property index: int

referencing glyph index

property parent: Glyph | None

parent object, Glyph

property scale: Point

scale factor

property scales: list[Point]

list of scale values for each master

Setting the list, or only one item of the list doesn’t work in FL. You need to get one of the points and modify it directly