+ fontEnumerator.EnumerateFacenames(encoding, fixedWidthOnly);
+
+ if ( fontEnumerator.GotAny() )
+ {
+ int nFacenames = fontEnumerator.GetFacenames().GetCount();
+ if ( !silent )
+ {
+ wxLogStatus(this, "Found %d %sfonts",
+ nFacenames, fixedWidthOnly ? "fixed width " : "");
+ }
+
+ wxString facename;
+ if ( silent )
+ {
+ // 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 )
+ facename = facenames[n];
+
+ delete [] facenames;
+ }
+
+ if ( !facename.IsEmpty() )
+ {
+ wxFont font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
+ wxFONTWEIGHT_NORMAL, FALSE, facename, encoding);
+
+ DoChangeFont(font);
+ }
+
+ return TRUE;
+ }
+ else if ( !silent )
+ {
+ wxLogWarning("No such fonts found.");
+ }
+
+ return FALSE;
+}
+
+void MyFrame::OnEnumerateFamiliesForEncoding(wxCommandEvent& WXUNUSED(event))
+{
+ static wxFontEncoding encodings[] =
+ {
+ wxFONTENCODING_ISO8859_1,
+ wxFONTENCODING_ISO8859_2,
+ wxFONTENCODING_ISO8859_5,
+ wxFONTENCODING_ISO8859_7,
+ wxFONTENCODING_ISO8859_15,
+ wxFONTENCODING_KOI8,
+ wxFONTENCODING_CP1250,
+ wxFONTENCODING_CP1251,
+ wxFONTENCODING_CP1252,
+ };
+
+ static const char *encodingNames[] =
+ {
+ "West European (Latin 1)",
+ "Central European (Latin 2)",
+ "Cyrillic (Latin 5)",
+ "Greek (Latin 7)",
+ "West European new (Latin 0)",
+ "KOI8-R",
+ "Windows Latin 2",
+ "Windows Cyrillic",
+ "Windows Latin 1",
+ };
+
+ int n = wxGetSingleChoiceIndex("Choose an encoding", "Font demo",
+ WXSIZEOF(encodingNames),
+ (char **)encodingNames,
+ this);
+
+ if ( n != -1 )
+ {
+ DoEnumerateFamilies(FALSE, encodings[n]);
+ }