X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3515776ea5638d93b85c871667a77f9d1ed44f6c..6c99dbd55e7a8ee6d2978bf7ef1b31e59b326768:/src/msw/font.cpp diff --git a/src/msw/font.cpp b/src/msw/font.cpp index ac1a4d3cce..832ce661a8 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -213,8 +213,7 @@ public: WXHFONT GetHFONT() const { - if ( !m_hFont ) - const_cast(this)->Alloc(); + AllocIfNeeded(); return (WXHFONT)m_hFont; } @@ -289,7 +288,18 @@ public: } const wxNativeFontInfo& GetNativeFontInfo() const - { return m_nativeFontInfo; } + { + // we need to create the font now to get the corresponding LOGFONT if + // it hadn't been done yet + AllocIfNeeded(); + + // ensure that we have a valid face name in our font information: + // GetFaceName() will try to retrieve it from our HFONT and save it if + // it was successful + (void)GetFaceName(); + + return m_nativeFontInfo; + } void SetNativeFontInfo(const wxNativeFontInfo& nativeFontInfo) { @@ -312,6 +322,12 @@ protected: void Init(const wxNativeFontInfo& info, WXHFONT hFont = 0); + void AllocIfNeeded() const + { + if ( !m_hFont ) + const_cast(this)->Alloc(); + } + // retrieve the face name really being used by the font: this is used to // get the face name selected by the system when we don't specify it (but // use just the family for example) @@ -1048,24 +1064,6 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const return IsOk() ? &(M_FONTDATA->GetNativeFontInfo()) : NULL; } -wxString wxFont::GetNativeFontInfoDesc() const -{ - wxCHECK_MSG( IsOk(), wxEmptyString, wxT("invalid font") ); - - // be sure we have an HFONT associated... - const_cast(this)->RealizeResource(); - return wxFontBase::GetNativeFontInfoDesc(); -} - -wxString wxFont::GetNativeFontInfoUserDesc() const -{ - wxCHECK_MSG( IsOk(), wxEmptyString, wxT("invalid font") ); - - // be sure we have an HFONT associated... - const_cast(this)->RealizeResource(); - return wxFontBase::GetNativeFontInfoUserDesc(); -} - bool wxFont::IsFixedWidth() const { wxCHECK_MSG( IsOk(), false, wxT("invalid font") );