Wrapper class for citro2d font management. More...
#include <text.hpp>
Public Member Functions | |
| Font (const std::string &fontpath) | |
| Constructs a Font object by loading a font from a file. | |
| ~Font () | |
| Destructor that automatically frees the font data. | |
| void | Free () |
| Manually frees the font data before destruction. | |
| C2D_Font | GetHandle () const |
| Gets the underlying C2D_Font handle. | |
| bool | IsLoaded () const |
| Returns true if the font was successfully loaded. | |
| Font (const Font &)=delete | |
| Copy constructor (deleted). | |
| Font & | operator= (const Font &)=delete |
| Copy assignment operator (deleted). | |
Wrapper class for citro2d font management.
This class provides RAII-style management for C2D_Font objects, automatically handling resource allocation and deallocation.
|
explicit |
Constructs a Font object by loading a font from a file.
| fontpath | Path to the font file to load. |
Loads a font file using C2D_FontLoad. The font data will be automatically freed when the object is destroyed.
| xs::text::Font::~Font | ( | ) |
Destructor that automatically frees the font data.
Ensures the underlying C2D_Font resource is properly freed using C2D_FontFree.
|
delete |
Copy constructor (deleted).
Font objects cannot be copied to prevent double-free errors.
| void xs::text::Font::Free | ( | ) |
Manually frees the font data before destruction.
This method allows early release of font resources. After calling this method, the font handle becomes null and the destructor will not attempt to free it again.
| C2D_Font xs::text::Font::GetHandle | ( | ) | const |
Gets the underlying C2D_Font handle.
Provides access to the raw citro2d font handle for use with low-level citro2d functions.
| bool xs::text::Font::IsLoaded | ( | ) | const |
Returns true if the font was successfully loaded.
Copy assignment operator (deleted).
Font objects cannot be copy-assigned to prevent double-free errors.