You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wxGTK3/wxGTK3-3.0.2-font-enumerato...

48 lines
1.6 KiB

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