* Added ftglDestroyFont() destructor for the C bindings. * Remove useless "#ifdef __cplusplus" constructs from .cpp files.
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 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
diff --git a/include/FTFont.h b/include/FTFont.h
index 2c0ff8c..49d7ee1 100644
--- a/include/FTFont.h
+++ b/include/FTFont.h
@@ -372,6 +372,8 @@ namespace C {
typedef struct FTGLfont FTGLfont;
+FTGL_EXPORT void ftglDestroyFont(FTGLfont*);
+
FTGL_EXPORT int ftglAttachFile (FTGLfont*, const char*);
FTGL_EXPORT int ftglAttachData (FTGLfont*, const unsigned char *, size_t);
diff --git a/include/FTGLBitmapFont.h b/include/FTGLBitmapFont.h
index c81dba5..34d1ba8 100644
--- a/include/FTGLBitmapFont.h
+++ b/include/FTGLBitmapFont.h
@@ -104,7 +104,7 @@ class FTGL_EXPORT FTGLBitmapFont : public FTFont
extern "C" {
namespace C {
#endif
-FTGL_EXPORT FTGLfont *ftglBitmapFontMake(const char *fontname);
+FTGL_EXPORT FTGLfont *ftglCreateBitmapFont(const char *fontname);
#ifdef __cplusplus
}
}
diff --git a/include/FTGLExtrdFont.h b/include/FTGLExtrdFont.h
index 54c4a9d..51fcefc 100644
--- a/include/FTGLExtrdFont.h
+++ b/include/FTGLExtrdFont.h
@@ -101,7 +101,7 @@ class FTGL_EXPORT FTGLExtrdFont : public FTFont
extern "C" {
namespace C {
#endif
-FTGL_EXPORT FTGLfont *ftglExtrdFontMake(const char *fontname);
+FTGL_EXPORT FTGLfont *ftglCreateExtrdFont(const char *fontname);
#ifdef __cplusplus
}
}
diff --git a/include/FTGLOutlineFont.h b/include/FTGLOutlineFont.h
index a89e0fb..cea153e 100644
--- a/include/FTGLOutlineFont.h
+++ b/include/FTGLOutlineFont.h
@@ -104,7 +104,7 @@ namespace C {
extern "C" {
#endif
-FTGL_EXPORT FTGLfont *ftglOutlineFontMake(const char *fontname);
+FTGL_EXPORT FTGLfont *ftglCreateOutlineFont(const char *fontname);
#ifdef __cplusplus
}
diff --git a/include/FTGLPixmapFont.h b/include/FTGLPixmapFont.h
index dacbbe9..577000b 100644
--- a/include/FTGLPixmapFont.h
+++ b/include/FTGLPixmapFont.h
@@ -104,7 +104,7 @@ class FTGL_EXPORT FTGLPixmapFont : public FTFont
extern "C" {
namespace C {
#endif
-FTGL_EXPORT FTGLfont *ftglPixmapFontMake(const char *fontname);
+FTGL_EXPORT FTGLfont *ftglCreatePixmapFont(const char *fontname);
#ifdef __cplusplus
}
}
diff --git a/include/FTGLPolygonFont.h b/include/FTGLPolygonFont.h
index 25fa4ea..8abfaa0 100644
--- a/include/FTGLPolygonFont.h
+++ b/include/FTGLPolygonFont.h
@@ -89,7 +89,7 @@ class FTGL_EXPORT FTGLPolygonFont : public FTFont
extern "C" {
namespace C {
#endif
-FTGL_EXPORT FTGLfont *ftglPolygonFontMake(const char *fontname);
+FTGL_EXPORT FTGLfont *ftglCreatePolygonFont(const char *fontname);
#ifdef __cplusplus
}
}
diff --git a/include/FTGLTextureFont.h b/include/FTGLTextureFont.h
index e537b6b..0c4f9e2 100644
--- a/include/FTGLTextureFont.h
+++ b/include/FTGLTextureFont.h
@@ -187,7 +187,7 @@ class FTGL_EXPORT FTGLTextureFont : public FTFont
extern "C" {
namespace C {
#endif
-FTGL_EXPORT FTGLfont *ftglTextureFontMake(const char *fontname);
+FTGL_EXPORT FTGLfont *ftglCreateTextureFont(const char *fontname);
#ifdef __cplusplus
}
}
diff --git a/src/FTGLBitmapFont.cpp b/src/FTGLBitmapFont.cpp
index 86d9c79..5ec1c7a 100644
--- a/src/FTGLBitmapFont.cpp
+++ b/src/FTGLBitmapFont.cpp
@@ -102,17 +102,13 @@ void FTGLBitmapFont::Render( const wchar_t* string)
glPopClientAttrib();
}
-#ifdef __cplusplus
-extern "C" {
-namespace C {
-#endif
-extern "C" FTGLfont* ftglBitmapFontMake(const char *fontname)
+
+namespace C
{
- FTGLfont *ftgl = createFTFont(Bitmap, fontname);
- return ftgl;
-}
-#ifdef __cplusplus
-}
+ extern "C" FTGLfont* ftglCreateBitmapFont(const char *fontname)
+ {
+ FTGLfont *ftgl = createFTFont(Bitmap, fontname);
+ return ftgl;
+ }
}
-#endif
diff --git a/src/FTGLExtrdFont.cpp b/src/FTGLExtrdFont.cpp
index 84a4862..9a2b3f5 100644
--- a/src/FTGLExtrdFont.cpp
+++ b/src/FTGLExtrdFont.cpp
@@ -70,17 +70,13 @@ FTGlyph* FTGLExtrdFont::MakeGlyph( unsigned int glyphIndex)
return NULL;
}
-#ifdef __cplusplus
-extern "C" {
-namespace C {
-#endif
-extern "C" FTGLfont* ftglExtrdFontMake(const char *fontname)
+
+namespace C
{
- FTGLfont *ftgl = createFTFont(Extrude, fontname);
- return ftgl;
-}
-#ifdef __cplusplus
-}
+ extern "C" FTGLfont* ftglCreateExtrdFont(const char *fontname)
+ {
+ FTGLfont *ftgl = createFTFont(Extrude, fontname);
+ return ftgl;
+ }
}
-#endif
diff --git a/src/FTGLOutlineFont.cpp b/src/FTGLOutlineFont.cpp
index c17ece0..cd78435 100644
--- a/src/FTGLOutlineFont.cpp
+++ b/src/FTGLOutlineFont.cpp
@@ -102,16 +102,13 @@ void FTGLOutlineFont::Render( const wchar_t* string)
glPopAttrib();
}
-#ifdef __cplusplus
-extern "C" {
-namespace C {
-#endif
-extern "C" FTGLfont* ftglOutlineFontMake(const char *fontname)
+
+namespace C
{
- FTGLfont *ftgl = createFTFont(Outline, fontname);
- return ftgl;
-}
-#ifdef __cplusplus
-}
+ extern "C" FTGLfont* ftglCreateOutlineFont(const char *fontname)
+ {
+ FTGLfont *ftgl = createFTFont(Outline, fontname);
+ return ftgl;
+ }
}
-#endif
+
diff --git a/src/FTGLPixmapFont.cpp b/src/FTGLPixmapFont.cpp
index 96159fe..71253ae 100644
--- a/src/FTGLPixmapFont.cpp
+++ b/src/FTGLPixmapFont.cpp
@@ -118,17 +118,13 @@ void FTGLPixmapFont::Render( const wchar_t* string)
glPopAttrib();
}
-#ifdef __cplusplus
-extern "C" {
-namespace C {
-#endif
-extern "C" FTGLfont* ftglPixmapFontMake(const char *fontname)
+
+namespace C
{
- FTGLfont *ftgl = createFTFont(Pixmap, fontname);
- return ftgl;
-}
-#ifdef __cplusplus
-}
+ extern "C" FTGLfont* ftglCreatePixmapFont(const char *fontname)
+ {
+ FTGLfont *ftgl = createFTFont(Pixmap, fontname);
+ return ftgl;
+ }
}
-#endif
diff --git a/src/FTGLPolygonFont.cpp b/src/FTGLPolygonFont.cpp
index a50faeb..0e128ff 100644
--- a/src/FTGLPolygonFont.cpp
+++ b/src/FTGLPolygonFont.cpp
@@ -68,17 +68,13 @@ FTGlyph* FTGLPolygonFont::MakeGlyph( unsigned int g)
return NULL;
}
-#ifdef __cplusplus
-extern "C" {
-namespace C {
-#endif
-extern "C" FTGLfont* ftglPolygonFontMake(const char *fontname)
+
+namespace C
{
- FTGLfont *ftgl = createFTFont(Polygon, fontname);
- return ftgl;
-}
-#ifdef __cplusplus
-}
+ extern "C" FTGLfont* ftglCreatePolygonFont(const char *fontname)
+ {
+ FTGLfont *ftgl = createFTFont(Polygon, fontname);
+ return ftgl;
+ }
}
-#endif
diff --git a/src/FTGLTextureFont.cpp b/src/FTGLTextureFont.cpp
index 592e398..de967f0 100644
--- a/src/FTGLTextureFont.cpp
+++ b/src/FTGLTextureFont.cpp
@@ -218,17 +218,13 @@ void FTGLTextureFont::Render( const wchar_t* string)
glPopAttrib();
}
-#ifdef __cplusplus
-extern "C" {
-namespace C {
-#endif
-extern "C" FTGLfont* ftglTextureFontMake(const char *fontname)
+
+namespace C
{
- FTGLfont *ftgl = createFTFont(Texture, fontname);
- return ftgl;
-}
-#ifdef __cplusplus
-}
+ extern "C" FTGLfont* ftglCreateTextureFont(const char *fontname)
+ {
+ FTGLfont *ftgl = createFTFont(Texture, fontname);
+ return ftgl;
+ }
}
-#endif
diff --git a/src/FTGlue.cpp b/src/FTGlue.cpp
index cd0c9fb..30b56f4 100644
--- a/src/FTGlue.cpp
+++ b/src/FTGlue.cpp
@@ -37,10 +37,8 @@
#include "FTInternals.h"
-#ifdef __cplusplus
-extern "C" {
-namespace C {
-#endif
+namespace C
+{
#define C_FUN(cret, cname, cargs, cxxerr, cxxname, cxxarg) \
cret cname cargs \
@@ -69,6 +67,9 @@ namespace C {
cxxerr; \
}
+// FTFont::~FTFont();
+C_FUN(void, ftglDestroyFont, (FTGLfont *f), return, ~FTFont, ());
+
// bool FTFont::Attach(const char* fontFilePath);
C_FUN(int, ftglAttachFile, (FTGLfont *f, const char* path),
return 0, Attach, (path));
@@ -133,8 +134,5 @@ C_FUN(void, ftglRender, (FTGLfont *f, const char * s), return, Render, (s));
// FT_Error FTFont::Error() const;
C_FUN(FT_Error, ftglError, (FTGLfont *f), return -1, Error, ());
-#ifdef __cplusplus
-} // extern "C"
} // namespace C
-#endif