lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::ui::FontManager Class Reference

Font manager for caching loaded fonts. More...

#include <font.hpp>

Public Member Functions

std::shared_ptr< Fontload (const std::string &name, const std::string &filepath, unsigned int font_size=48)
 Load a font or get it from cache.
std::shared_ptr< Fontget_font (const std::string &name)
 Get a previously loaded font.
bool exists (const std::string &name) const
 Check if a font exists in the cache.
void clear ()
 Clear all cached fonts.

Static Public Member Functions

static FontManager & get ()
 Get the singleton instance.

Detailed Description

Font manager for caching loaded fonts.

Singleton class that manages font loading and caching.

Member Function Documentation

◆ exists()

bool lmgl::ui::FontManager::exists ( const std::string & name) const

Check if a font exists in the cache.

Parameters
nameName of the font.
Returns
True if font exists, false otherwise.

◆ get()

FontManager & lmgl::ui::FontManager::get ( )
static

Get the singleton instance.

Returns
Reference to the FontManager instance.

◆ get_font()

std::shared_ptr< Font > lmgl::ui::FontManager::get_font ( const std::string & name)

Get a previously loaded font.

Parameters
nameName of the font.
Returns
Shared pointer to the font, or nullptr if not found.

◆ load()

std::shared_ptr< Font > lmgl::ui::FontManager::load ( const std::string & name,
const std::string & filepath,
unsigned int font_size = 48 )

Load a font or get it from cache.

Parameters
nameUnique name for the font.
filepathPath to the font file.
font_sizeFont size in pixels.
Returns
Shared pointer to the loaded font.

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