File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 39
39
#include < GL/glew.h>
40
40
41
41
#include < atomic>
42
+ #include < cstdio>
43
+ #include < filesystem>
42
44
#include < list>
43
45
#include < memory>
44
46
#include < mutex>
45
47
#include < optional>
46
48
#include < thread>
47
- #include < tuple>
49
+
50
+ namespace fs = std::filesystem;
48
51
49
52
namespace caspar { namespace core { namespace diagnostics { namespace osd {
50
53
@@ -62,11 +65,22 @@ sf::Color get_sfml_color(int color)
62
65
static_cast <sf::Uint8>(color >> 0 & 255 )};
63
66
}
64
67
65
- sf::Font & get_default_font ()
68
+ auto & get_default_font ()
66
69
{
67
70
static sf::Font DEFAULT_FONT = []() {
71
+ fs::path path{DIAG_FONT_PATH};
72
+ #ifdef __linux__
73
+ if (!fs::exists (path)) {
74
+ auto cmd = " fc-match --format=%{file} " + path.string ();
75
+ if (auto pipe = popen (cmd.data (), " r" )) {
76
+ char buf[128 ];
77
+ path.clear ();
78
+ while (fgets (buf, sizeof (buf), pipe)) path += buf;
79
+ }
80
+ }
81
+ #endif
68
82
sf::Font font;
69
- if (!font.loadFromFile (DIAG_FONT_PATH ))
83
+ if (!font.loadFromFile (path. string () ))
70
84
CASPAR_THROW_EXCEPTION (file_not_found () << msg_info (DIAG_FONT_PATH " not found" ));
71
85
return font;
72
86
}();
You can’t perform that action at this time.
0 commit comments