Lines 88-97
Link Here
|
88 |
if ( it.Value()->FontAspect() == OSD_FA_Regular ) { |
88 |
if ( it.Value()->FontAspect() == OSD_FA_Regular ) { |
89 |
//this workaround for fonts with names dependent on system locale. |
89 |
//this workaround for fonts with names dependent on system locale. |
90 |
//for example: "Times New Roman Fett Kursive" or "Times New Roman Gras Italiqui" |
90 |
//for example: "Times New Roman Fett Kursive" or "Times New Roman Gras Italiqui" |
91 |
FTFace face(it.Value()->FontPath()->ToCString()); |
91 |
// FTFace face(it.Value()->FontPath()->ToCString()); |
92 |
|
92 |
|
93 |
if ( face.Error() == FT_Err_Ok ) { |
93 |
FT_Library* library = new FT_Library; |
94 |
if ( (*face.Face())->style_flags == 0 ) { |
94 |
FT_Error ftErrLib = FT_Init_FreeType( library); |
|
|
95 |
|
96 |
const FT_Long DEFAULT_FACE_INDEX = 0; |
97 |
FT_Face* ftFace = new FT_Face; |
98 |
FT_Error err = FT_New_Face( (*library), it.Value()->FontPath()->ToCString(), DEFAULT_FACE_INDEX, ftFace); |
99 |
|
100 |
if ( err == FT_Err_Ok ) { |
101 |
if ( (*ftFace)->style_flags == 0 ) { |
95 |
info->SysFont = it.Value(); |
102 |
info->SysFont = it.Value(); |
96 |
} |
103 |
} |
97 |
else { |
104 |
else { |
Lines 99-120
Link Here
|
99 |
#ifdef TRACE |
106 |
#ifdef TRACE |
100 |
cout << "TKOpenGl::initializeFontDB() detected new font!\n" |
107 |
cout << "TKOpenGl::initializeFontDB() detected new font!\n" |
101 |
<< "\tFont Previous Name: " << it.Value()->FontName()->ToCString() << endl |
108 |
<< "\tFont Previous Name: " << it.Value()->FontName()->ToCString() << endl |
102 |
<< "\tFont New Name: " << (*face.Face())->family_name << endl |
109 |
<< "\tFont New Name: " << (*ftFace)->family_name << endl |
103 |
<< "\tFont Aspect: " << (*face.Face())->style_flags << endl; |
110 |
<< "\tFont Aspect: " << (*ftFace)->style_flags << endl; |
|
|
111 |
|
104 |
#endif |
112 |
#endif |
105 |
OSD_FontAspect aspect = OSD_FA_Regular; |
113 |
OSD_FontAspect aspect = OSD_FA_Regular; |
106 |
if ( (*face.Face())->style_flags == (FT_STYLE_FLAG_ITALIC | FT_STYLE_FLAG_BOLD) ) |
114 |
if ( (*ftFace)->style_flags == (FT_STYLE_FLAG_ITALIC | FT_STYLE_FLAG_BOLD) ) |
107 |
aspect = OSD_FA_BoldItalic; |
115 |
aspect = OSD_FA_BoldItalic; |
108 |
else if ( (*face.Face())->style_flags == FT_STYLE_FLAG_ITALIC ) |
116 |
else if ( (*ftFace)->style_flags == FT_STYLE_FLAG_ITALIC ) |
109 |
aspect = OSD_FA_Italic; |
117 |
aspect = OSD_FA_Italic; |
110 |
else if ( (*face.Face())->style_flags == FT_STYLE_FLAG_BOLD ) |
118 |
else if ( (*ftFace)->style_flags == FT_STYLE_FLAG_BOLD ) |
111 |
aspect = OSD_FA_Bold; |
119 |
aspect = OSD_FA_Bold; |
112 |
|
120 |
|
113 |
#ifdef TRACE |
121 |
#ifdef TRACE |
114 |
cout << "\tOSD_FontAspect: " << aspect << endl; |
122 |
cout << "\tOSD_FontAspect: " << aspect << endl; |
115 |
#endif |
123 |
#endif |
116 |
Handle(TCollection_HAsciiString) aFontName = |
124 |
Handle(TCollection_HAsciiString) aFontName = |
117 |
new TCollection_HAsciiString( (*face.Face())->family_name ); |
125 |
new TCollection_HAsciiString( (*ftFace)->family_name ); |
118 |
info->SysFont = new OSD_SystemFont( aFontName, aspect, it.Value()->FontPath() ); |
126 |
info->SysFont = new OSD_SystemFont( aFontName, aspect, it.Value()->FontPath() ); |
119 |
} |
127 |
} |
120 |
} |
128 |
} |