Hack to make font finding work on Ubuntu even when not installed.
authorCarl Hetherington <cth@carlh.net>
Wed, 26 Aug 2015 09:21:50 +0000 (10:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 26 Aug 2015 09:21:50 +0000 (10:21 +0100)
src/lib/render_subtitles.cc

index a047c8173ed75bbadbca90b0a33e72870bda1bd5..4158b747314692396de672c254e9778c8fdc3e95 100644 (file)
@@ -86,7 +86,14 @@ render_subtitle (dcp::SubtitleString const & subtitle, list<shared_ptr<Font> > f
                fc_config = FcConfigCreate ();
        }
 
-       boost::filesystem::path font_file = shared_path () / "LiberationSans-Regular.ttf";
+       boost::filesystem::path font_file;
+       try {
+               font_file = shared_path () / "LiberationSans-Regular.ttf";
+       } catch (boost::filesystem::filesystem_error& e) {
+               /* Hack: try the debian/ubuntu location if getting the shared path failed */
+               font_file = "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf";
+       }
+
        BOOST_FOREACH (shared_ptr<Font> i, fonts) {
                if (i->id() == subtitle.font() && i->file ()) {
                        font_file = i->file().get ();