X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/85ab460e7d62b52b105b3dc0bbdd36cebc14fb4b..23318a5358be74727fb62854f623da84a4545bcd:/src/common/fontenumcmn.cpp diff --git a/src/common/fontenumcmn.cpp b/src/common/fontenumcmn.cpp index fb57dd9104..aaae1543c4 100644 --- a/src/common/fontenumcmn.cpp +++ b/src/common/fontenumcmn.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_FONTENUM + #include "wx/fontenum.h" // ============================================================================ @@ -100,3 +102,34 @@ bool wxFontEnumerator::IsValidFacename(const wxString &facename) return true; } +#ifdef wxHAS_UTF8_FONTS +bool wxFontEnumerator::EnumerateEncodingsUTF8(const wxString& facename) +{ + // name of UTF-8 encoding: no need to use wxFontMapper for it as it's + // unlikely to change + const wxString utf8(_T("UTF-8")); + + // all fonts are in UTF-8 only if this code is used + if ( !facename.empty() ) + { + OnFontEncoding(facename, utf8); + return true; + } + + // so enumerating all facenames supporting this encoding is the same as + // enumerating all facenames + const wxArrayString facenames(GetFacenames(wxFONTENCODING_UTF8)); + const size_t count = facenames.size(); + if ( !count ) + return false; + + for ( size_t n = 0; n < count; n++ ) + { + OnFontEncoding(facenames[n], utf8); + } + + return true; +} +#endif // wxHAS_UTF8_FONTS + +#endif // wxUSE_FONTENUM