e712f1c
From a19e512e80acdb2a777c3e44923ad0b1178db35a Mon Sep 17 00:00:00 2001
e712f1c
From: Scott Talbert <swt@techie.net>
e712f1c
Date: Sun, 7 Aug 2016 23:15:41 -0400
e712f1c
Subject: [PATCH] Fix the stop function of wxFontEnumerator for wxGTK
e712f1c
e712f1c
In a wxFontEnumerator, if false is returned from OnFacename() or
e712f1c
OnFontEncoding(), the enumeration is supposed to stop.  This was not happening
e712f1c
on wxGTK.
e712f1c
e712f1c
See https://github.com/wxWidgets/wxWidgets/pull/311
e712f1c
e712f1c
(cherry picked from commit 3572c2c6548bca2dbd439a3d25ed403fda99ebe9)
e712f1c
---
e712f1c
 src/common/fontenumcmn.cpp | 3 ++-
e712f1c
 src/unix/fontenum.cpp      | 5 ++++-
e712f1c
 2 files changed, 6 insertions(+), 2 deletions(-)
e712f1c
e712f1c
diff --git a/src/common/fontenumcmn.cpp b/src/common/fontenumcmn.cpp
e712f1c
index 1185a86..f0d6f68 100644
e712f1c
--- a/src/common/fontenumcmn.cpp
e712f1c
+++ b/src/common/fontenumcmn.cpp
e712f1c
@@ -124,7 +124,8 @@ bool wxFontEnumerator::EnumerateEncodingsUTF8(const wxString& facename)
e712f1c
 
e712f1c
     for ( size_t n = 0; n < count; n++ )
e712f1c
     {
e712f1c
-        OnFontEncoding(facenames[n], utf8);
e712f1c
+        if ( !OnFontEncoding(facenames[n], utf8) )
e712f1c
+            break;
e712f1c
     }
e712f1c
 
e712f1c
     return true;
e712f1c
diff --git a/src/unix/fontenum.cpp b/src/unix/fontenum.cpp
e712f1c
index cc7ee1d..e3739ed 100644
e712f1c
--- a/src/unix/fontenum.cpp
e712f1c
+++ b/src/unix/fontenum.cpp
e712f1c
@@ -89,7 +89,10 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
e712f1c
 #endif
e712f1c
         {
e712f1c
             const gchar *name = pango_font_family_get_name(families[i]);
e712f1c
-            OnFacename(wxString(name, wxConvUTF8));
e712f1c
+            if ( !OnFacename(wxString(name, wxConvUTF8)) )
e712f1c
+            {
e712f1c
+                break;
e712f1c
+            }
e712f1c
         }
e712f1c
     }
e712f1c
     g_free(families);