]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fontcmn.cpp
In wxComboCtrlBase::DrawButton(), let the button background rendering changes also...
[wxWidgets.git] / src / common / fontcmn.cpp
index 2125ea97e9a203b0467ddcb2fcd4e0fefeed58f6..036066d29f703ff212bb01a280b3e3953a6ef5fc 100644 (file)
@@ -491,6 +491,29 @@ bool wxFontBase::SetFaceName(const wxString& facename)
     return true;
 }
 
+void wxFontBase::SetSymbolicSize(wxFontSymbolicSize size)
+{
+    SetSymbolicSizeRelativeTo(size, wxNORMAL_FONT->GetPointSize());
+}
+
+/* static */
+int wxFontBase::AdjustToSymbolicSize(wxFontSymbolicSize size, int base)
+{
+    // Using a fixed factor (1.2, from CSS2) is a bad idea as explained at
+    // http://www.w3.org/TR/CSS21/fonts.html#font-size-props so use the values
+    // from http://style.cleverchimp.com/font_size_intervals/altintervals.html
+    // instead.
+    static const float factors[] = { 0.60f, 0.75f, 0.89f, 1.f, 1.2f, 1.5f, 2.f };
+
+    wxCOMPILE_TIME_ASSERT
+    (
+        WXSIZEOF(factors) == wxFONTSIZE_XX_LARGE - wxFONTSIZE_XX_SMALL + 1,
+        WrongFontSizeFactorsSize
+    );
+
+    return factors[size - wxFONTSIZE_XX_SMALL]*base;
+}
+
 wxFont& wxFont::MakeBold()
 {
     SetWeight(wxFONTWEIGHT_BOLD);