Use only wxFont ctor from wxFontInfo in the samples
Follow the documentation advice and prefer to use the ctor taking wxFontInfo as it makes the code slightly shorter and more readable.
This commit is contained in:
@@ -337,8 +337,7 @@ void MyCanvas::CreateCaret()
|
||||
|
||||
void MyCanvas::SetFontSize(int fontSize)
|
||||
{
|
||||
m_font = wxFont(fontSize, wxFONTFAMILY_TELETYPE,
|
||||
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||
m_font = wxFont(wxFontInfo(fontSize).Family(wxFONTFAMILY_TELETYPE));
|
||||
|
||||
wxClientDC dc(this);
|
||||
dc.SetFont(m_font);
|
||||
|
@@ -1072,7 +1072,7 @@ void MyCanvas::DrawAlpha(wxDC& dc)
|
||||
|
||||
dc.SetTextBackground( wxColour(160, 192, 160, 160) );
|
||||
dc.SetTextForeground( wxColour(255, 128, 128, 128) );
|
||||
dc.SetFont( wxFont( 40, wxFONTFAMILY_SWISS, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_NORMAL ) );
|
||||
dc.SetFont( wxFontInfo(40).Family(wxFONTFAMILY_SWISS).Italic() );
|
||||
dc.DrawText( wxT("Hello!"), 120, 80 );
|
||||
}
|
||||
#endif // wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT
|
||||
|
@@ -522,8 +522,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
|
||||
// create the listbox in which we will show misc messages as they come
|
||||
m_lbox = new wxListBox(this, wxID_ANY);
|
||||
wxFont font(12, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL,
|
||||
wxFONTWEIGHT_NORMAL);
|
||||
wxFont font(wxFontInfo(12).Family(wxFONTFAMILY_TELETYPE));
|
||||
if ( font.IsOk() )
|
||||
m_lbox->SetFont(font);
|
||||
|
||||
|
@@ -244,8 +244,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL);
|
||||
|
||||
// set monospace font to have output in nice columns
|
||||
wxFont font(9, wxFONTFAMILY_TELETYPE,
|
||||
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||
wxFont font(wxFontInfo(9).Family(wxFONTFAMILY_TELETYPE));
|
||||
headerText->SetFont(font);
|
||||
m_evtConsole->SetFont(font);
|
||||
|
||||
|
@@ -206,8 +206,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH|wxHSCROLL);
|
||||
|
||||
// set monospace font to have output in nice columns
|
||||
wxFont font(10, wxFONTFAMILY_TELETYPE,
|
||||
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||
wxFont font(wxFontInfo(10).Family(wxFONTFAMILY_TELETYPE));
|
||||
headerText->SetFont(font);
|
||||
m_logText->SetFont(font);
|
||||
|
||||
|
@@ -489,7 +489,7 @@ bool MyGLCanvas::oglInit()
|
||||
int swi = 0, shi = 0; //Image sizes
|
||||
wxString stg("wxWidgets");
|
||||
// Set the font. Use a big pointsize so as to smoothing edges.
|
||||
wxFont font(48, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||
wxFont font(wxFontInfo(48).Family(wxFONTFAMILY_MODERN));
|
||||
if ( !font.IsOk() )
|
||||
font = *wxSWISS_FONT;
|
||||
wxColour bgrdColo(*wxBLACK);
|
||||
|
@@ -387,7 +387,7 @@ MyFrame::MyFrame()
|
||||
sizer_panelsizer_h->Add(sizer_panelsizer_v, 0);
|
||||
sizer_panel->SetSizer(sizer_panelsizer_h);
|
||||
|
||||
wxFont label_font(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT);
|
||||
wxFont label_font(wxFontInfo(8).Light());
|
||||
m_bitmap_creation_dc.SetFont(label_font);
|
||||
|
||||
wxRibbonPage* scheme = new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Appearance"), eye_xpm);
|
||||
|
@@ -248,7 +248,7 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
text->SetBackgroundColour(*wxWHITE);
|
||||
text->SetForegroundColour(*wxBLACK);
|
||||
wxFont font = text->GetFont();
|
||||
font.SetPointSize(2*font.GetPointSize()/3);
|
||||
font.SetFractionalPointSize(2.0*font.GetFractionalPointSize()/3.0);
|
||||
text->SetFont(font);
|
||||
#endif
|
||||
}
|
||||
|
@@ -402,8 +402,7 @@ MyFrame::MyFrame(const wxString& title)
|
||||
wxLog::SetActiveTarget(this);
|
||||
|
||||
// use fixed width font to align output in nice columns
|
||||
wxFont font(wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_TELETYPE,
|
||||
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||
wxFont font(wxFontInfo().Family(wxFONTFAMILY_TELETYPE));
|
||||
header->SetFont(font);
|
||||
m_txtctrl->SetFont(font);
|
||||
|
||||
|
Reference in New Issue
Block a user