small enhancement: account for SLANT==ITALIC on wxMSW; print explicitely the face name of the current font; make wxFontBase::GetFamilyString aware of wxFONTFAMILY_UNKNOWN

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60174 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi 2009-04-15 20:02:17 +00:00
parent 50b5e38d3f
commit f2c1b903bf
2 changed files with 15 additions and 2 deletions

View File

@ -324,7 +324,10 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
menuFont->AppendCheckItem(Font_Light, wxT("&Light\tCtrl-L"), wxT("Toggle light state"));
menuFont->AppendSeparator();
menuFont->AppendCheckItem(Font_Italic, wxT("&Oblique\tCtrl-O"), wxT("Toggle italic state"));
#ifndef __WXMSW__
// under wxMSW slant == italic so there's no reason to provide another menu item for the same thing
menuFont->AppendCheckItem(Font_Slant, wxT("&Slant\tCtrl-S"), wxT("Toggle slant state"));
#endif
menuFont->AppendSeparator();
menuFont->AppendCheckItem(Font_Underlined, wxT("&Underlined\tCtrl-U"),
wxT("Toggle underlined state"));
@ -820,7 +823,9 @@ void MyFrame::DoChangeFont(const wxFont& font, const wxColour& col)
mbar->Check(Font_Bold, font.GetWeight() == wxFONTWEIGHT_BOLD);
mbar->Check(Font_Italic, font.GetStyle() == wxFONTSTYLE_ITALIC);
#ifndef __WXMSW__
mbar->Check(Font_Slant, font.GetStyle() == wxFONTSTYLE_SLANT);
#endif
mbar->Check(Font_Underlined, font.GetUnderlined());
}
@ -1017,9 +1022,16 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
// output the font name/info
wxString fontInfo;
fontInfo.Printf(wxT("Font size is %d points, family: %s, encoding: %s"),
fontInfo.Printf(wxT("Face name: %s, family: %s"),
m_font.GetFaceName().c_str(),
m_font.GetFamilyString().c_str());
dc.DrawText(fontInfo, x, y);
y += hLine;
fontInfo.Printf(wxT("Size: %d points, encoding: %s"),
m_font.GetPointSize(),
m_font.GetFamilyString().c_str(),
wxFontMapper::
GetEncodingDescription(m_font.GetEncoding()).c_str());

View File

@ -375,6 +375,7 @@ wxString wxFontBase::GetFamilyString() const
case wxFONTFAMILY_SWISS: return "wxFONTFAMILY_SWISS";
case wxFONTFAMILY_MODERN: return "wxFONTFAMILY_MODERN";
case wxFONTFAMILY_TELETYPE: return "wxFONTFAMILY_TELETYPE";
case wxFONTFAMILY_UNKNOWN: return "wxFONTFAMILY_UNKNOWN";
default: return "wxFONTFAMILY_DEFAULT";
}
}