X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7bd236e6da74203ba429941d3f9643291494b420..69659fd770f615210efac4b4fa741b3ad6223616:/src/common/fontcmn.cpp diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 80d2e7b1a0..4fcd211e53 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -31,10 +31,9 @@ #include "wx/intl.h" #include "wx/dcscreen.h" #include "wx/log.h" + #include "wx/gdicmn.h" #endif // WX_PRECOMP -#include "wx/gdicmn.h" - #if defined(__WXMSW__) #include "wx/msw/private.h" // includes windows.h for LOGFONT #include "wx/msw/winundef.h" @@ -268,7 +267,7 @@ wxString wxFontBase::GetNativeFontInfoDesc() const if ( fontInfo ) { fontDesc = fontInfo->ToString(); - wxASSERT_MSG(!fontDesc.IsEmpty(), wxT("This should be a non-empty string!")); + wxASSERT_MSG(!fontDesc.empty(), wxT("This should be a non-empty string!")); } else { @@ -285,11 +284,11 @@ wxString wxFontBase::GetNativeFontInfoUserDesc() const if ( fontInfo ) { fontDesc = fontInfo->ToUserString(); - wxASSERT_MSG(!fontDesc.IsEmpty(), wxT("This should be a non-empty string!")); + wxASSERT_MSG(!fontDesc.empty(), wxT("This should be a non-empty string!")); } else { - wxASSERT_MSG(0, wxT("Derived class should have created the wxNativeFontInfo!")); + wxFAIL_MSG(wxT("Derived class should have created the wxNativeFontInfo!")); } return fontDesc; @@ -304,7 +303,6 @@ bool wxFontBase::SetNativeFontInfo(const wxString& info) return true; } - UnRef(); return false; } @@ -317,7 +315,6 @@ bool wxFontBase::SetNativeFontInfoUserDesc(const wxString& info) return true; } - UnRef(); return false; } @@ -325,10 +322,16 @@ bool wxFontBase::operator==(const wxFont& font) const { // either it is the same font, i.e. they share the same common data or they // have different ref datas but still describe the same font - return GetFontData() == font.GetFontData() || + return IsSameAs(font) || ( Ok() == font.Ok() && GetPointSize() == font.GetPointSize() && + // in wxGTK1 GetPixelSize() calls GetInternalFont() which uses + // operator==() resulting in infinite recursion so we can't use it + // in that port +#if !defined(__WXGTK__) || defined(__WXGTK20__) + GetPixelSize() == font.GetPixelSize() && +#endif GetFamily() == font.GetFamily() && GetStyle() == font.GetStyle() && GetWeight() == font.GetWeight() && @@ -666,7 +669,10 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) wxString face; unsigned long size; - bool weightfound = false, pointsizefound = false, encodingfound = false; + bool weightfound = false, pointsizefound = false; +#if wxUSE_FONTMAP + bool encodingfound = false; +#endif while ( tokenizer.HasMoreTokens() ) {