Scripting with Smart Components

Any way to do things with smart components via scripting?

In particular, I want to do something to ease the UFO export:

  1. I want to find all glyphs that have a smart component which is at a interpolated instance or the other master instance (i.e. not the default component that will appear when exporting a UFO),
  2. Then I’d like to decompose only these smart components.

Why don’t you check if component name contains “_part.”?

Great idea! Is there a way to get the axis values — in particular, to find any component where it’s pieceSetting is at a value > minimum for any of the axis?

There is, but it’s probably safer to decompose all part components anyway if UFO export is the purpose.

Anyway, it’s like this: component.pieceSettings()[“axis name”]

To get what axis is available and extreme value of each axis, you need to look at the actual glyph ( glyph.partsSettings() ). Parts settings include topValue() and bottomValue().

1 Like