Skip to main content

NamedInstanceInfo

Class

Read-only named axis preset from the font's fvar table, for example "Condensed Bold".

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Since Lens Scripting v372

Read-only named axis preset from the font's fvar table, for example "Condensed Bold". Returned from Font#namedInstances. Apply one by setting a Text#preferredStyle on a Text component to the instance's NamedInstanceInfo#name.

Index

Example

//@input Asset.Font fontAsset
//@input Component.Text text

var instances = script.fontAsset.namedInstances;
for (var i = 0; i < instances.length; ++i) {
print(instances[i].name + " -> [" + instances[i].coordinates.join(", ") + "]");
}
if (instances.length > 0) {
script.text.preferredStyle = instances[0].name;
}

Properties

coordinates

readonly coordinates: number[]

Axis values for this instance, indexed to match Font#variationAxes.

Since

Lens Scripting Version 372


name

readonly name: string

Instance name, for example "Condensed Bold".

Since

Lens Scripting Version 372

Methods

getTypeName()

static getTypeName(): TypeName<NamedInstanceInfo>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<NamedInstanceInfo>

Since

Lens Scripting Version 372


toString()

toString(): string

Debug-friendly string, e.g. {name: "Bold", coordinates: [700, 100]}.

Returns

string

Since

Lens Scripting Version 372