summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-08-25 21:58:48 +0200
committerCarl Hetherington <cth@carlh.net>2020-08-25 21:58:48 +0200
commit8475d7b7d70d5b98e7737f326653d80a9fd8e9cf (patch)
tree2a3eccbe46591d2bde7ff607890e5de5225d4a9f /src/lib/util.cc
parent75f6cc0fa8bcff9b98a31200e313d8895cfaa3f8 (diff)
Move the code to find Liberation into util.cc.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 7ba9242fa..84138f4d9 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -1253,3 +1253,24 @@ decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm)
}
}
+
+boost::filesystem::path
+default_font_file ()
+{
+ boost::filesystem::path liberation_normal;
+ try {
+ liberation_normal = shared_path() / "LiberationSans-Regular.ttf";
+ if (!boost::filesystem::exists (liberation_normal)) {
+ /* Hack for unit tests */
+ liberation_normal = shared_path() / "fonts" / "LiberationSans-Regular.ttf";
+ }
+ } catch (boost::filesystem::filesystem_error& e) {
+
+ }
+
+ if (!boost::filesystem::exists(liberation_normal)) {
+ liberation_normal = "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf";
+ }
+
+ return liberation_normal;
+}