]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied #10639 (Not all previewed fonts are displayed with the correct nameface)
authorJulian Smart <julian@anthemion.co.uk>
Thu, 24 Sep 2009 07:35:48 +0000 (07:35 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 24 Sep 2009 07:35:48 +0000 (07:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextfontpage.cpp

index 91c7bdec270f8ddecc3ddf2c65a3467c17c3158a..a832f040e8030e43d48104bc33fe70b9f0b408fc 100644 (file)
@@ -572,7 +572,7 @@ wxTextAttr* wxRichTextFontPage::GetAttributes()
 /// Updates the font preview
 void wxRichTextFontPage::UpdatePreview()
 {
-    wxFont font(*wxNORMAL_FONT);
+    wxTextAttr attr;
 
     if (m_colourPresent)
         m_previewCtrl->SetForegroundColour(m_colourCtrl->GetBackgroundColour());
@@ -583,7 +583,7 @@ void wxRichTextFontPage::UpdatePreview()
     if (m_faceListBox->GetSelection() != wxNOT_FOUND)
     {
         wxString faceName = m_faceListBox->GetFaceName(m_faceListBox->GetSelection());
-        font.SetFaceName(faceName);
+        attr.SetFontFaceName(faceName);
     }
 
     wxString strSize = m_sizeTextCtrl->GetValue();
@@ -591,29 +591,29 @@ void wxRichTextFontPage::UpdatePreview()
     {
         int sz = wxAtoi(strSize);
         if (sz > 0)
-            font.SetPointSize(sz);
+            attr.SetFontSize(sz);
     }
 
     if (m_styleCtrl->GetSelection() != wxNOT_FOUND)
     {
-        int style;
+        wxFontStyle style;
         if (m_styleCtrl->GetStringSelection() == _("Italic"))
-            style = wxITALIC;
+            style = wxFONTSTYLE_ITALIC;
         else
-            style = wxNORMAL;
+            style = wxFONTSTYLE_NORMAL;
 
-        font.SetStyle(style);
+        attr.SetFontStyle(style);
     }
 
     if (m_weightCtrl->GetSelection() != wxNOT_FOUND)
     {
-        int weight;
+        wxFontWeight weight;
         if (m_weightCtrl->GetStringSelection() == _("Bold"))
-            weight = wxBOLD;
+            weight = wxFONTWEIGHT_BOLD;
         else
-            weight = wxNORMAL;
+            weight = wxFONTWEIGHT_NORMAL;
 
-        font.SetWeight(weight);
+        attr.SetFontWeight(weight);
     }
 
     if (m_underliningCtrl->GetSelection() != wxNOT_FOUND)
@@ -624,7 +624,7 @@ void wxRichTextFontPage::UpdatePreview()
         else
             underlined = false;
 
-        font.SetUnderlined(underlined);
+        attr.SetFontUnderlined(underlined);
     }
 
     int textEffects = 0;
@@ -644,6 +644,7 @@ void wxRichTextFontPage::UpdatePreview()
     else if ( m_subscriptCtrl->Get3StateValue() == wxCHK_CHECKED )
         textEffects |= wxTEXT_ATTR_EFFECT_SUBSCRIPT;
 
+    wxFont font = attr.GetFont();
     m_previewCtrl->SetFont(font);
     m_previewCtrl->SetTextEffects(textEffects);
     m_previewCtrl->Refresh();