Editor.Components.FontStyles
ClassStandard font style names for the preferredStyle property of Editor.Components.Text and Editor.Components.Text3D.
Standard font style names for the preferredStyle property of Editor.Components.Text and Editor.Components.Text3D. Each name maps to a weight and italic pair.
Index
Properties
Example
Pick a standard style for a Text component. Leave weight and italic unset: when assigned, they override the matching part of preferredStyle.
type Weight = 'Light' | 'Regular' | 'Bold';
const Styles = Editor.Components.FontStyles;
const STYLE_NAMES: Record<Weight, { upright: string; italic: string }> = {
Light: { upright: Styles.Light, italic: Styles.LightItalic },
Regular: { upright: Styles.Regular, italic: Styles.RegularItalic },
Bold: { upright: Styles.Bold, italic: Styles.BoldItalic },
};
export function createStyledText(
scene: Editor.Assets.Scene,
label: string,
weight: Weight,
italic: boolean,
): Editor.Components.Text {
const text = scene.createSceneObject(label).addComponent('Text');
text.text = label;
const names = STYLE_NAMES[weight];
text.preferredStyle = italic ? names.italic : names.upright;
return text;
}
createStyledText(scene, 'Title', 'Bold', true) sets preferredStyle to "Bold Italic". The caller owns the created scene object.
Properties
Bold
staticBold:string
Style name for bold, non-italic text ("Bold").
BoldItalic
staticBoldItalic:string
Bold Italic (weight 700, italic). Value: "Bold Italic".
ExtraBold
staticExtraBold:string
Extra Bold (weight 800). Value: "ExtraBold".
ExtraBoldItalic
staticExtraBoldItalic:string
Extra Bold Italic (weight 800, italic). Value: "ExtraBold Italic".
ExtraLight
staticExtraLight:string
Style name for extra-light, non-italic text ("ExtraLight").
ExtraLightItalic
staticExtraLightItalic:string
Style name for extra-light italic text ("ExtraLight Italic").
Heavy
staticHeavy:string
Heavy (weight 900). Value: "Heavy".
HeavyItalic
staticHeavyItalic:string
Heavy Italic (weight 900, italic). Value: "Heavy Italic".
Light
staticLight:string
Style name for light, non-italic text ("Light").
LightItalic
staticLightItalic:string
Style name for light italic text ("Light Italic").
Medium
staticMedium:string
Style name for medium, non-italic text ("Medium").
MediumItalic
staticMediumItalic:string
Style name for medium italic text ("Medium Italic").
Regular
staticRegular:string
Style name for regular, non-italic text ("Regular").
RegularItalic
staticRegularItalic:string
Style name for regular italic text ("Regular Italic").
SemiBold
staticSemiBold:string
Style name for semi-bold, non-italic text ("SemiBold").
SemiBoldItalic
staticSemiBoldItalic:string
Style name for semi-bold italic text ("SemiBold Italic").
Thin
staticThin:string
Style name for thin, non-italic text ("Thin").
ThinItalic
staticThinItalic:string
Style name for thin italic text ("Thin Italic").