Add query functions to request FTGL configuration information: - C version: ftglGetString(); - C++ version: FTGL::GetString(); Currently supported strings are: - FTGL_CONFIG_VERSION: FTGL version information
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
diff --git a/demo/c-demo.c b/demo/c-demo.c
index 7dcf034..79028f8 100644
--- a/demo/c-demo.c
+++ b/demo/c-demo.c
@@ -244,6 +244,9 @@ int main(int argc, char **argv)
ftglSetFontFaceSize(font[2], 80, 72);
ftglSetFontCharMap(font[2], ft_encoding_unicode);
+ fprintf(stderr, "Using FTGL version %s\n",
+ ftglGetString(FTGL_CONFIG_VERSION));
+
/* Run GLUT loop */
glutMainLoop();
diff --git a/demo/simple.cpp b/demo/simple.cpp
index 850e312..c9b2db2 100644
--- a/demo/simple.cpp
+++ b/demo/simple.cpp
@@ -237,6 +237,9 @@ int main(int argc, char **argv)
font[2]->FaceSize(80);
font[2]->CharMap(ft_encoding_unicode);
+ fprintf(stderr, "Using FTGL version %s\n",
+ FTGL::GetString(FTGL::CONFIG_VERSION));
+
// Run GLUT loop
glutMainLoop();
diff --git a/msvc/vc71/ftgl_dll.vcproj b/msvc/vc71/ftgl_dll.vcproj
index e3e2b97..2868153 100644
--- a/msvc/vc71/ftgl_dll.vcproj
+++ b/msvc/vc71/ftgl_dll.vcproj
@@ -163,6 +163,9 @@
RelativePath="..\..\src\FTFont\FTFontGlue.cpp">
</File>
<File
+ RelativePath="..\..\src\FTGL.cpp">
+ </File>
+ <File
RelativePath="..\..\src\FTGlyph\FTGlyph.cpp">
</File>
<File
diff --git a/msvc/vc8/ftgl_dll.vcproj b/msvc/vc8/ftgl_dll.vcproj
index cacdda6..c0bdc6e 100644
--- a/msvc/vc8/ftgl_dll.vcproj
+++ b/msvc/vc8/ftgl_dll.vcproj
@@ -236,6 +236,10 @@
>
</File>
<File
+ RelativePath="..\..\src\FTGL.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\src\FTGlyphContainer.cpp"
>
</File>
diff --git a/msvc/vc8/ftgl_static.vcproj b/msvc/vc8/ftgl_static.vcproj
index a83c9e2..0f991c7 100644
--- a/msvc/vc8/ftgl_static.vcproj
+++ b/msvc/vc8/ftgl_static.vcproj
@@ -171,6 +171,10 @@
>
</File>
<File
+ RelativePath="..\..\src\FTGL.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\src\FTGlyphContainer.cpp"
>
</File>
diff --git a/msvc/vc9/ftgl_dll.vcproj b/msvc/vc9/ftgl_dll.vcproj
index b95b5ab..bc55835 100644
--- a/msvc/vc9/ftgl_dll.vcproj
+++ b/msvc/vc9/ftgl_dll.vcproj
@@ -231,6 +231,10 @@
>
</File>
<File
+ RelativePath="..\..\src\FTGL.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\src\FTGlyphContainer.cpp"
>
</File>
diff --git a/msvc/vc9/ftgl_static.vcproj b/msvc/vc9/ftgl_static.vcproj
index 4b5a2d1..b805fc4 100644
--- a/msvc/vc9/ftgl_static.vcproj
+++ b/msvc/vc9/ftgl_static.vcproj
@@ -172,6 +172,10 @@
>
</File>
<File
+ RelativePath="..\..\src\FTGL.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\src\FTGlyphContainer.cpp"
>
</File>
diff --git a/src/FTGL.cpp b/src/FTGL.cpp
new file mode 100644
index 0000000..b2951d4
--- /dev/null
+++ b/src/FTGL.cpp
@@ -0,0 +1,53 @@
+/*
+ * FTGL - OpenGL font library
+ *
+ * Copyright (c) 2008-2010 Sam Hocevar <sam@hocevar.net>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "config.h"
+
+#include "FTInternals.h"
+
+namespace FTGL {
+
+char const *GetString(ConfigString config)
+{
+ switch(config)
+ {
+ case CONFIG_VERSION:
+ return PACKAGE_VERSION;
+ }
+
+ return 0;
+}
+
+} // namespace FTGL
+
+FTGL_BEGIN_C_DECLS
+
+char const *ftglGetString(int config)
+{
+ return FTGL::GetString(static_cast<FTGL::ConfigString>(config));
+}
+
+FTGL_END_C_DECLS
+
diff --git a/src/FTGL/ftgl.h b/src/FTGL/ftgl.h
index a8a176c..cb1318f 100644
--- a/src/FTGL/ftgl.h
+++ b/src/FTGL/ftgl.h
@@ -65,6 +65,21 @@ namespace FTGL
ALIGN_RIGHT = 2,
ALIGN_JUSTIFY = 3
} TextAlignment;
+
+ typedef enum
+ {
+ CONFIG_VERSION = 1,
+ } ConfigString;
+
+ /**
+ * Return a string describing the current %FTGL instance
+ *
+ * @param config Name of the string to retrieve. Can be one of:
+ * - CONFIG_VERSION: return the %FTGL release number.
+ * @return A pointer to a constant string containing the requested
+ * information, or 0 in case of invalid argument.
+ */
+ extern char const *GetString(ConfigString config);
}
#else
# define FTGL_RENDER_FRONT 0x0001
@@ -76,6 +91,18 @@ namespace FTGL
# define FTGL_ALIGN_CENTER 1
# define FTGL_ALIGN_RIGHT 2
# define FTGL_ALIGN_JUSTIFY 3
+
+# define FTGL_CONFIG_VERSION 1
+
+ /**
+ * Return a string describing the current %FTGL instance
+ *
+ * @param config Name of the string to retrieve. Can be one of:
+ * - FTGL_CONFIG_VERSION: return the %FTGL release number.
+ * @return A pointer to a constant string containing the requested
+ * information, or NULL in case of invalid argument.
+ */
+ extern char const *ftglGetString(int config);
#endif
// Compiler-specific conditional compilation
diff --git a/src/Makefile.am b/src/Makefile.am
index 1cf74e5..731d364 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,6 +12,7 @@ libftgl_la_SOURCES = \
FTContour.h \
FTFace.cpp \
FTFace.h \
+ FTGL.cpp \
FTGlyphContainer.cpp \
FTGlyphContainer.h \
FTInternals.h \