Make the libass fonts_dir something sensible so it doesn't search the entire homedir (or whereever) through for fonts on init, causing huge delays.

(?user/libass_fonts/ is used now, it's created if it doesn't exist.)

Originally committed to SVN as r2468.
This commit is contained in:
Niels Martin Hansen 2008-11-20 22:08:34 +00:00
parent 95bccb4e1e
commit e924197c48
1 changed files with 9 additions and 2 deletions

View File

@ -42,6 +42,8 @@
#include "ass_file.h"
#include "video_context.h"
#include "utils.h"
#include "standard_paths.h"
#include <wx/filefn.h>
///////////////
@ -52,8 +54,13 @@ LibassSubtitlesProvider::LibassSubtitlesProvider() {
if (first) {
ass_library = ass_library_init();
if (!ass_library) throw _T("ass_library_init failed");
ass_set_fonts_dir(ass_library, "");
wxString fonts_dir = StandardPaths::DecodePath(_T("?user/libass_fonts/"));
if (!wxDirExists(fonts_dir))
// It's only one level below the user dir, and we assume the user dir already exists at this point.
wxMkdir(fonts_dir);
ass_set_fonts_dir(ass_library, fonts_dir.mb_str(wxConvFile));
ass_set_extract_fonts(ass_library, 0);
ass_set_style_overrides(ass_library, NULL);
first = false;