#ifndef WX_PRECOMP
#endif // PCH
+#ifdef __X__
+ #include <X11/Xlib.h>
+
+ #include "wx/utils.h" // for wxGetDisplay()
+#elif defined(__WXGTK__)
+ #include "gdk/gdk.h"
+#endif
+
#include "wx/fontutil.h"
#include "wx/fontmap.h"
#include "wx/tokenzr.h"
static inline void wxFreeFont(wxNativeFont font)
{
- XFreeFont((Display *)wxGetDisplay(), font);
+ XFreeFont((Display *)wxGetDisplay(), (XFontStruct *)font);
}
#elif defined(__WXGTK__)
- #include "gdk/gdk.h"
-
static inline wxNativeFont wxLoadFont(const wxString& fontSpec)
{
return gdk_font_load( wxConvertWX2MB(fontSpec) );
case wxFONTENCODING_SYSTEM:
info->xregistry =
- info->xencoding = wxT('*');
+ info->xencoding = wxT("*");
break;
default:
// encoding, it's useless to do all other approximations (i.e. size,
// family &c don't matter much)
wxNativeEncodingInfo info;
- if ( !wxGetNativeFontEncoding(encoding, &info) ||
- !wxTestFontEncoding(info) )
+ if (encoding == wxFONTENCODING_SYSTEM)
+ {
+ // This will always work so we don't test to save time
+ wxGetNativeFontEncoding(wxFONTENCODING_SYSTEM, &info);
+ }
+ else
{
- if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
+ if ( !wxGetNativeFontEncoding(encoding, &info) ||
+ !wxTestFontEncoding(info) )
{
- // unspported encoding - replace it with the default
- //
- // NB: we can't just return 0 from here because wxGTK code doesn't
- // check for it (i.e. it supposes that we'll always succeed),
- // so it would provoke a crash
- wxGetNativeFontEncoding(wxFONTENCODING_SYSTEM, &info);
- }
+ if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
+ {
+ // unspported encoding - replace it with the default
+ //
+ // NB: we can't just return 0 from here because wxGTK code doesn't
+ // check for it (i.e. it supposes that we'll always succeed),
+ // so it would provoke a crash
+ wxGetNativeFontEncoding(wxFONTENCODING_SYSTEM, &info);
+ }
+ }
}
- //else: we have the correct xregistry/xencoding in info structure
+
+ // OK, we have the correct xregistry/xencoding in info structure
wxNativeFont font = wxLoadQueryFont( pointSize, family, style, weight,
underlined, facename,