]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontcmn.cpp
Add another test for the insertion point position after SetValue().
[wxWidgets.git] / src / common / fontcmn.cpp
index a59e671c5bea2d98a1e7dcbad80275fd7b563822..27154e9953bb4354188639921f12e658568366cb 100644 (file)
@@ -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" );