]> git.saurik.com Git - wxWidgets.git/commitdiff
minor aesthetic fixes
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Nov 1999 15:56:41 +0000 (15:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Nov 1999 15:56:41 +0000 (15:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/font/font.cpp

index 0a7c1372b86a66ab1136baa70af63d23f99af7ea..56e5a565b671e32aa2e731f68a7daf832723ae11 100644 (file)
@@ -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() )