Skip to main content

Editor.Assets.FontFamily

Class

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

Index

Example

const model = this.pluginSystem.findInterface(Editor.Model.IModel) as Editor.Model.IModel;
const scene = model.project.scene;
const family = model.project.assetManager.assets.find((a) => a.isOfType('FontFamily')) as
| Editor.Assets.FontFamily
| undefined;

const obj = scene.createSceneObject('Greeting');
const text = obj.addComponent('Text');
text.text = 'Hello, world';
text.size = 48;
if (family && !Editor.isNull(family)) {
text.fontSource = family;
console.log(`Text using FontFamily "${family.name}"`);
} else {
console.log('No FontFamily asset found; using default font');
}

Extends

Properties

bold

bold: Font

Font asset assigned to the bold (weight ~700) style slot of this family.


boldItalic

boldItalic: Font

Font asset assigned to the bold italic style slot of this family.


cacheFile

readonly cacheFile: Path

Path to the cached asset file.

Inherited from

Asset.cacheFile


entries

entries: FontFamilyEntry[]

Per-style entries defining which Font asset is used for each weight and italic combination in this family.


extraBold

extraBold: Font

Font asset assigned to the extra bold (weight ~800) style slot of this family.


extraBoldItalic

extraBoldItalic: Font

Font asset assigned to the extra bold italic style slot of this family.


extraLight

extraLight: Font

Font asset assigned to the extra light (weight ~200) style slot of this family.


extraLightItalic

extraLightItalic: Font

Font asset assigned to the extra light italic style slot of this family.


familyName

familyName: string

Display name of the font family.


fileMeta

readonly fileMeta: AssetImportMetadata

Import metadata for the asset.

Inherited from

Asset.fileMeta


heavy

heavy: Font

Font asset assigned to the heavy (weight ~900) style slot of this family.


heavyItalic

heavyItalic: Font

Font asset assigned to the heavy italic style slot of this family.


id

readonly id: Uuid

The unique id of the entity.

Inherited from

Asset.id


light

light: Font

Font asset assigned to the light (weight ~300) style slot of this family.


lightItalic

lightItalic: Font

Font asset assigned to the light italic style slot of this family.


medium

medium: Font

Font asset assigned to the medium (weight ~500) style slot of this family.


mediumItalic

mediumItalic: Font

Font asset assigned to the medium italic style slot of this family.


meta

readonly meta: Meta

Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.

Inherited from

Asset.meta


name

readonly name: string

The name of the asset.

Inherited from

Asset.name


regular

regular: Font

Font asset assigned to the regular (weight ~400) style slot of this family.


regularItalic

regularItalic: Font

Font asset assigned to the regular italic style slot of this family.


semiBold

semiBold: Font

Font asset assigned to the semi bold (weight ~600) style slot of this family.


semiBoldItalic

semiBoldItalic: Font

Font asset assigned to the semi bold italic style slot of this family.


thin

thin: Font

Font asset assigned to the thin (weight ~100) style slot of this family.


thinItalic

thinItalic: Font

Font asset assigned to the thin italic style slot of this family.


type

readonly type: string

The entity's type.

Inherited from

Asset.type

Methods

getDirectlyReferencedEntities()

getDirectlyReferencedEntities(): Entity[]

A list of entities which this entity has a reference to.

Returns

Entity[]

Inherited from

Asset.getDirectlyReferencedEntities


getMeta()

static getMeta(): Meta

Returns metadata about this type.

Returns

Meta

Overrides

Asset.getMeta


getOwnedEntities()

getOwnedEntities(): Entity[]

A list of entities which has a reference to this entity.

Returns

Entity[]

Inherited from

Asset.getOwnedEntities


getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

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 is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Asset.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Asset.isSame