X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e0e025ecd13ae6d1470e72b428e934748ce66d6..b3402d0df8c9f763da1e32fc28c824014e5516c6:/src/unix/fontutil.cpp diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index 62b8e604f5..db1939e352 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -206,6 +206,8 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding, return FALSE; } + info->encoding = encoding; + return TRUE; } @@ -391,10 +393,47 @@ static wxNativeFont wxLoadQueryFont(int pointSize, wxString xstyle; switch (style) { - case wxITALIC: xstyle = wxT("i"); break; - case wxSLANT: xstyle = wxT("o"); break; - case wxNORMAL: xstyle = wxT("r"); break; - default: xstyle = wxT("*"); break; + case wxSLANT: + fontSpec.Printf(wxT("-*-%s-*-o-*-*-*-*-*-*-*-*-*-*"), + xfamily.c_str()); + if ( wxTestFontSpec(fontSpec) ) + { + xstyle = wxT("o"); + break; + } + // fall through - try wxITALIC now + + case wxITALIC: + fontSpec.Printf(wxT("-*-%s-*-i-*-*-*-*-*-*-*-*-*-*"), + xfamily.c_str()); + if ( wxTestFontSpec(fontSpec) ) + { + xstyle = wxT("i"); + } + else if ( style == wxITALIC ) // and not wxSLANT + { + // try wxSLANT + fontSpec.Printf(wxT("-*-%s-*-o-*-*-*-*-*-*-*-*-*-*"), + xfamily.c_str()); + if ( wxTestFontSpec(fontSpec) ) + { + xstyle = wxT("o"); + } + else + { + // no italic, no slant - leave default + xstyle = wxT("*"); + } + } + break; + + default: + wxFAIL_MSG(_T("unknown font style")); + // fall back to normal + + case wxNORMAL: + xstyle = wxT("r"); + break; } wxString xweight;