AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
FontDatabase.hpp
1/*
2Copyright (C) 2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGUI_FONTDATABASE_H
17#define AEONGUI_FONTDATABASE_H
18
19#include <string>
20#include <vector>
21#include <mutex>
22#include "aeongui/Platform.hpp"
23
24struct _PangoFontMap;
25typedef struct _PangoFontMap PangoFontMap;
26struct _PangoContext;
27typedef struct _PangoContext PangoContext;
28struct _FcConfig;
29typedef struct _FcConfig FcConfig;
30
31namespace AeonGUI
32{
41 class FontDatabase
42 {
43 public:
47 DLL static void Initialize();
49 DLL static void Finalize();
54 DLL static void AddFontDirectory ( const std::string& aPath );
59 DLL static void AddFontFile ( const std::string& aPath );
63 DLL static FcConfig* GetFcConfig();
67 DLL static PangoFontMap* GetFontMap();
71 DLL static PangoContext* CreateContext();
72 private:
73 FontDatabase() = delete;
74 static std::recursive_mutex& GetMutex();
75 static FcConfig* sFcConfig;
76 static PangoFontMap* sFontMap;
77 };
78}
79#endif
Platform-specific DLL import/export macros and compiler helpers.
static void AddFontFile(const std::string &aPath)
Add a single font file to the database.
Definition FontDatabase.cpp:200
static FcConfig * GetFcConfig()
Get the FcConfig used by the font database.
Definition FontDatabase.cpp:219
static void Initialize()
Initialize the font database. Call once at startup.
Definition FontDatabase.cpp:114
static void AddFontDirectory(const std::string &aPath)
Add a directory of font files (.ttf, .otf, etc.) to the database.
Definition FontDatabase.cpp:180
static PangoFontMap * GetFontMap()
Get the PangoFontMap backed by the local font database.
Definition FontDatabase.cpp:225
static void Finalize()
Finalize the font database. Call once at shutdown.
Definition FontDatabase.cpp:165
static PangoContext * CreateContext()
Create a new PangoContext from the local font map.
Definition FontDatabase.cpp:231