Skip to main content

FontFamily

Class

Groups multiple Font assets into a single family, mapping each to a style (weight + italic).

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

Index

Extends

Properties

bold

bold: Font

The Font asset assigned to the Bold (weight 700) style slot.

Default Value

null

boldItalic

boldItalic: Font

The Font asset assigned to the Bold Italic (weight 700, italic) style slot.

Default Value

null

entries

entries: FontFamilyEntry[]

The full list of font entries in this family. Setting this property replaces all entries.

Default Value

[]

extraBold

extraBold: Font

The Font asset assigned to the ExtraBold (weight 800) style slot.

Default Value

null

extraBoldItalic

extraBoldItalic: Font

The Font asset assigned to the ExtraBold Italic (weight 800, italic) style slot.

Default Value

null

extraLight

extraLight: Font

The Font asset assigned to the ExtraLight (weight 200) style slot.

Default Value

null

extraLightItalic

extraLightItalic: Font

The Font asset assigned to the ExtraLight Italic (weight 200, italic) style slot.

Default Value

null

familyName

familyName: string

Default Value

""

heavy

heavy: Font

The Font asset assigned to the Heavy (weight 900) style slot.

Default Value

null

heavyItalic

heavyItalic: Font

The Font asset assigned to the Heavy Italic (weight 900, italic) style slot.

Default Value

null

light

light: Font

The Font asset assigned to the Light (weight 300) style slot.

Default Value

null

lightItalic

lightItalic: Font

The Font asset assigned to the Light Italic (weight 300, italic) style slot.

Default Value

null

medium

medium: Font

The Font asset assigned to the Medium (weight 500) style slot.

Default Value

null

mediumItalic

mediumItalic: Font

The Font asset assigned to the Medium Italic (weight 500, italic) style slot.

Default Value

null

name

name: string

The name of the Asset in Lens Studio.

Default Value

""

Inherited from

Asset.name


regular

regular: Font

The Font asset assigned to the Regular (weight 400) style slot.

Default Value

null

regularItalic

regularItalic: Font

The Font asset assigned to the Regular Italic (weight 400, italic) style slot.

Default Value

null

semiBold

semiBold: Font

The Font asset assigned to the SemiBold (weight 600) style slot.

Default Value

null

semiBoldItalic

semiBoldItalic: Font

The Font asset assigned to the SemiBold Italic (weight 600, italic) style slot.

Default Value

null

thin

thin: Font

The Font asset assigned to the Thin (weight 100) style slot.

Default Value

null

thinItalic

thinItalic: Font

The Font asset assigned to the Thin Italic (weight 100, italic) style slot.

Default Value

null

uniqueIdentifier

readonly uniqueIdentifier: string

Since

Lens Scripting Version 176

Inherited from

Asset.uniqueIdentifier

Methods

create()

static create(): FontFamily

Creates a new, empty FontFamily asset.

Returns

FontFamily

Since

Lens Scripting Version 356

Example

//@input Asset.Font fontRegular
//@input Asset.Font fontBold
//@input Asset.Font fontItalic

var family = FontFamily.create();
family.familyName = "MyFamily";
family.regular = script.fontRegular;
family.bold = script.fontBold;

// Alternatively, populate via the entries property:
var regular = FontFamilyEntry.create();
regular.font = script.fontRegular;
regular.weight = 400;

var bold = FontFamilyEntry.create();
bold.font = script.fontBold;
bold.weight = 700;

var italic = FontFamilyEntry.create();
italic.font = script.fontItalic;
italic.weight = 400;
italic.italic = true;

family.entries = [regular, bold, italic];

getTypeName()

static getTypeName(): TypeName<FontFamily>

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

Overrides

Asset.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Asset.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Asset.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Asset.isSame

See also