use facename in wxFontRefData::Init() in Unicode build (part of patch 1671684)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-08 00:40:38 +00:00
parent 696d13ee0e
commit 3d63133a5e

View File

@@ -40,6 +40,7 @@
#include "wx/fontutil.h" // for wxNativeFontInfo #include "wx/fontutil.h" // for wxNativeFontInfo
#include "wx/tokenzr.h" #include "wx/tokenzr.h"
#include "wx/fontenum.h"
#include "wx/x11/private.h" #include "wx/x11/private.h"
@@ -196,27 +197,42 @@ void wxFontRefData::Init(int pointSize,
m_encoding = encoding; m_encoding = encoding;
#if wxUSE_UNICODE #if wxUSE_UNICODE
if ( m_nativeFontInfo.description )
pango_font_description_free(m_nativeFontInfo.description);
// Create native font info // Create native font info
m_nativeFontInfo.description = pango_font_description_new(); m_nativeFontInfo.description = pango_font_description_new();
// And set its values // if a face name is specified, use it if it's available, otherwise use
switch (m_family) // just the family
if ( faceName.empty() || !wxFontEnumerator::IsValidFacename(faceName) )
{ {
case wxFONTFAMILY_MODERN: // TODO: scan system for valid fonts matching the given family instead
case wxFONTFAMILY_TELETYPE: // of hardcoding them here
pango_font_description_set_family( m_nativeFontInfo.description, "monospace" ); switch ( m_family )
break; {
case wxFONTFAMILY_ROMAN: case wxFONTFAMILY_TELETYPE:
pango_font_description_set_family( m_nativeFontInfo.description, "serif" ); m_faceName = wxT("monospace");
break; break;
default:
pango_font_description_set_family( m_nativeFontInfo.description, "sans" ); case wxFONTFAMILY_ROMAN:
break; m_faceName = wxT("serif");
break;
default:
m_faceName = wxT("sans");
}
} }
SetStyle( m_style ); else // specified face name is available, use it
SetPointSize( m_pointSize ); {
SetWeight( m_weight ); m_faceName = faceName;
#endif }
m_nativeFontInfo.SetFaceName(m_faceName);
m_nativeFontInfo.SetPointSize(m_pointSize);
m_nativeFontInfo.SetWeight((wxFontWeight)m_weight);
m_nativeFontInfo.SetStyle((wxFontStyle)m_style);
#endif // wxUSE_UNICODE
} }
void wxFontRefData::InitFromNative() void wxFontRefData::InitFromNative()