static inline void wxFreeFont(wxNativeFont font)
{
- XFreeFont((Display *)wxGetDisplay(), font);
+ XFreeFont((Display *)wxGetDisplay(), (XFontStruct *)font);
}
#elif defined(__WXGTK__)
static inline wxNativeFont wxLoadFont(const wxString& fontSpec)
{
- return gdk_font_load( wxConvertWX2MB(fontSpec) );
+ return gdk_font_load( wxConvertWX2MB(fontSpec) );
}
static inline void wxFreeFont(wxNativeFont font)
const wxString &facename,
wxFontEncoding encoding)
{
+ if ( encoding == wxFONTENCODING_DEFAULT )
+ {
+ encoding = wxFont::GetDefaultEncoding();
+ }
+
// first determine the encoding - if the font doesn't exist at all in this
// encoding, it's useless to do all other approximations (i.e. size,
// family &c don't matter much)
wxNativeEncodingInfo info;
- if (encoding == wxFONTENCODING_SYSTEM)
+ if ( encoding == wxFONTENCODING_SYSTEM )
{
// This will always work so we don't test to save time
wxGetNativeFontEncoding(wxFONTENCODING_SYSTEM, &info);
// so it would provoke a crash
wxGetNativeFontEncoding(wxFONTENCODING_SYSTEM, &info);
}
- }
+ }
}
// OK, we have the correct xregistry/xencoding in info structure
-
wxNativeFont font = wxLoadQueryFont( pointSize, family, style, weight,
underlined, facename,
info.xregistry, info.xencoding );
// returns TRUE if there are any fonts matching this font spec
static bool wxTestFontSpec(const wxString& fontspec)
{
+ // some X servers will fail to load this font because there are too many
+ // matches so we must test explicitly for this
+ if ( fontspec == _T("-*-*-*-*-*-*-*-*-*-*-*-*-*-*") )
+ {
+ return TRUE;
+ }
+
wxNativeFont test = wxLoadFont(fontspec);
if ( test )
{