From f1d7cbac4369e180a8d7c19f386b301196d09369 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 16 Jul 2001 15:23:04 +0000 Subject: [PATCH] speed up font list processing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11072 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/fontenum.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp index 5cd8a26981..c68984623b 100644 --- a/src/unix/fontenum.cpp +++ b/src/unix/fontenum.cpp @@ -23,6 +23,7 @@ #include "wx/defs.h" #include "wx/dynarray.h" +#include "wx/regex.h" #include "wx/string.h" #include "wx/utils.h" @@ -95,12 +96,20 @@ static bool ProcessFamiliesFromFontList(wxFontEnumerator *This, char **fonts, int nFonts) { +#if wxUSE_REGEX + wxRegEx re(wxT("^(-[^-]*){14}$"), wxRE_NOSUB); +#endif // wxUSE_REGEX + // extract the list of (unique) font families wxSortedArrayString families; for ( int n = 0; n < nFonts; n++ ) { char *font = fonts[n]; +#if wxUSE_REGEX + if ( re.Matches(font) ) +#else // !wxUSE_REGEX if ( !wxString(font).Matches(wxT("-*-*-*-*-*-*-*-*-*-*-*-*-*-*")) ) +#endif // wxUSE_REGEX/!wxUSE_REGEX { // it's not a full font name (probably an alias) continue; -- 2.45.2