Commit 68738f93152c8133464a58bb47ded1f0297cb8b0

sammy 2008-05-09T10:02:46

* Put a few wrapper functions into extern "C++" braces because they return references to C++ objects.

diff --git a/src/FTFont/FTFontGlue.cpp b/src/FTFont/FTFontGlue.cpp
index f316875..67f43b8 100644
--- a/src/FTFont/FTFontGlue.cpp
+++ b/src/FTFont/FTFontGlue.cpp
@@ -221,9 +221,11 @@ C_FUN(float, ftglGetFontLineHeight, (FTGLfont *f), return 0.f, LineHeight, ());
 
 // void FTFont::BBox(const char* string, float& llx, float& lly, float& llz,
 //                   float& urx, float& ury, float& urz);
+extern "C++" {
 C_FUN(static FTBBox, _ftglGetFontBBox, (FTGLfont *f, char const *s,
                                         int start, int end),
       return static_ftbbox, BBox, (s, start, end));
+}
 
 void ftglGetFontBBox(FTGLfont *f, const char* s, int start, int end,
                      float c[6])
diff --git a/src/FTGlyph/FTGlyphGlue.cpp b/src/FTGlyph/FTGlyphGlue.cpp
index 73e9cc4..be9241e 100644
--- a/src/FTGlyph/FTGlyphGlue.cpp
+++ b/src/FTGlyph/FTGlyphGlue.cpp
@@ -193,9 +193,11 @@ void ftglDestroyGlyph(FTGLglyph *g)
 }
 
 // const FTPoint& FTGlyph::Render(const FTPoint& pen, int renderMode);
+extern "C++" {
 C_FUN(static const FTPoint&, _ftglRenderGlyph, (FTGLglyph *g,
                                    const FTPoint& pen, int renderMode),
       return static_ftpoint, Render, (pen, renderMode));
+}
 
 void ftglRenderGlyph(FTGLglyph *g, FTGL_DOUBLE penx, FTGL_DOUBLE peny,
                      int renderMode, FTGL_DOUBLE *advancex,
@@ -208,8 +210,10 @@ void ftglRenderGlyph(FTGLglyph *g, FTGL_DOUBLE penx, FTGL_DOUBLE peny,
 }
 
 // const FTPoint& FTGlyph::Advance() const;
+extern "C++" {
 C_FUN(static const FTPoint&, _ftglGetGlyphAdvance, (FTGLglyph *g),
       return static_ftpoint, Advance, ());
+}
 
 void ftglGetGlyphAdvance(FTGLglyph *g, FTGL_DOUBLE *advancex,
                          FTGL_DOUBLE *advancey)
@@ -220,8 +224,10 @@ void ftglGetGlyphAdvance(FTGLglyph *g, FTGL_DOUBLE *advancex,
 }
 
 // const FTBBox& FTGlyph::BBox() const;
+extern "C++" {
 C_FUN(static const FTBBox&, _ftglGetGlyphBBox, (FTGLglyph *g),
       return static_ftbbox, BBox, ());
+}
 
 void ftglGetGlyphBBox(FTGLglyph *g, float bounds[6])
 {
diff --git a/src/FTLayout/FTLayoutGlue.cpp b/src/FTLayout/FTLayoutGlue.cpp
index d3b3411..e37d11e 100644
--- a/src/FTLayout/FTLayoutGlue.cpp
+++ b/src/FTLayout/FTLayoutGlue.cpp
@@ -88,9 +88,11 @@ void ftglDestroyLayout(FTGLlayout *l)
     free(l);
 }
 
-// virtual void BBox(const char* string, float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)
+// virtual FTBBox FTLayout::BBox(const char* string)
+extern "C++" {
 C_FUN(static FTBBox, _ftgGetlLayoutBBox, (FTGLlayout *l, const char *s),
       return static_ftbbox, BBox, (s));
+}
 
 void ftgGetlLayoutBBox(FTGLlayout *l, const char * s, float c[6])
 {
@@ -100,11 +102,11 @@ void ftgGetlLayoutBBox(FTGLlayout *l, const char * s, float c[6])
     c[3] = upper.Xf(); c[4] = upper.Yf(); c[5] = upper.Zf();
 }
 
-// virtual void Render(const char* string, int renderMode);
+// virtual void FTLayout::Render(const char* string, int renderMode);
 C_FUN(void, ftglRenderLayout, (FTGLlayout *l, const char *s, int r),
       return, Render, (s, r));
 
-// void RenderSpace(const char *string, const float ExtraSpace = 0.0)
+// void FTSimpleLayout::RenderSpace(const char *string, const float ExtraSpace = 0.0)
 C_FUN(void, ftglRenderLayoutSpace, (FTGLlayout *l, const char *s, float e),
       return, RenderSpace, (s, e));
 
@@ -126,7 +128,7 @@ void ftglSetLayoutFont(FTGLlayout *l, FTGLfont *font)
                     __FUNCTION__, l->type);
 }
 
-// FTFont *GetFont()
+// FTFont *FTSimpleLayout::GetFont()
 FTGLfont *ftglGetLayoutFont(FTGLlayout *l)
 {
     if(!l || !l->ptr)
@@ -137,27 +139,27 @@ FTGLfont *ftglGetLayoutFont(FTGLlayout *l)
     return l->font;
 }
 
-// void SetLineLength(const float LineLength);
+// void FTSimpleLayout::SetLineLength(const float LineLength);
 C_FUN(void, ftglSetLayoutLineLength, (FTGLlayout *l, const float length),
       return, SetLineLength, (length));
 
-// float GetLineLength() const
+// float FTSimpleLayout::GetLineLength() const
 C_FUN(float, ftglGetLayoutLineLength, (FTGLlayout *l),
       return 0.0f, GetLineLength, ());
 
-// void SetAlignment(const TextAlignment Alignment)
+// void FTSimpleLayout::SetAlignment(const TextAlignment Alignment)
 C_FUN(void, ftglSetLayoutAlignment, (FTGLlayout *l, const int a),
       return, SetAlignment, ((FTGL::TextAlignment)a));
 
-// TextAlignment GetAlignment() const
+// TextAlignment FTSimpleLayout::GetAlignment() const
 C_FUN(int, ftglGetLayoutAlignement, (FTGLlayout *l),
       return FTGL::ALIGN_LEFT, GetAlignment, ());
 
-// void SetLineSpacing(const float LineSpacing)
+// void FTSimpleLayout::SetLineSpacing(const float LineSpacing)
 C_FUN(void, ftglSetLayoutLineSpacing, (FTGLlayout *l, const float f),
       return, SetLineSpacing, (f));
 
-// float GetLineSpacing() const
+// float FTSimpleLayout::GetLineSpacing() const
 C_FUN(float, ftglGetLayoutLineSpacing, (FTGLlayout *l),
       return 0.0f, GetLineSpacing, ());