Make use of default_font_file().
authorCarl Hetherington <cth@carlh.net>
Tue, 29 Sep 2020 20:06:36 +0000 (22:06 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 12 Oct 2020 15:33:27 +0000 (17:33 +0200)
src/lib/render_text.cc

index f0866267866f68dbe318d02e9d28dca27b9a376c..f9c04dc4dc09b7678b65596a5a04b473b75f0869 100644 (file)
@@ -25,6 +25,7 @@
 #include "font.h"
 #include "dcpomatic_assert.h"
 #include "warnings.h"
+#include "util.h"
 #include <dcp/raw_convert.h>
 #include <fontconfig/fontconfig.h>
 #include <cairomm/cairomm.h>
@@ -139,19 +140,7 @@ setup_font (StringText const& subtitle, list<shared_ptr<Font> > const& fonts)
                fc_config = FcInitLoadConfig ();
        }
 
-       optional<boost::filesystem::path> font_file;
-
-       try {
-               font_file = resources_path() / "LiberationSans-Regular.ttf";
-       } catch (boost::filesystem::filesystem_error& e) {
-
-       }
-
-       /* Hack: try the debian/ubuntu locations if getting the shared path failed */
-
-       if (!font_file || !boost::filesystem::exists(*font_file)) {
-               font_file = "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf";
-       }
+       optional<boost::filesystem::path> font_file = default_font_file ();
 
        BOOST_FOREACH (shared_ptr<Font> i, fonts) {
                if (i->id() == subtitle.font() && i->file()) {