Skip to main content

FontCollectionEntry

Class

Represents a single entry in a FontCollection.

  • 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 v356

Represents a single entry in a FontCollection. Each entry holds an asset reference (either a Font or FontFamily) along with a weight and italic flag that determine the style the entry maps to. For FontFamily entries, weight and italic are ignored.

Index

Properties

asset

asset: Font | FontFamily

The Font or FontFamily asset for this entry.

Since

Lens Scripting Version 356

Default Value

null

italic

italic: boolean

Whether this entry maps to an italic style. Ignored for FontFamily entries.

Since

Lens Scripting Version 356

Default Value

false

weight

weight: number

The font weight this entry maps to (e.g. 400 for Regular, 700 for Bold). Ignored for FontFamily entries.

Since

Lens Scripting Version 356

Default Value

400

Methods

create()

static create(): FontCollectionEntry

Creates a new FontCollectionEntry with default values.

Returns

FontCollectionEntry

Since

Lens Scripting Version 356

Example

//@input Asset.Font fontBold
//@input Asset.FontFamily myFamily

// Font entry — weight and italic determine the style it maps to
var fontEntry = FontCollectionEntry.create();
fontEntry.asset = script.fontBold;
fontEntry.weight = 700;

// FontFamily entry — weight and italic are ignored
var familyEntry = FontCollectionEntry.create();
familyEntry.asset = script.myFamily;

getTypeName()

static getTypeName(): TypeName<FontCollectionEntry>

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<FontCollectionEntry>

Since

Lens Scripting Version 356