Manage fonts.
More...
#include <font_manager.hpp>
|
using | DataType |
|
using | DataBlockType |
|
using | DataBlockPointer |
|
using | Map |
|
|
bool | initialize () override |
| Initialize the manager.
|
|
bool | isInitialized () override |
|
void | uninitialize () override |
|
bool | loadFromFile (std::string_view name, std::filesystem::path const &path) |
| Load a font from a file.
|
|
std::size_t | size () const |
| Get the number of elements in the manager.
|
|
AccessLock< std::mutex > | acquireLock () const |
| Acquire a AccessLock, with the manager mutex.
|
|
Map::const_iterator | begin (AccessLock< std::mutex > const &lock) const |
| Get the "begin" iterator of the manager.
|
|
Map::const_iterator | end (AccessLock< std::mutex > const &lock) const |
| Get the "end" iterator of the manager.
|
|
DataBlockPointer const & | getBadElement () const |
| Get the "bad" element.
|
|
DataBlockPointer | getElement (std::string_view name) const |
| Get the resource with the given name.
|
|
bool | contains (std::string_view name) const |
|
bool | unload (std::string_view name) |
|
void | unloadAll () |
|
bool | push (std::string_view name, DataBlockPointer block) |
| Add a user handled resource.
|
|
|
DataBlockPointer | _g_badElement |
|
Manage fonts.
- See also
- TextureManager
◆ acquireLock()
Acquire a AccessLock, with the manager mutex.
In order to use iterators, you have to acquire a unique lock from this function. The lock is not differed and will lock the mutex.
- Returns
- A AccessLock bound to this mutex
◆ begin()
Get the "begin" iterator of the manager.
You have to provide a valid reference to a AccessLock acquired with the function AcquireLock(). This function will throw if one of this is not respected :
- The mutex pointer of the lock does not correspond to this mutex.
- Parameters
-
- Returns
- The "begin" iterator of the texture manager
◆ end()
Get the "end" iterator of the manager.
- See also
- begin()
- Parameters
-
- Returns
- The "end" iterator of the manager
◆ getBadElement()
Get the "bad" element.
A bad element is a "valid" default resource that is returned when the requested resource is not found. return The "bad" element
◆ getElement()
Get the resource with the given name.
- Parameters
-
name | The name of the resource to get |
- Returns
- The resource with the given name or the bad resource if not found
◆ initialize()
bool fge::font::FontManager::initialize |
( |
| ) |
|
|
overridevirtual |
Initialize the manager.
The philosophy with this class is to always return a "valid" element even if the element is not found. When this method is called, a "bad" element is created and stored in the manager.
- Warning
- Note that there is no verification about the above statement, and you can always create your own manager without a "bad" element.
return true if the manager is initialized, false otherwise
Implements fge::manager::BaseManager< FreeTypeFont, DataBlock >.
◆ isInitialized()
bool fge::font::FontManager::isInitialized |
( |
| ) |
|
|
nodiscardoverridevirtual |
◆ loadFromFile()
bool fge::font::FontManager::loadFromFile |
( |
std::string_view | name, |
|
|
std::filesystem::path const & | path ) |
Load a font from a file.
- Parameters
-
name | The name of the font to load |
path | The path of the font to load |
- Returns
- true if the font was loaded, false otherwise
◆ push()
Add a user handled resource.
- Parameters
-
name | The name of the texture to add |
block | The block data to add |
- Returns
- true if the resource was added, false otherwise
◆ size()
Get the number of elements in the manager.
return The number of elements in the manager without the "bad" element
◆ uninitialize()
void fge::font::FontManager::uninitialize |
( |
| ) |
|
|
overridevirtual |
The documentation for this class was generated from the following file: