NWengine 0.9
Loading...
Searching...
No Matches
Font Class Reference

Class representing a font asset. More...

#include <Font.h>

Inheritance diagram for Font:
Asset

Public Member Functions

bool LoadFont (std::string path)
 Loads a font from a file.
 
void Clean () override
 Clean up the asset.
 
AssetGetFromCache (void *identifier) override
 Get the asset from the cache based on the identifier.
 
AssetLoadFromFile (const char *path, void *data) override
 Load the asset from file based on the file path.
 
AssetLoadFromBuffer (void *ftFace, void *data) override
 Load the asset from a buffer.
 
 NW_DECL_RES_LIST (FontIdentifier, Font)
 
- Public Member Functions inherited from Asset
virtual AssetLoadFromFileOrGetFromCache (void *identifier, const char *path, void *data)
 Load the asset from file or get it from the cache based on the identifier and file path.
 
virtual AssetLoadFromBufferOrGetFromCache (void *identifier, void *buffer, void *data)
 Load the asset from a buffer or get it from the cache based on the identifier.
 

Static Public Member Functions

static bool Init ()
 Initializes the FreeType library.
 
static void Destroy ()
 Destroys the FreeType library.
 

Public Attributes

std::unordered_map< char, GlyphcharactersMap
 
- Public Attributes inherited from Asset
int _usageCounter = 0
 

Static Public Attributes

static NW_FT_Lib lib
 

Detailed Description

Class representing a font asset.

Member Function Documentation

◆ Clean()

void Font::Clean ( )
overridevirtual

Clean up the asset.

Reimplemented from Asset.

◆ GetFromCache()

Asset * Font::GetFromCache ( void * identifier)
overridevirtual

Get the asset from the cache based on the identifier.

Parameters
identifierThe identifier of the asset.
Returns
The asset from the cache.

Reimplemented from Asset.

◆ Init()

bool Font::Init ( )
static

Initializes the FreeType library.

Returns
True if the library is initialized successfully, false otherwise.

◆ LoadFont()

bool Font::LoadFont ( std::string path)

Loads a font from a file.

Parameters
pathThe path to the font file.
Returns
True if the font is loaded successfully, false otherwise.

◆ LoadFromBuffer()

Asset * Font::LoadFromBuffer ( void * buffer,
void * data )
overridevirtual

Load the asset from a buffer.

Parameters
bufferThe buffer containing the asset data.
dataAdditional data for loading the asset.
Returns
The loaded asset.

Reimplemented from Asset.

◆ LoadFromFile()

Asset * Font::LoadFromFile ( const char * path,
void * data = nullptr )
overridevirtual

Load the asset from file based on the file path.

Parameters
pathThe file path of the asset.
dataAdditional data for loading the asset.
Returns
The loaded asset.

Reimplemented from Asset.

Member Data Documentation

◆ charactersMap

std::unordered_map<char, Glyph> Font::charactersMap

The map of characters to glyphs.

◆ lib

NW_FT_Lib Font::lib
static

The FreeType library.


The documentation for this class was generated from the following files: