- wxString dir = _T(wxINSTALL_PREFIX "/share/wx/fonts");
- wxGetEnv(_T("WXDFB_FONTDIR"), &dir);
+ wxString path;
+ if ( !wxGetEnv(_T("WXDFB_FONTPATH"), &path) )
+ path = _T(wxINSTALL_PREFIX "/share/wx/fonts");
+
+ wxStringTokenizer tkn(path, wxPATH_SEP);
+ while ( tkn.HasMoreTokens() )
+ {
+ wxString dir = tkn.GetNextToken();
+
+ wxArrayString indexFiles;
+ if ( !wxDir::GetAllFiles(dir, &indexFiles, _T("FontsIndex")) )
+ continue;
+
+ for ( wxArrayString::const_iterator i = indexFiles.begin();
+ i != indexFiles.end(); ++i )
+ {
+ AddFontsFromDir(*i);
+ }
+ }
+
+ if ( GetBundles().empty() )
+ {
+ // wxDFB is unusable without fonts, so terminate the app
+ wxLogFatalError(_("No fonts found in %s."), path.c_str());
+ }
+}