summaryrefslogtreecommitdiff
path: root/src/lib/string_text_file_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-06-02 12:20:41 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-07 17:01:06 +0200
commit280a456ae1da8fa648be1e9f68140f045b306e32 (patch)
tree41647ec891fd5a8cbd2bae8279f72e86fbbba687 /src/lib/string_text_file_content.cc
parent5a820bb8fae34591be5ac6d19a73461b9dab532a (diff)
Ask fontconfig to scan the system for fonts requested by text subtitle files (#2264).
Diffstat (limited to 'src/lib/string_text_file_content.cc')
-rw-r--r--src/lib/string_text_file_content.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc
index 3750b0a50..eea9362bb 100644
--- a/src/lib/string_text_file_content.cc
+++ b/src/lib/string_text_file_content.cc
@@ -19,13 +19,15 @@
*/
-#include "string_text_file_content.h"
-#include "util.h"
-#include "string_text_file.h"
#include "film.h"
#include "font.h"
+#include "font_config.h"
+#include "string_text_file.h"
+#include "string_text_file_content.h"
#include "text_content.h"
+#include "util.h"
#include <dcp/raw_convert.h>
+#include <fontconfig/fontconfig.h>
#include <libxml++/libxml++.h>
#include <iostream>
@@ -76,10 +78,12 @@ StringTextFileContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job
}
for (auto name: names) {
- /* Make a font for each family name that somebody might later
- * ask about.
- */
- only_text()->add_font(make_shared<Font>(name));
+ auto path = FontConfig::instance()->system_font_with_name(name);
+ if (path) {
+ only_text()->add_font(make_shared<Font>(name, *path));
+ } else {
+ only_text()->add_font(make_shared<Font>(name));
+ }
}
boost::mutex::scoped_lock lm (_mutex);