Sort font names in the dialog showing them in the font sample

This makes the list of the fonts much more readable, compared to listing
them in essentially random order.

Incidentally stop using manual memory allocation to avoid giving a bad
example.
This commit is contained in:
Vadim Zeitlin 2022-05-12 16:31:40 +01:00
parent 2698dde445
commit adb8bbab4d

View File

@ -648,24 +648,22 @@ bool MyFrame::DoEnumerateFamilies(bool fixedWidthOnly,
else
{
// let the user choose
wxString *facenames = new wxString[nFacenames];
wxSortedArrayString facenames;
facenames.Alloc(nFacenames);
int n;
for ( n = 0; n < nFacenames; n++ )
facenames[n] = fontEnumerator.GetFacenames().Item(n);
facenames.Add(fontEnumerator.GetFacenames().Item(n));
n = wxGetSingleChoiceIndex
(
"Choose a facename",
GetSampleTitle(),
nFacenames,
facenames,
this
);
if ( n != -1 )
facename = facenames[n];
delete [] facenames;
}
if ( !facename.empty() )