///////////////////////////////////////////////////////////////////////////////
-// Name: msw/fontenum.cpp
+// Name: src/msw/fontenum.cpp
// Purpose: wxFontEnumerator class for Windows
// Author: Julian Smart
// Modified by: Vadim Zeitlin to add support for font encodings
// headers
// ----------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "fontenum.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#pragma hdrstop
#endif
-#if wxUSE_FONTMAP
+#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"
// ----------------------------------------------------------------------------
// the list of facenames we already found while enumerating facenames
wxArrayString m_facenames;
- DECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper)
+ wxDECLARE_NO_COPY_CLASS(wxFontEnumeratorHelper);
};
// ----------------------------------------------------------------------------
#ifndef __WXMICROWIN__
int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
- DWORD dwStyle, LONG lParam);
+ DWORD dwStyle, LPARAM lParam);
#endif
// ============================================================================
HDC hDC = ::GetDC(NULL);
#ifdef __WXWINCE__
- ::EnumFontFamilies(hDC, m_facename, (wxFONTENUMPROC)wxFontEnumeratorProc,
- (LPARAM)this) ;
+ ::EnumFontFamilies(hDC,
+ m_facename.empty() ? NULL : m_facename.wx_str(),
+ (wxFONTENUMPROC)wxFontEnumeratorProc,
+ (LPARAM)this) ;
#else // __WIN32__
LOGFONT lf;
- lf.lfCharSet = m_charset;
- wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName));
+ lf.lfCharSet = (BYTE)m_charset;
+ wxStrlcpy(lf.lfFaceName, m_facename.c_str(), WXSIZEOF(lf.lfFaceName));
lf.lfPitchAndFamily = 0;
::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this, 0 /* reserved */) ;
#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
}
#endif
-#endif // wxUSE_FONTMAP
+#endif // wxUSE_FONTENUM