+}
+
+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);
+}
+
+// ----------------------------------------------------------------------------
+// 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
+
+ return TRUE;
+}