FTGL  2.4.0
FTLibrary.h
Go to the documentation of this file.
1 /*
2  * FTGL - OpenGL font library
3  *
4  * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 #ifndef __FTLibrary__
27 #define __FTLibrary__
28 
29 #ifdef __cplusplus
30 
31 #include <ft2build.h>
32 #include FT_FREETYPE_H
33 //#include FT_CACHE_H
34 
35 #include "FTGL/ftgl.h"
36 #include <atomic>
37 
56 class FTLibrary
57 {
58  public:
64  static FTLibrary& Instance();
65 
71  const FT_Library* GetLibrary() const { return library; }
72 
78  FT_Error Error() const { return err; }
79 
85  ~FTLibrary();
86 
96  void LegacyOpenGLState(bool On);
97  bool GetLegacyOpenGLStateSet() const { return LegacyOpenGLStateHandling; }
98 
99  private:
106  FTLibrary();
107  FTLibrary(const FT_Library&){}
108  FTLibrary& operator=(const FT_Library&) { return *this; }
109 
121  bool Initialise();
122 
126  FT_Library* library;
127 // FTC_Manager* manager;
128 
132  FT_Error err;
133 
137  std::atomic <int> LegacyOpenGLStateHandling;
138 };
139 
140 #endif //__cplusplus
141 
142 #endif // __FTLibrary__
const FT_Library * GetLibrary() const
Gets a pointer to the native Freetype library.
Definition: FTLibrary.h:71
~FTLibrary()
Destructor.
static FTLibrary & Instance()
Global acces point to the single FTLibrary object.
void LegacyOpenGLState(bool On)
See README-LegacyOpenGLState.
FTLibrary class is the global accessor for the Freetype library.
Definition: FTLibrary.h:56
bool GetLegacyOpenGLStateSet() const
Definition: FTLibrary.h:97
FT_Error Error() const
Queries the library for errors.
Definition: FTLibrary.h:78