SGCT
master (487fac4)
Simple Graphics Cluster Toolkit
Toggle main menu visibility
Loading...
Searching...
No Matches
fontmanager.h
Go to the documentation of this file.
1
/*****************************************************************************************
2
* SGCT *
3
* Simple Graphics Cluster Toolkit *
4
* *
5
* Copyright (c) 2012-2026 *
6
* For conditions of distribution and use, see copyright notice in LICENSE.md *
7
****************************************************************************************/
8
9
#ifndef __SGCT__FONTMANAGER__H__
10
#define __SGCT__FONTMANAGER__H__
11
12
#ifdef SGCT_HAS_TEXT
13
14
#include <sgct/sgctexports.h>
15
16
#include <
sgct/font.h
>
17
#include <
sgct/math.h
>
18
#include <
sgct/shaderprogram.h
>
19
#include <map>
20
#include <memory>
21
#include <string>
22
#include <utility>
23
24
typedef
struct
FT_LibraryRec_* FT_Library;
25
26
namespace
sgct::text
{
27
28
class
Font;
29
86
class
SGCT_EXPORT FontManager {
87
public
:
88
static
FontManager& instance();
89
static
void
destroy();
90
94
~FontManager();
95
96
FontManager(
const
FontManager&) =
delete
;
97
FontManager(FontManager&&) =
delete
;
98
FontManager& operator=(
const
FontManager&) =
delete
;
99
FontManager& operator=(FontManager&&) =
delete
;
100
109
bool
addFont(std::string name, std::string file,
bool
isAbsolutePath =
false
);
110
118
Font* font(
const
std::string& name,
unsigned
int
height = 10);
119
125
void
bindShader(
const
mat4& mvp,
const
vec4& color,
int
texture)
const
;
126
127
private
:
131
FontManager();
132
140
std::unique_ptr<Font> createFont(
const
std::string& name,
int
height);
141
142
static
FontManager* _instance;
143
144
FT_Library _library;
145
147
std::map<std::string, std::string> _fontPaths;
148
150
std::map<std::pair<std::string, unsigned int>, std::unique_ptr<Font>> _fontMap;
151
152
ShaderProgram _shader;
153
int
_mvpLocation = -1;
154
int
_colorLocation = -1;
155
int
_textureLocation = -1;
156
};
157
158
}
// namespace sgct::text
159
160
#endif
// SGCT_HAS_TEXT
161
#endif
// __SGCT__FONTMANAGER__H__
font.h
math.h
sgct::text
Definition
freetype.h:22
shaderprogram.h
sgct
fontmanager.h
Generated by
1.18.0