From ea9144a3bcebbc04fbf2174b1ec9e31f92784c44 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 8 Nov 1999 15:56:41 +0000 Subject: [PATCH] minor aesthetic fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/font/font.cpp | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/samples/font/font.cpp b/samples/font/font.cpp index 0a7c1372b8..56e5a565b6 100644 --- a/samples/font/font.cpp +++ b/samples/font/font.cpp @@ -296,29 +296,44 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly, if ( fontEnumerator.GotAny() ) { - int n, nFacenames = fontEnumerator.GetFacenames().GetCount(); - wxLogStatus(this, "Found %d %sfonts", - nFacenames, fixedWidthOnly ? "fixed width " : ""); - - wxString *facenames = new wxString[nFacenames]; - for ( n = 0; n < nFacenames; n++ ) - facenames[n] = fontEnumerator.GetFacenames().Item(n); + int nFacenames = fontEnumerator.GetFacenames().GetCount(); + if ( !silent ) + { + wxLogStatus(this, "Found %d %sfonts", + nFacenames, fixedWidthOnly ? "fixed width " : ""); + } + wxString facename; if ( silent ) - n = 0; + { + // choose the first + facename = fontEnumerator.GetFacenames().Item(0); + } else + { + // let the user choose + wxString *facenames = new wxString[nFacenames]; + int n; + for ( n = 0; n < nFacenames; n++ ) + facenames[n] = fontEnumerator.GetFacenames().Item(n); + n = wxGetSingleChoiceIndex("Choose a facename", "Font demo", nFacenames, facenames, this); - if ( n != -1 ) + + if ( n != -1 ) + facename = facenames[n]; + + delete [] facenames; + } + + if ( !facename.IsEmpty() ) { - wxFont font(14, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, - wxFONTWEIGHT_NORMAL, FALSE, facenames[n], encoding); + wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, + wxFONTWEIGHT_NORMAL, FALSE, facename, encoding); DoChangeFont(font); } - delete [] facenames; - return TRUE; } else if ( !silent ) @@ -477,7 +492,7 @@ void MyFrame::OnViewMsg(wxCommandEvent& WXUNUSED(event)) // and now create the correct font if ( !DoEnumerateFamilies(FALSE, fontenc, TRUE /* silent */) ) { - wxFont font(14, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, + wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, FALSE /* !underlined */, wxEmptyString /* facename */, fontenc); if ( font.Ok() ) -- 2.47.2