Editor.Assets.FontFamilyEntry
ClassMaps a single Font asset to a specific style (weight and italic flag) within a FontFamily.
Index
Properties
Methods
Example
// Build a font family from separate regular and bold font files, then list the styles it covers.
// Each style slot set on the family is stored as a FontFamilyEntry.
export function createFontFamily(
assetManager: Editor.Model.AssetManager,
name: string,
regular: Editor.Assets.Font,
bold: Editor.Assets.Font,
): Editor.Assets.FontFamily {
const destination = new Editor.Model.SourcePath(new Editor.Path(''), Editor.Model.SourceRootDirectory.Assets);
const family = assetManager.createNativeAsset('FontFamily', name, destination) as Editor.Assets.FontFamily;
family.regular = regular;
family.bold = bold;
return family;
}
// For example ["400: Docs Regular", "700: Docs Bold"].
export function listFamilyStyles(family: Editor.Assets.FontFamily): string[] {
return family.entries.map(entry => `${entry.weight}${entry.italic ? ' italic' : ''}: ${entry.font.name}`);
}
Extends
Properties
font
font:
Font
Font asset assigned to this style entry.
id
readonlyid:Uuid
The unique id of the entity.
Inherited from
italic
italic:
boolean
Whether this entry represents the italic variant of its weight.
meta
readonlymeta:Meta
Metadata associated with this entity, providing access to its unique identifier and other descriptive properties.
Inherited from
type
readonlytype:string
The entity's type.
Inherited from
weight
weight:
number
Numeric font weight (e.g. 400 for regular, 700 for bold) represented by this entry.
Methods
getDirectlyReferencedEntities()
getDirectlyReferencedEntities():
Entity[]
A list of entities which this entity has a reference to.
Returns
Entity[]
Inherited from
EntityStructure.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
EntityStructure.getOwnedEntities
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