X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ff42758536f8d573409bf6c35528497ba36b4d0e..1fd850ab550a30bc600d5a10c5aed5386bf3624b:/src/msw/fontenum.cpp diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index cf3623766b..7ebc115010 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -26,17 +26,17 @@ #if wxUSE_FONTENUM +#include "wx/fontenum.h" + #ifndef WX_PRECOMP #include "wx/gdicmn.h" #include "wx/font.h" - #include "wx/encinfo.h" #include "wx/dynarray.h" + #include "wx/msw/private.h" #endif -#include "wx/msw/private.h" - +#include "wx/encinfo.h" #include "wx/fontutil.h" -#include "wx/fontenum.h" #include "wx/fontmap.h" // ---------------------------------------------------------------------------- @@ -90,7 +90,7 @@ private: // the list of facenames we already found while enumerating facenames wxArrayString m_facenames; - DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper) + wxDECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper); }; // ---------------------------------------------------------------------------- @@ -99,7 +99,7 @@ private: #ifndef __WXMICROWIN__ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, - DWORD dwStyle, LONG lParam); + DWORD dwStyle, LPARAM lParam); #endif // ============================================================================ @@ -160,13 +160,13 @@ void wxFontEnumeratorHelper::DoEnumerate() #ifdef __WXWINCE__ ::EnumFontFamilies(hDC, - m_facename.empty() ? NULL : m_facename.c_str(), + m_facename.empty() ? NULL : wxMSW_CONV_LPCTSTR(m_facename), (wxFONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this) ; #else // __WIN32__ LOGFONT lf; lf.lfCharSet = (BYTE)m_charset; - wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName)); + wxStrlcpy(lf.lfFaceName, m_facename.c_str(), WXSIZEOF(lf.lfFaceName)); lf.lfPitchAndFamily = 0; ::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc, (LPARAM)this, 0 /* reserved */) ; @@ -187,9 +187,18 @@ bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf, { wxConstCast(this, wxFontEnumeratorHelper)->m_charsets.Add(cs); +#if wxUSE_FONTMAP wxFontEncoding enc = wxGetFontEncFromCharSet(cs); return m_fontEnum->OnFontEncoding(lf->lfFaceName, wxFontMapper::GetEncodingName(enc)); +#else // !wxUSE_FONTMAP + // Just use some unique and, hopefully, understandable, name. + return m_fontEnum->OnFontEncoding + ( + lf->lfFaceName, + wxString::Format(wxS("Code page %d"), cs) + ); +#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP } else { @@ -269,7 +278,7 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family) #ifndef __WXMICROWIN__ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm, - DWORD WXUNUSED(dwStyle), LONG lParam) + DWORD WXUNUSED(dwStyle), LPARAM lParam) { // we used to process TrueType fonts only, but there doesn't seem to be any