|
|
|||
File indexing completed on 2025-12-16 10:15:00
0001 /* 0002 * FTGL - OpenGL font library 0003 * 0004 * Copyright (c) 2001-2004 Henry Maddocks <ftgl@opengl.geek.nz> 0005 * 0006 * Permission is hereby granted, free of charge, to any person obtaining 0007 * a copy of this software and associated documentation files (the 0008 * "Software"), to deal in the Software without restriction, including 0009 * without limitation the rights to use, copy, modify, merge, publish, 0010 * distribute, sublicense, and/or sell copies of the Software, and to 0011 * permit persons to whom the Software is furnished to do so, subject to 0012 * the following conditions: 0013 * 0014 * The above copyright notice and this permission notice shall be 0015 * included in all copies or substantial portions of the Software. 0016 * 0017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 0018 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 0019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 0020 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 0021 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 0022 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 0023 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0024 */ 0025 0026 #ifndef __FTLibrary__ 0027 #define __FTLibrary__ 0028 0029 #ifdef __cplusplus 0030 0031 #include <ft2build.h> 0032 #include FT_FREETYPE_H 0033 //#include FT_CACHE_H 0034 0035 #include "FTGL/ftgl.h" 0036 #include <atomic> 0037 0038 /** 0039 * FTLibrary class is the global accessor for the Freetype library. 0040 * 0041 * This class encapsulates the Freetype Library. This is a singleton class 0042 * and ensures that only one FT_Library is in existence at any one time. 0043 * All constructors are private therefore clients cannot create or 0044 * instantiate this class themselves and must access it's methods via the 0045 * static <code>FTLibrary::Instance()</code> function. 0046 * 0047 * Just because this class returns a valid <code>FTLibrary</code> object 0048 * doesn't mean that the Freetype Library has been successfully initialised. 0049 * Clients should check for errors. You can initialise the library AND check 0050 * for errors using the following code... 0051 * <code>err = FTLibrary::Instance().Error();</code> 0052 * 0053 * @see "Freetype 2 Documentation" 0054 * 0055 */ 0056 class FTLibrary 0057 { 0058 public: 0059 /** 0060 * Global acces point to the single FTLibrary object. 0061 * 0062 * @return The global <code>FTLibrary</code> object. 0063 */ 0064 static FTLibrary& Instance(); 0065 0066 /** 0067 * Gets a pointer to the native Freetype library. 0068 * 0069 * @return A handle to a FreeType library instance. 0070 */ 0071 const FT_Library* GetLibrary() const { return library; } 0072 0073 /** 0074 * Queries the library for errors. 0075 * 0076 * @return The current error code. 0077 */ 0078 FT_Error Error() const { return err; } 0079 0080 /** 0081 * Destructor 0082 * 0083 * Disposes of the Freetype library 0084 */ 0085 ~FTLibrary(); 0086 0087 /** 0088 * See README-LegacyOpenGLState 0089 * 0090 * Choose incompatible legacy behaviour, see commit 0091 * 29603ae3fa88c5b9e079a6db23be2cdea95aef39. 0092 * 0093 * May only be set to the same value (but any number of times) 0094 * within one program. 0095 */ 0096 void LegacyOpenGLState(bool On); 0097 bool GetLegacyOpenGLStateSet() const { return LegacyOpenGLStateHandling; } 0098 0099 private: 0100 /** 0101 * Default constructors. 0102 * 0103 * Made private to stop clients creating their own FTLibrary 0104 * objects. 0105 */ 0106 FTLibrary(); 0107 FTLibrary(const FT_Library&){} 0108 FTLibrary& operator=(const FT_Library&) { return *this; } 0109 0110 /** 0111 * Initialises the Freetype library 0112 * 0113 * Even though this function indicates success via the return value, 0114 * clients can't see this so must check the error codes. This function 0115 * is only ever called by the default c_stor 0116 * 0117 * @return <code>true</code> if the Freetype library was 0118 * successfully initialised, <code>false</code> 0119 * otherwise. 0120 */ 0121 bool Initialise(); 0122 0123 /** 0124 * Freetype library handle. 0125 */ 0126 FT_Library* library; 0127 // FTC_Manager* manager; 0128 0129 /** 0130 * Current error code. Zero means no error. 0131 */ 0132 FT_Error err; 0133 0134 /** 0135 * Flag set by LegacyOpenGLState, -1 means implicitly on (default). 0136 */ 0137 std::atomic <int> LegacyOpenGLStateHandling; 0138 }; 0139 0140 #endif //__cplusplus 0141 0142 #endif // __FTLibrary__
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|