speed up font list processing
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11072 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
|
#include "wx/regex.h"
|
||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
|
|
||||||
@@ -95,12 +96,20 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This,
|
|||||||
char **fonts,
|
char **fonts,
|
||||||
int nFonts)
|
int nFonts)
|
||||||
{
|
{
|
||||||
|
#if wxUSE_REGEX
|
||||||
|
wxRegEx re(wxT("^(-[^-]*){14}$"), wxRE_NOSUB);
|
||||||
|
#endif // wxUSE_REGEX
|
||||||
|
|
||||||
// extract the list of (unique) font families
|
// extract the list of (unique) font families
|
||||||
wxSortedArrayString families;
|
wxSortedArrayString families;
|
||||||
for ( int n = 0; n < nFonts; n++ )
|
for ( int n = 0; n < nFonts; n++ )
|
||||||
{
|
{
|
||||||
char *font = fonts[n];
|
char *font = fonts[n];
|
||||||
|
#if wxUSE_REGEX
|
||||||
|
if ( re.Matches(font) )
|
||||||
|
#else // !wxUSE_REGEX
|
||||||
if ( !wxString(font).Matches(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-*-*")) )
|
if ( !wxString(font).Matches(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-*-*")) )
|
||||||
|
#endif // wxUSE_REGEX/!wxUSE_REGEX
|
||||||
{
|
{
|
||||||
// it's not a full font name (probably an alias)
|
// it's not a full font name (probably an alias)
|
||||||
continue;
|
continue;
|
||||||
|
Reference in New Issue
Block a user