X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/64932e4105654e784d0276671f5ac28f9bdb4ee9..6f26925422c2de7938509657eb981d6f752a6249:/src/common/fontcmn.cpp diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index a59e671c5b..27154e9953 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -367,6 +367,20 @@ bool wxFontBase::operator==(const wxFont& font) const ); } +wxFontFamily wxFontBase::GetFamily() const +{ + wxCHECK_MSG( IsOk(), wxFONTFAMILY_UNKNOWN, wxS("invalid font") ); + + // Don't return wxFONTFAMILY_UNKNOWN from here because it prevents the code + // like wxFont(size, wxNORMAL_FONT->GetFamily(), ...) from working (see + // #12330). This is really just a hack but it allows to keep compatibility + // and doesn't really have any bad drawbacks so do this until someone comes + // up with a better idea. + const wxFontFamily family = DoGetFamily(); + + return family == wxFONTFAMILY_UNKNOWN ? wxFONTFAMILY_DEFAULT : family; +} + wxString wxFontBase::GetFamilyString() const { wxCHECK_MSG( IsOk(), "wxFONTFAMILY_DEFAULT", "invalid font" );