summaryrefslogtreecommitdiff
path: root/graphics/OpenCASCADE/OpenCASCADE-6.5.2_ftgl.patch
blob: cb7fbc99d987c486c13e6693bebb506e3a67d481 (plain)
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
--- OpenCASCADE-6.5.2/ros/configure.ac	2011-09-30 13:32:47.000000000 -0300
+++ OpenCASCADE-6.5.2_patched/ros/configure.ac	2012-01-02 13:35:24.000000000 -0200
@@ -422,7 +422,7 @@
   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 @@
     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("");], [
--- OpenCASCADE-6.5.2/ros/inc/OpenGl_FontMgr.hxx	2011-09-02 12:43:25.000000000 -0300
+++ OpenCASCADE-6.5.2_patched/ros/inc/OpenGl_FontMgr.hxx	2012-01-02 13:32:57.000000000 -0200
@@ -6,7 +6,7 @@
 # include <stdlib.h>
 #endif
 
-#include <FTFont.h>
+#include <FTGL/FTFont.h>
 
 #include <InterfaceGraphic.hxx>
 #include <TCollection_HAsciiString.hxx>
--- OpenCASCADE-6.5.2/ros/inc/OpenGl_TextRender.hxx	2011-09-02 12:43:25.000000000 -0300
+++ OpenCASCADE-6.5.2_patched/ros/inc/OpenGl_TextRender.hxx	2012-01-02 13:32:57.000000000 -0200
@@ -5,7 +5,7 @@
 #include <NCollection_DataMap.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_HAsciiString.hxx>
-#include <FTFont.h>
+#include <FTGL/FTFont.h>
 
 #define NUM_FONT_SIZES 40
 #define NUM_CHAR_FONT 1024
--- OpenCASCADE-6.5.2/ros/src/OpenGl/OpenGl_FontMgr.cxx	2011-09-02 12:43:25.000000000 -0300
+++ OpenCASCADE-6.5.2_patched/ros/src/OpenGl/OpenGl_FontMgr.cxx	2012-01-02 13:32:57.000000000 -0200
@@ -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,6 +58,8 @@
 void OpenGl_FontMgr::_initializeFontDB()
 {
   Handle(OSD_FontMgr) fntMgr = OSD_FontMgr::GetInstance();
+  FT_Library  library;
+  int error = FT_Init_FreeType( &library );
   if ( !fntMgr.IsNull() ) {
 
     OSD_NListOfSystemFont fontList = fntMgr->GetAvalableFonts();
@@ -68,13 +68,14 @@
       OSD_NListOfSystemFont::Iterator it(fontList);
       for ( ; it.More(); it.Next() ) {
         OGLFont_SysInfo* info = new OGLFont_SysInfo();
-        if ( it.Value()->FontAspect() == OSD_FA_Regular ) {
+        if ( it.Value()->FontAspect() == OSD_FA_Regular && !error ) {
           //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,27 +83,30 @@
 #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() );
             }
           }
           else
+          {
+            error = 0;
             continue;
+          }
         } else {
           info->SysFont = it.Value();
         }