X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/85ab460e7d62b52b105b3dc0bbdd36cebc14fb4b..7dd6983e0bc7dc7d75b0a86e09da72e9c621e221:/src/common/fontenumcmn.cpp diff --git a/src/common/fontenumcmn.cpp b/src/common/fontenumcmn.cpp index fb57dd9104..1185a864ab 100644 --- a/src/common/fontenumcmn.cpp +++ b/src/common/fontenumcmn.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 7/5/2006 -// RCS-ID: $Id$ // Copyright: (c) 1999-2003 Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,6 +23,8 @@ #pragma hdrstop #endif +#if wxUSE_FONTENUM + #include "wx/fontenum.h" // ============================================================================ @@ -82,12 +83,12 @@ bool wxFontEnumerator::IsValidFacename(const wxString &facename) #ifdef __WXMSW__ // Quoting the MSDN: - // "MS Shell Dlg is a mapping mechanism that enables - // U.S. English Microsoft Windows NT, and Microsoft Windows 2000 to - // support locales that have characters that are not contained in code + // "MS Shell Dlg is a mapping mechanism that enables + // U.S. English Microsoft Windows NT, and Microsoft Windows 2000 to + // support locales that have characters that are not contained in code // page 1252. It is not a font but a face name for a nonexistent font." // Thus we need to consider "Ms Shell Dlg" and "Ms Shell Dlg 2" as valid - // font face names even if they are enumerated by wxFontEnumerator + // font face names even if they are not enumerated by wxFontEnumerator if (facename.IsSameAs(wxT("Ms Shell Dlg"), false) || facename.IsSameAs(wxT("Ms Shell Dlg 2"), false)) return true; @@ -100,3 +101,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(wxT("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