- int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST familyChoice->GetStringSelection());
- int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST weightChoice->GetStringSelection());
- int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST styleChoice->GetStringSelection());
- int fontSize = wxAtoi(pointSizeChoice->GetStringSelection());
- int fontUnderline = underLineCheckBox->GetValue();
+ int fontFamily = wxFontFamilyStringToInt(WXSTRINGCAST m_familyChoice->GetStringSelection());
+ int fontWeight = wxFontWeightStringToInt(WXSTRINGCAST m_weightChoice->GetStringSelection());
+ int fontStyle = wxFontStyleStringToInt(WXSTRINGCAST m_styleChoice->GetStringSelection());
+#if USE_SPINCTRL_FOR_POINT_SIZE
+ wxSpinCtrl* fontSizeCtrl = wxDynamicCast(FindWindow(wxID_FONT_SIZE), wxSpinCtrl);
+ int fontSize = fontSizeCtrl->GetValue();
+#else
+ int fontSize = wxAtoi(m_pointSizeChoice->GetStringSelection());
+#endif
+
+ // Start with previous underline setting, we want to retain it even if we can't edit it
+ // m_dialogFont is always initialized because of the call to InitializeFont
+ int fontUnderline = m_dialogFont.GetUnderlined();
+
+ if (m_underLineCheckBox)
+ {
+ fontUnderline = m_underLineCheckBox->GetValue();
+ }
+
+ m_dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
+ m_previewer->SetFont(m_dialogFont);