Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
FontManager.h
Go to the documentation of this file.
1/**
2 * @file FontManager.h
3 * @brief Font management system for ImGui
4 * @author Olympe Engine
5 * @date 2026
6 *
7 * @details
8 * Manages loading and accessing custom fonts including icon fonts like Font Awesome
9 */
10
11#pragma once
12
13#include <string>
14
15// Forward declare ImFont
16struct ImFont;
17
18namespace Olympe {
19
20/**
21 * @class FontManager
22 * @brief Singleton manager for custom fonts
23 */
25public:
26 /**
27 * @brief Get singleton instance
28 */
29 static FontManager& Get();
30
31 /**
32 * @brief Initialize font system
33 * Must be called after ImGui context creation but before first frame
34 */
35 void Initialize();
36
37 /**
38 * @brief Load Font Awesome font
39 * @param fontPath Path to Font Awesome .otf file
40 * @param fontSize Base font size (default: 16.0f)
41 * @return true if loaded successfully
42 */
43 bool LoadFontAwesome(const std::string& fontPath, float fontSize = 16.0f);
44
45 /**
46 * @brief Load a custom font
47 * @param fontPath Path to font file
48 * @param fontSize Font size
49 * @param fontName Optional name identifier
50 * @return Pointer to loaded font, nullptr on failure
51 */
52 ImFont* LoadFont(const std::string& fontPath, float fontSize, const std::string& fontName = "");
53
54 /**
55 * @brief Get Font Awesome font
56 * @return Pointer to Font Awesome font, nullptr if not loaded
57 */
58 ImFont* GetFontAwesome() const { return m_FontAwesome; }
59
60 /**
61 * @brief Get default font
62 * @return Pointer to default ImGui font
63 */
64 ImFont* GetDefaultFont() const { return m_DefaultFont; }
65
66 /**
67 * @brief Check if Font Awesome is loaded
68 */
69 bool IsFontAwesomeLoaded() const { return m_FontAwesome != nullptr; }
70
71private:
73 ~FontManager() = default;
74 FontManager(const FontManager&) = delete;
76
80};
81
82} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Singleton manager for custom fonts.
Definition FontManager.h:24
FontManager & operator=(const FontManager &)=delete
void Initialize()
Initialize font system Must be called after ImGui context creation but before first frame.
bool IsFontAwesomeLoaded() const
Check if Font Awesome is loaded.
Definition FontManager.h:69
ImFont * LoadFont(const std::string &fontPath, float fontSize, const std::string &fontName="")
Load a custom font.
FontManager(const FontManager &)=delete
static FontManager & Get()
Get singleton instance.
~FontManager()=default
bool LoadFontAwesome(const std::string &fontPath, float fontSize=16.0f)
Load Font Awesome font.
ImFont * GetFontAwesome() const
Get Font Awesome font.
Definition FontManager.h:58
ImFont * GetDefaultFont() const
Get default font.
Definition FontManager.h:64
< Provides AssetID and INVALID_ASSET_ID