XS Framework
A 3DS homebrew development framework.
 
Loading...
Searching...
No Matches
xs::text::Font Class Reference

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).
 
Fontoperator= (const Font &)=delete
 Copy assignment operator (deleted).
 

Detailed Description

Wrapper class for citro2d font management.

This class provides RAII-style management for C2D_Font objects, automatically handling resource allocation and deallocation.

Constructor & Destructor Documentation

◆ Font() [1/2]

xs::text::Font::Font ( const std::string & fontpath)
explicit

Constructs a Font object by loading a font from a file.

Parameters
fontpathPath 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.

Here is the caller graph for this function:

◆ ~Font()

xs::text::Font::~Font ( )

Destructor that automatically frees the font data.

Ensures the underlying C2D_Font resource is properly freed using C2D_FontFree.

◆ Font() [2/2]

xs::text::Font::Font ( const Font & )
delete

Copy constructor (deleted).

Font objects cannot be copied to prevent double-free errors.

Here is the call graph for this function:

Member Function Documentation

◆ Free()

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.

◆ GetHandle()

C2D_Font xs::text::Font::GetHandle ( ) const

Gets the underlying C2D_Font handle.

Returns
The C2D_Font handle managed by this object.

Provides access to the raw citro2d font handle for use with low-level citro2d functions.

◆ IsLoaded()

bool xs::text::Font::IsLoaded ( ) const

Returns true if the font was successfully loaded.

◆ operator=()

Font & xs::text::Font::operator= ( const Font & )
delete

Copy assignment operator (deleted).

Font objects cannot be copy-assigned to prevent double-free errors.

Here is the call graph for this function:

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