X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a4bacadeb2bf081d4d9911af2505ec06f17eb2a3..fd69e87d2586726e57446d7208ceb8854bc74166:/src/unix/fontutil.cpp?ds=sidebyside diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index be3861a149..fa20c75985 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -61,17 +61,7 @@ #elif defined(__WXGTK__) static inline wxNativeFont wxLoadFont(const wxString& fontSpec) { - wxNativeFont font = gdk_font_load( wxConvertWX2MB(fontSpec) ); - if(fontSpec == "-*-*-*-*-*-*-*-*-*-*-*-*-*-*") - { - if(font == NULL) - font = gdk_font_load (wxConvertWX2MB("-*-*-*-*-*-*-*-*-75-*-*-*-*-*")); - if(font == NULL) - font = gdk_font_load (wxConvertWX2MB("-*-*-*-*-*-*-*-*-100-*-*-*-*-*")); - if(font == NULL) - font = gdk_font_load (wxConvertWX2MB("-*-fixed-*-*-*-*-*-*-*-*-*-*-*-*")); - } - return font; + return gdk_font_load( wxConvertWX2MB(fontSpec) ); } static inline void wxFreeFont(wxNativeFont font) @@ -228,11 +218,16 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, 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); @@ -251,11 +246,10 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // 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 ); @@ -317,6 +311,13 @@ wxNativeFont wxLoadQueryNearestFont(int pointSize, // 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 ) {