Index: src/subtitles_provider_libass.cpp
===================================================================
--- src/subtitles_provider_libass.cpp	(revision 3905)
+++ src/subtitles_provider_libass.cpp	(working copy)
@@ -46,6 +46,10 @@
 #include "utils.h"
 #include "standard_paths.h"
 #include <wx/filefn.h>
+#include <wx/thread.h>
+#include <wx/dialog.h>
+#include <wx/gauge.h>
+#include <wx/utils.h>
 
 #ifdef __APPLE__
 extern "C" {
@@ -54,8 +58,81 @@
 }
 #endif
 
-#define STUB_MSG _("Please wait, caching fonts...");
 
+
+DEFINE_EVENT_TYPE(AEGISUB_LIBASS_FONTUPDATE_FINISH)
+
+class AegisubLibassFontupdateFinishEvent : public wxEvent {
+public:
+	AegisubLibassFontupdateFinishEvent()
+		: wxEvent(0, AEGISUB_LIBASS_FONTUPDATE_FINISH)
+	{ }
+	virtual wxEvent *Clone() const {
+		return new AegisubLibassFontupdateFinishEvent(*this);
+	}
+};
+
+class LibassFontUpdateThread : public wxThread {
+	wxEvtHandler &completion_event_handler;
+
+public:
+	LibassFontUpdateThread(wxEvtHandler &completion_event_handler)
+		: wxThread(wxTHREAD_DETACHED)
+		, completion_event_handler(completion_event_handler)
+	{
+		Create();
+		Run();
+	}
+
+	ExitCode Entry() {
+		ass_fonts_update();
+		completeion_event_handler->AddPendingEvent(AegisubLibassFontupdateFinishEvent());
+	}
+};
+
+
+class LibassFontUpdateStatusDialog : public wxDialog, wxTimer {
+	void Notify() {
+		Show();
+	}
+
+	bool font_update_running;
+
+	void OnDoneUpdating(AegisubLibassFontupdateFinishEvent &evt) {
+		font_update_running = false;
+	}
+
+public:
+	LibassFontUpdateStatusDialog()
+		: wxDialog(0, -1, _T(""), wxDefaultPos, wxDefaultSize, 0)
+		, wxTimer()
+	{
+		font_update_running = true;
+		
+		wxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
+
+		main_sizer->Add(new wxStaticText(this, -1, _("Please wait, caching fonts...")), 0, wxEXPAND|wxALL, 12);
+
+		wxGauge *gauge = new wxGauge(this, -1, 1, wxDefaultPosition, wxSize(350, -1));
+		gauge->Pulse();
+		main_sizer->Add(gauge, 0, wxEXPAND|wxALL&~wxTOP, 12);
+
+		SetSizerAndFit(main_sizer);
+		Centre();
+
+		Start(2000, true);
+	}
+
+	void WaitForFontUpdateCompletion() {
+		while (app.Pending() || font_update_running)
+		{
+			Dispatch();
+		}
+		Destroy();
+	}
+};
+
+
 ///////////////
 // Constructor
 LibassSubtitlesProvider::LibassSubtitlesProvider() {
@@ -93,7 +170,12 @@
 	const char *config_path = NULL;
 #endif
 
-	ass_set_fonts(ass_renderer, NULL, "Sans", 1, config_path, 1);
+	ass_set_fonts(ass_renderer, NULL, "Sans", 1, config_path, 0);
+
+	LibassFontUpdateStatusDialog *fonts_update_dlg = new LibassFontUpdateStatusDialog;
+	new LibassFontUpdateThread(fonts_update_dlg);
+	wxWindowDisabler win_disabler(fonts_update_dlg);
+	fonts_update_dlg->WaitForFontUpdateCompletion();
 }
 
 

