Better default font directories on Linux and OS X.
authorCarl Hetherington <cth@carlh.net>
Tue, 18 Aug 2015 22:59:19 +0000 (23:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 18 Aug 2015 22:59:19 +0000 (23:59 +0100)
src/wx/fonts_dialog.cc

index 9564f6b77ab53471e9009b0df49dffc060e470b0..b880c51670f07c55967a352bc7d81b12d3942de0 100644 (file)
@@ -118,7 +118,19 @@ FontsDialog::set_from_file_clicked ()
        /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
           non-Latin filenames or paths.
        */
-       wxFileDialog* d = new wxFileDialog (this, _("Choose a font file"), wxT (""), wxT (""), wxT ("*.ttf"), wxFD_CHANGE_DIR);
+       wxString default_dir = "";
+#ifdef DCPOMATIC_LINUX
+       if (boost::filesystem::exists ("/usr/share/fonts/truetype")) {
+               default_dir = "/usr/share/fonts/truetype";
+       } else {
+               default_dir = "/usr/share/fonts";
+       }
+#endif
+#ifdef DCPOMATIC_OSX
+       default_dir = "/System/Library/Fonts";
+#endif
+
+       wxFileDialog* d = new wxFileDialog (this, _("Choose a font file"), default_dir, wxT (""), wxT ("*.ttf"), wxFD_CHANGE_DIR);
        int const r = d->ShowModal ();
 
        if (r != wxID_OK) {