summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-07-07 00:09:09 +0200
committerCarl Hetherington <cth@carlh.net>2022-07-20 10:22:55 +0200
commit6f66251a1267ad57e9a3f72a5688511b0dba15dd (patch)
tree7ca8c41464f1345dd1c6f46f22c65b8d5f27c359
parent9726a58f44d52d235b027225ddd68c6acf83c733 (diff)
Add some logging to the system font finder.
-rw-r--r--src/lib/font_config.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/font_config.cc b/src/lib/font_config.cc
index 5c9eebb3f..40b9770c7 100644
--- a/src/lib/font_config.cc
+++ b/src/lib/font_config.cc
@@ -20,6 +20,7 @@
#include "dcpomatic_assert.h"
+#include "dcpomatic_log.h"
#include "font_config.h"
#include <fontconfig/fontconfig.h>
#include <boost/filesystem.hpp>
@@ -91,24 +92,35 @@ FontConfig::system_font_with_name(string name)
{
optional<boost::filesystem::path> path;
+ LOG_GENERAL("Searching system for font %1", name);
auto pattern = FcNameParse(reinterpret_cast<FcChar8 const*>(name.c_str()));
auto object_set = FcObjectSetBuild(FC_FILE, nullptr);
auto font_set = FcFontList(_config, pattern, object_set);
if (font_set) {
+ LOG_GENERAL("%1 candidate fonts found", font_set->nfont);
for (int i = 0; i < font_set->nfont; ++i) {
auto font = font_set->fonts[i];
FcChar8* file;
if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) {
path = boost::filesystem::path(reinterpret_cast<char*>(file));
+ LOG_GENERAL("Found %1", *path);
break;
}
}
FcFontSetDestroy(font_set);
+ } else {
+ LOG_GENERAL_NC("No candidate fonts found");
}
FcObjectSetDestroy(object_set);
FcPatternDestroy(pattern);
+ if (path) {
+ LOG_GENERAL("Searched system for font %1, found %2", name, *path);
+ } else {
+ LOG_GENERAL("Searched system for font %1; nothing found", name);
+ }
+
return path;
}