blob: b2729f4f403b563dcf08d398dea46778587c58f9 (
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
|
--- opencascade/ros/src/OpenGl/OpenGl_FontMgr.cxx.orig 2011-03-06 21:55:55.000000000 +0100
+++ opencascade/ros/src/OpenGl/OpenGl_FontMgr.cxx 2011-03-06 23:06:05.000000000 +0100
@@ -1,8 +1,9 @@
#include <OpenGl_FontMgr.hxx>
-#include <FTGLTextureFont.h>
-#include <FTLibrary.h>
-#include <FTFace.h>
+#include <ftgl.h>
+// #include <FTGLTextureFont.h>
+// #include <FTLibrary.h>
+// #include <FTFace.h>
#include <Standard_Stream.hxx>
#undef TRACE
@@ -71,10 +72,29 @@
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());
+// FTFace face(it.Value()->FontPath()->ToCString());
+
+ FT_Library* library = new FT_Library;
+ FT_Error ftErrLib = FT_Init_FreeType( library);
+
+ const FT_Long DEFAULT_FACE_INDEX = 0;
+ FT_Face* ftFace = new FT_Face;
+
+ FT_Error err = FT_New_Face( (*library), it.Value()->FontPath()->ToCString(), DEFAULT_FACE_INDEX, ftFace);
+
+// if( err)
+// {
+// delete ftFace;
+// ftFace = 0;
+// }
+// else
+// {
+// numGlyphs = (*ftFace)->num_glyphs;
+// hasKerningTable = FT_HAS_KERNING((*ftFace));
+// }
- if ( face.Error() == FT_Err_Ok ) {
- if ( (*face.Face())->style_flags == 0 ) {
+ if ( err == FT_Err_Ok ) {
+ if ( (*ftFace)->style_flags == 0 ) {
info->SysFont = it.Value();
}
else {
@@ -82,22 +102,22 @@
#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() );
}
}
|