+ HDC hDC = ::GetDC(NULL);
+
+#ifdef __WIN32__
+ LOGFONT lf;
+ lf.lfCharSet = m_charset;
+ wxStrncpy(lf.lfFaceName, m_facename, WXSIZEOF(lf.lfFaceName));
+ lf.lfPitchAndFamily = 0;
+ ::EnumFontFamiliesEx(hDC, &lf, (wxFONTENUMPROC)wxFontEnumeratorProc,
+ (LPARAM)this, 0 /* reserved */) ;
+#else // Win16
+ ::EnumFonts(hDC, (LPTSTR)NULL, (FONTENUMPROC)wxFontEnumeratorProc,
+ (LPARAM) (void*) this) ;
+#endif // Win32/16
+
+ ::ReleaseDC(NULL, hDC);
+}
+
+bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf,
+ const LPTEXTMETRIC tm) const
+{
+ 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 != -1 )
+ {
+ // check that we have the right encoding
+ if ( lf->lfCharSet != m_charset )
+ {
+ return TRUE;
+ }
+ }
+
+ return m_fontEnum->OnFacename(lf->lfFaceName);
+}
+
+// ----------------------------------------------------------------------------
+// wxFontEnumerator
+// ----------------------------------------------------------------------------
+
+bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
+ bool fixedWidthOnly)
+{
+ wxFontEnumeratorHelper fe(this);
+ if ( fe.SetEncoding(encoding) )
+ {
+ fe.SetFixedOnly(fixedWidthOnly);
+
+ fe.DoEnumerate();
+ }
+ // else: no such fonts, unknown encoding
+