X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ff42758536f8d573409bf6c35528497ba36b4d0e..fcdd53359135f790b85728c4254b97095a56dad8:/src/common/fontcmn.cpp diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index 20b8c303d0..a5ff16a10f 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -55,7 +55,6 @@ static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize) { - int currentSize = 0; int largestGood = 0; int smallestBad = 0; @@ -64,7 +63,7 @@ static void AdjustFontSize(wxFont& font, wxDC& dc, const wxSize& pixelSize) // NB: this assignment was separated from the variable definition // in order to fix a gcc v3.3.3 compiler crash - currentSize = font.GetPointSize(); + int currentSize = font.GetPointSize(); while (currentSize > 0) { dc.SetFont(font); @@ -131,9 +130,9 @@ wxFontBase::~wxFontBase() /* static */ wxFont *wxFontBase::New(int size, - int family, - int style, - int weight, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, bool underlined, const wxString& face, wxFontEncoding encoding) @@ -177,9 +176,9 @@ wxFont *wxFontBase::New(int pointSize, /* static */ wxFont *wxFontBase::New(const wxSize& pixelSize, - int family, - int style, - int weight, + wxFontFamily family, + wxFontStyle style, + wxFontWeight weight, bool underlined, const wxString& face, wxFontEncoding encoding) @@ -341,11 +340,6 @@ bool wxFontBase::operator==(const wxFont& font) const ); } -bool wxFontBase::operator!=(const wxFont& font) const -{ - return !(*this == font); -} - wxString wxFontBase::GetFamilyString() const { wxCHECK_MSG( Ok(), wxT("wxDEFAULT"), wxT("invalid font") ); @@ -799,3 +793,26 @@ bool wxNativeFontInfo::FromUserString(const wxString& s) } #endif // generic or wxMSW or wxOS2 + + +// wxFont <-> wxString utilities, used by wxConfig +wxString wxToString(const wxFontBase& font) +{ + return font.IsOk() ? font.GetNativeFontInfoDesc() + : wxString(); +} + +bool wxFromString(const wxString& str, wxFontBase *font) +{ + wxCHECK_MSG( font, false, _T("NULL output parameter") ); + + if ( str.empty() ) + { + *font = wxNullFont; + return true; + } + + return font->SetNativeFontInfo(str); +} + +