fix-ftgl-includes
authorDebian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
Fri, 6 May 2011 13:52:41 +0000 (14:52 +0100)
committerAdam C. Powell, IV <hazelsct@debian.org>
Fri, 6 May 2011 13:52:41 +0000 (14:52 +0100)
Fix detection of FTGL in configure.in

Also modify installed headers to search for FTGL headers in
the right directory.  This is not needed to build opencascade,
but may help people including those headers.
And last, fix usage of FTGL, FTFace is an internal structure
of FTGL and is no more exported.

Submitted upstream: http://www.opencascade.org/org/forum/thread_20128/

Gbp-Pq: Topic submitted
Gbp-Pq: Name fix-ftgl-includes.patch

ros/configure.in
ros/inc/OpenGl_FontMgr.hxx
ros/inc/OpenGl_TextRender.hxx
ros/src/OpenGl/OpenGl_FontMgr.cxx

index cafb4072fce611c4246bc7609ed5e88773420025..dcbcc831736cf4ff2dda7f5ef475fd7fdad7b195 100644 (file)
@@ -422,7 +422,7 @@ else
   HAVE_FTGL=yes
   HAVE_FTGL_INC=yes
   CPPFLAGS="-I$ftgl/include $CPPFLAGS";
-  AC_CHECK_HEADER( [FTGL/FTGL.h], [], [HAVE_FTGL_INC=no] )
+  AC_CHECK_HEADER( [FTGL/ftgl.h], [], [HAVE_FTGL_INC=no] )
   if test "x$HAVE_FTGL_INC" = "xyes"; then
     CSF_FTGL_INCLUDES="-I$ftgl/include/FTGL"
     HAVE_FTGL_LIB=yes
@@ -431,9 +431,9 @@ else
     LIBS_sv=$LIBS
     LIBS="-lftgl $CSF_OpenGlLibs_LIB $LIBS"
     #we have problem with unresolved symbols on 64 stations
-    CSF_FTGL_LIB="-L$ftgl/lib -lftgl"
+    CSF_FTGL_LIB="-L$ftgl/lib -lftgl -lfreetype"
     AC_TRY_LINK([
-#include <FTGL/FTGL.h>
+#include <FTGL/ftgl.h>
 #include <FTGL/FTGLTextureFont.h>
 ], [
 FTGLTextureFont font("");], [
index d32b10947a953e47a49f1a3c3b615cfd09b51024..0374e650d403ecbad911bf72b05c0f422477dc3c 100644 (file)
@@ -7,7 +7,7 @@
 # include <stdlib.h>
 #endif
 
-#include <FTFont.h>
+#include <FTGL/ftgl.h>
 
 #include <InterfaceGraphic.hxx>
 #include <TCollection_HAsciiString.hxx>
index 8edfb6a84236633c5a272216e8cc8da450c0ce0e..f6ff347264410e5d8c96077b1da3bd2818d07ed6 100644 (file)
@@ -5,7 +5,7 @@
 #include <NCollection_DataMap.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_HAsciiString.hxx>
-#include <FTFont.h>
+#include <FTGL/ftgl.h>
 
 #define NUM_FONT_SIZES 40
 #define NUM_CHAR_FONT 1024
index a422e90fcb5bced238fab3743bed287bb5f37e60..c630d86a4b9c1207e0d1140f605e5328c2ee6bec 100644 (file)
@@ -1,8 +1,6 @@
 #include <OpenGl_FontMgr.hxx>
 
-#include <FTGLTextureFont.h>        
-#include <FTLibrary.h>
-#include <FTFace.h>
+#include <FTGL/ftgl.h>
 #include <Standard_Stream.hxx>
 
 #undef TRACE
@@ -60,7 +58,10 @@ OpenGl_FontMgr* OpenGl_FontMgr::instance()
 void OpenGl_FontMgr::_initializeFontDB()
 {
   Handle(OSD_FontMgr) fntMgr = OSD_FontMgr::GetInstance();
-  if ( !fntMgr.IsNull() ) {
+  FT_Library library;
+  // FIXME: FT_Done_FreeType( library ) should be called on exit
+  int error = FT_Init_FreeType( &library );
+  if ( !fntMgr.IsNull() && !error) {
 
     OSD_NListOfSystemFont fontList = fntMgr->GetAvalableFonts();
     if ( fontList.Size() != 0 ) {
@@ -71,10 +72,11 @@ void OpenGl_FontMgr::_initializeFontDB()
         if ( it.Value()->FontAspect() == OSD_FA_Regular ) {
           //this workaround for fonts with names dependent on system locale.
           //for example: "Times New Roman Fett Kursive" or "Times New Roman Gras Italiqui"
-          FTFace face(it.Value()->FontPath()->ToCString());
-              
-          if ( face.Error() == FT_Err_Ok ) {
-            if ( (*face.Face())->style_flags == 0 ) {
+          FT_Face ftFace;
+          error = FT_New_Face(library,
+              it.Value()->FontPath()->ToCString(), 0, &ftFace);
+          if ( !error ) {
+            if ( ftFace->style_flags == 0 ) {
               info->SysFont = it.Value();
             }
             else {
@@ -82,24 +84,25 @@ void OpenGl_FontMgr::_initializeFontDB()
 #ifdef TRACE
               cout << "TKOpenGl::initializeFontDB() detected new font!\n"
                 << "\tFont Previous Name: " << it.Value()->FontName()->ToCString() << endl
-                << "\tFont New Name: " << (*face.Face())->family_name << endl
-                << "\tFont Aspect: " << (*face.Face())->style_flags << endl;
+                << "\tFont New Name: " << ftFace->family_name << endl
+                << "\tFont Aspect: " << ftFace->style_flags << endl;
 #endif
               OSD_FontAspect aspect = OSD_FA_Regular;
-              if ( (*face.Face())->style_flags == (FT_STYLE_FLAG_ITALIC | FT_STYLE_FLAG_BOLD) )
+              if ( ftFace->style_flags == (FT_STYLE_FLAG_ITALIC | FT_STYLE_FLAG_BOLD) )
                 aspect = OSD_FA_BoldItalic;
-              else if ( (*face.Face())->style_flags == FT_STYLE_FLAG_ITALIC )
+              else if ( ftFace->style_flags == FT_STYLE_FLAG_ITALIC )
                 aspect = OSD_FA_Italic;
-              else if ( (*face.Face())->style_flags == FT_STYLE_FLAG_BOLD )
+              else if ( ftFace->style_flags == FT_STYLE_FLAG_BOLD )
                 aspect = OSD_FA_Bold;
 
 #ifdef TRACE
               cout << "\tOSD_FontAspect: " << aspect << endl;
 #endif
               Handle(TCollection_HAsciiString) aFontName =
-                new TCollection_HAsciiString( (*face.Face())->family_name );
+                new TCollection_HAsciiString( ftFace->family_name );
               info->SysFont = new OSD_SystemFont( aFontName, aspect, it.Value()->FontPath() );
             }
+            FT_Done_Face(ftFace);
           }
           else
             continue;