Editor.Assets.FontFamily
ClassGroups multiple Font assets into a single family, mapping each to a style (weight + italic).
Index
Properties
Methods
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
readonlycacheFile:Path
Path to the cached asset file.
Inherited from
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
readonlyfileMeta:AssetImportMetadata
Import metadata for the asset.
Inherited from
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
readonlyid:Uuid
The unique id of the entity.
Inherited from
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
readonlymeta:Meta
Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.
Inherited from
name
readonlyname:string
The name of the asset.
Inherited from
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
readonlytype:string
The entity's type.
Inherited from
Methods
getDirectlyReferencedEntities()
getDirectlyReferencedEntities():
Entity[]
A list of entities which this entity has a reference to.
Returns
Entity[]
Inherited from
Asset.getDirectlyReferencedEntities
getMeta()
staticgetMeta():Meta
Returns metadata about this type.
Returns
Overrides
getOwnedEntities()
getOwnedEntities():
Entity[]
A list of entities which has a reference to this entity.
Returns
Entity[]
Inherited from
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean