Class FontAsset
Font asset contains glyph collection and cached data used to render text.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Render2D/FontAsset.h
Syntax
public class FontAsset : public BinaryAsset
Methods
ContainsChar(Char c)
Check if the font contains the glyph of a char.
Declaration
public bool ContainsChar(Char c) const
Parameters
Char
c
The char to test. |
Returns
bool
True if the font contains the glyph of the char, otherwise false. |
CreateFont(float size)
Creates the font object of given characters size.
Declaration
public Font* CreateFont(float size)
Parameters
float
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
public FontAsset* GetBold()
Returns
FontAsset
The virtual font or this. |
getChunksToPreload()
Gets packed chunks indices to preload before asset loading action
Declaration
protected virtual AssetChunksFlag getChunksToPreload() const override
Returns
AssetChunksFlag
Chunks to load flags |
Overrides
GetFamilyName()
GetFTFace()
Gets FreeType face handle.
Declaration
public FT_Face GetFTFace() const
Returns
FT_Face
|
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
public FontAsset* GetItalic()
Returns
FontAsset
The virtual font or this. |
GetMemoryUsage()
Gets amount of CPU memory used by this resource (in bytes). It's a rough estimation. Memory may be fragmented, compressed or sub-allocated so the actual memory pressure from this resource may vary.
Declaration
public virtual uint64 GetMemoryUsage() const override
Returns
uint64
|
Overrides
GetOptions()
GetStyle()
GetStyleName()
init(AssetInitData& initData)
Initializes the specified asset.
Declaration
protected virtual bool init(AssetInitData& initData) override
Parameters
AssetInitData
initData
The initialize data. |
Returns
bool
True if cannot init, otherwise false |
Overrides
Init(const BytesContainer& fontFile)
Initializes the font with a custom font file data.
Declaration
public bool Init(const BytesContainer& fontFile)
Parameters
BytesContainer
fontFile
Raw bytes with font file data. |
Returns
bool
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
public void Invalidate()
load()
Load data from the chunks
Declaration
protected virtual LoadResult load() override
Returns
LoadResult
Loading result |
Overrides
Save(const StringView& path=StringView::Empty)
Saves this asset to the file. Supported only in Editor.
Declaration
public virtual bool Save(const StringView& path=StringView::Empty) override
Parameters
StringView
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
bool
True when cannot save data, otherwise false. |
Overrides
SetOptions(const FontOptions& value)
Sets the font options.
Declaration
public void SetOptions(const FontOptions& value)
Parameters
FontOptions
value
|
unload(bool isReloading)
Unloads asset data
Declaration
protected virtual void unload(bool isReloading) override
Parameters
bool
isReloading
True if asset is reloading data, otherwise false. |