API Documentation
Public Member Functions | List of all members
nkWinUi::FontManager Class Referencefinal

Manages the recorded fonts [WIP]. More...

Inheritance diagram for nkWinUi::FontManager:

Public Member Functions

FontgetDefaultFont () const
 
SystemgetSystem () const
 
FontcreateOrRetrieve (nkMemory::StringView name)
 
Fontrecord (nkMemory::StringView name, nkMemory::UniquePtr< Font > resource)
 
Fontget (nkMemory::StringView name) const
 
FontgetByIndex (unsigned int index) const
 
void rename (nkMemory::StringView oldName, nkMemory::StringView newName)
 
void erase (nkMemory::StringView name)
 
nkMemory::UniquePtr< Fontrelinquish (nkMemory::StringView name)
 

Detailed Description

Manages the recorded fonts [WIP].

This is a WIP.

Member Function Documentation

◆ getDefaultFont()

Font* nkWinUi::FontManager::getDefaultFont ( ) const
Returns
The default font set.

◆ getSystem()

System* nkWinUi::FontManager::getSystem ( ) const
Returns
The system the manager is living in.

◆ createOrRetrieve()

Font* nkWinUi::FontManager::createOrRetrieve ( nkMemory::StringView  name)

Creates if unavailable, or retrieves if available, a font.

Parameters
nameThe name of the font to retrieve.
Returns
The font requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase(), or relinquish().

◆ record()

Font* nkWinUi::FontManager::record ( nkMemory::StringView  name,
nkMemory::UniquePtr< Font resource 
)

Records an already existing resource in the manager, passing its ownership around.

Parameters
nameThe name under which the resource should be recorded.
resourceThe resource to record.
Returns
A raw pointer over the resource, now recorded in the manager.

◆ get()

Font* nkWinUi::FontManager::get ( nkMemory::StringView  name) const

Retrieves a font.

Parameters
nameThe name of the font to retrieve.
Returns
The font requested if available, nullptr else.

◆ getByIndex()

Font* nkWinUi::FontManager::getByIndex ( unsigned int  index) const

Get a font, by index. Note that one index can map to a different font after memory is changed. Useful to loop over all available fonts in one go.

Parameters
indexThe index of the font to retrieve.
Returns
The font linked if available, nullptr else.

◆ rename()

void nkWinUi::FontManager::rename ( nkMemory::StringView  oldName,
nkMemory::StringView  newName 
)

Renames a font.

Parameters
oldNameThe name of the font to rename.
newNameThe name to reassign to the font.

◆ erase()

void nkWinUi::FontManager::erase ( nkMemory::StringView  name)

Erases and frees a font.

Parameters
nameThe name of the font to erase.

◆ relinquish()

nkMemory::UniquePtr<Font> nkWinUi::FontManager::relinquish ( nkMemory::StringView  name)

Requests the manager to relinquish the ownership of a resource and pass it around.

Parameters
nameThe name of the recorded resource to relinquish.
Returns
The ownership over the resource requested if available, nullptr otherwise.

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