Fix wxMSW wxFontEnumerator::EnumerateEncodings() parameter handling.

This parameter is a face name, not a family name, and should be handled as
such, it was totally broken before due to a lot of confusion between face
names and family names in the code.

Closes #4715.
This commit is contained in:
Vadim Zeitlin
2015-07-17 16:10:20 +02:00
parent b6fa548d80
commit f691e7e28d

View File

@@ -51,12 +51,12 @@ public:
wxFontEnumeratorHelper(wxFontEnumerator *fontEnum);
// control what exactly are we enumerating
// we enumerate fonts with given enocding
// we enumerate fonts with the given encoding
bool SetEncoding(wxFontEncoding encoding);
// we enumerate fixed-width fonts
void SetFixedOnly(bool fixedOnly) { m_fixedOnly = fixedOnly; }
// we enumerate the encodings available in this family
void SetFamily(const wxString& family);
// we enumerate the encodings this font face is available in
void SetFaceName(const wxString& facename);
// call to start enumeration
void DoEnumerate();
@@ -74,9 +74,6 @@ private:
// if not empty, enum only the fonts with this facename
wxString m_facename;
// if not empty, enum only the fonts in this family
wxString m_family;
// if true, enum only fixed fonts
bool m_fixedOnly;
@@ -117,10 +114,10 @@ wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum)
m_enumEncodings = false;
}
void wxFontEnumeratorHelper::SetFamily(const wxString& family)
void wxFontEnumeratorHelper::SetFaceName(const wxString& facename)
{
m_enumEncodings = true;
m_family = family;
m_facename = facename;
}
bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
@@ -256,10 +253,10 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
return true;
}
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
bool wxFontEnumerator::EnumerateEncodings(const wxString& facename)
{
wxFontEnumeratorHelper fe(this);
fe.SetFamily(family);
fe.SetFaceName(facename);
fe.DoEnumerate();
return true;