Add wxFontInfo class to allow using named parameters for wxFont creation.
This helper class allows to create wxFonts using shorter and more readable code, e.g. wxFont font(12, wxFONTFLAG_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, true, "DejaVu Sans"); can now be written simply as wxFont font(wxFontInfo(12).FaceName("DejaVu Sans").Underlined()); Remove the ctor from font flags added in r70445 as it's not needed any longer now that we have this one and adding it resulted in compilation errors in the existing code which compiled with 2.8 because of ambiguities between that ctor and wxFont(int size, int family, int style, int weight. bool underlined, ...) one, e.g. wxFont(12, wxFONTFAMILY_SWISS, wxNORMAL, wxNORMAL) didn't compile any more but it does compile again now. See #9907. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -518,9 +518,7 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
|
||||
|
||||
if ( !facename.empty() )
|
||||
{
|
||||
wxFont font(wxNORMAL_FONT->GetPointSize(),
|
||||
wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
|
||||
wxFONTWEIGHT_NORMAL, false, facename, encoding);
|
||||
wxFont font(wxFontInfo().FaceName(facename).Encoding(encoding));
|
||||
|
||||
DoChangeFont(font);
|
||||
}
|
||||
@@ -978,10 +976,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event))
|
||||
// and now create the correct font
|
||||
if ( !DoEnumerateFamilies(false, fontenc, true /* silent */) )
|
||||
{
|
||||
wxFont font(wxNORMAL_FONT->GetPointSize(),
|
||||
wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
|
||||
wxFONTWEIGHT_NORMAL, false /* !underlined */,
|
||||
wxEmptyString /* facename */, fontenc);
|
||||
wxFont font(wxFontInfo(wxNORMAL_FONT->GetPointSize()).Encoding(fontenc));
|
||||
if ( font.IsOk() )
|
||||
{
|
||||
DoChangeFont(font);
|
||||
|
Reference in New Issue
Block a user