X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ab5fe83396c13f9fbf01630c52adf4df7607cbfe..824e8eaaccab583f121e05e03678b110588a48cd:/src/unix/fontutil.cpp diff --git a/src/unix/fontutil.cpp b/src/unix/fontutil.cpp index 841e90bf64..27c2de464a 100644 --- a/src/unix/fontutil.cpp +++ b/src/unix/fontutil.cpp @@ -196,10 +196,24 @@ wxString wxNativeFontInfo::ToUserString() const return GetXFontName(); } -bool wxNativeFontInfo::FromXFontName(const wxString& xFontName) +wxString wxNativeFontInfo::GetXFontComponent(wxXLFDField field) const +{ + wxCHECK_MSG( field < wxXLFD_MAX, _T(""), _T("invalid XLFD field") ); + + if ( fontElements[0].empty() ) + { + // const_cast + if ( !((wxNativeFontInfo *)this)->FromXFontName(xFontName) ) + return _T(""); + } + + return fontElements[field]; +} + +bool wxNativeFontInfo::FromXFontName(const wxString& fontname) { // TODO: we should be able to handle the font aliases here, but how? - wxStringTokenizer tokenizer(xFontName, _T("-"), wxTOKEN_STRTOK); + wxStringTokenizer tokenizer(fontname, _T("-"), wxTOKEN_STRTOK); for ( size_t n = 0; n < WXSIZEOF(fontElements); n++ ) {