+#ifndef __WXMICROWIN__
+ HDC hDC = ::GetDC(NULL);
+
+#ifdef __WXWINCE__
+ ::EnumFontFamilies(hDC, m_facename, (wxFONTENUMPROC)wxFontEnumeratorProc,
+ (LPARAM)this) ;
+#else // __WIN32__
+ LOGFONT lf;
+ lf.lfCharSet = (BYTE)m_charset;
+ wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName));
+ lf.lfPitchAndFamily = 0;
+ ::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc,
+ (LPARAM)this, 0 /* reserved */) ;
+#endif // Win32/CE
+
+ ::ReleaseDC(NULL, hDC);
+#endif
+}
+
+bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf,
+ const LPTEXTMETRIC tm) const
+{
+ if ( m_enumEncodings )
+ {
+ // is this a new charset?
+ int cs = lf->lfCharSet;
+ if ( m_charsets.Index(cs) == wxNOT_FOUND )
+ {
+ wxConstCast(this, wxFontEnumeratorHelper)->m_charsets.Add(cs);
+
+ wxFontEncoding enc = wxGetFontEncFromCharSet(cs);
+ return m_fontEnum->OnFontEncoding(lf->lfFaceName,
+ wxFontMapper::GetEncodingName(enc));
+ }
+ else
+ {
+ // continue enumeration
+ return true;
+ }
+ }
+
+ if ( m_fixedOnly )
+ {
+ // check that it's a fixed pitch font (there is *no* error here, the
+ // flag name is misleading!)
+ if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
+ {
+ // not a fixed pitch font
+ return true;
+ }
+ }
+
+ if ( m_charset != DEFAULT_CHARSET )
+ {
+ // check that we have the right encoding
+ if ( lf->lfCharSet != m_charset )
+ {
+ return true;
+ }
+ }
+ else // enumerating fonts in all charsets
+ {
+ // we can get the same facename twice or more in this case because it
+ // may exist in several charsets but we only want to return one copy of
+ // it (note that this can't happen for m_charset != DEFAULT_CHARSET)
+ if ( m_facenames.Index(lf->lfFaceName) != wxNOT_FOUND )
+ {
+ // continue enumeration
+ return true;
+ }
+
+ wxConstCast(this, wxFontEnumeratorHelper)->
+ m_facenames.Add(lf->lfFaceName);
+ }
+
+ return m_fontEnum->OnFacename(lf->lfFaceName);