Class FontAsset
Font asset contains glyph collection and cached data used to render text.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public class FontAsset : BinaryAsset
Constructors
FontAsset()
Properties
FamilyName
Gets the font family name.
Declaration
[Unmanaged]
public string FamilyName { get; }
Property Value
System.String
|
Options
Gets or sets the font options.
Declaration
[Unmanaged]
public FontOptions Options { get; set; }
Property Value
FontOptions
|
Style
Gets the font style flags.
Declaration
[Unmanaged]
public FontFlags Style { get; }
Property Value
FontFlags
|
StyleName
Gets the font style name.
Declaration
[Unmanaged]
public string StyleName { get; }
Property Value
System.String
|
Methods
ContainsChar(Char)
Check if the font contains the glyph of a char.
Declaration
[Unmanaged]
public bool ContainsChar(char c)
Parameters
System.Char
c
The char to test. |
Returns
System.Boolean
True if the font contains the glyph of the char, otherwise false. |
CreateFont(Single)
Creates the font object of given characters size.
Declaration
[Unmanaged]
public Font CreateFont(float size)
Parameters
System.Single
size
The font characters size. |
Returns
Font
The created font object. |
GetBold()
Gets the font with bold style. Returns itself or creates a new virtual font asset using this font but with bold option enabled.
Declaration
[Unmanaged]
public FontAsset GetBold()
Returns
FontAsset
The virtual font or this. |
GetItalic()
Gets the font with italic style. Returns itself or creates a new virtual font asset using this font but with italic option enabled.
Declaration
[Unmanaged]
public FontAsset GetItalic()
Returns
FontAsset
The virtual font or this. |
Init(Byte[])
Initializes the font with a custom font file data.
Declaration
[Unmanaged]
public bool Init(byte[] fontFile)
Parameters
System.Byte[]
fontFile
Raw bytes with font file data. |
Returns
System.Boolean
True if cannot init, otherwise false. |
Invalidate()
Invalidates all cached dynamic font atlases using this font. Can be used to reload font characters after changing font asset options.
Declaration
[Unmanaged]
public void Invalidate()
Save(String)
Saves this asset to the file. Supported only in Editor.
Declaration
[Unmanaged]
public bool Save(string path = null)
Parameters
System.String
path
The custom asset path to use for the saving. Use empty value to save this asset to its own storage location. Can be used to duplicate asset. Must be specified when saving virtual asset. |
Returns
System.Boolean
True if cannot save data, otherwise false. |