Skip to content

Commit 9729563

Browse files
committed
Diag font: use path relative to executable.
Fixes diag window not loading when Caspar was not started from the caspar dir (i.e.: under systemd the working dir would be /, and caspar would look for the font in / instead of the installation directory).
1 parent 14f5288 commit 9729563

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/diagnostics/osd_graph.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
#include <tbb/concurrent_unordered_map.h>
3939

40+
#include <boost/dll.hpp>
41+
4042
#include <GL/glew.h>
4143

4244
#include <atomic>
@@ -65,8 +67,9 @@ sf::Font& get_default_font()
6567
{
6668
static sf::Font DEFAULT_FONT = []() {
6769
sf::Font font;
68-
if (!font.loadFromFile("LiberationMono-Regular.ttf"))
69-
CASPAR_THROW_EXCEPTION(file_not_found() << msg_info("LiberationMono-Regular.ttf not found"));
70+
auto font_path = boost::dll::program_location().parent_path().parent_path().string() + "/LiberationMono-Regular.ttf";
71+
if (!font.loadFromFile(font_path))
72+
CASPAR_THROW_EXCEPTION(file_not_found() << msg_info(font_path + " not found"));
7073
return font;
7174
}();
7275

0 commit comments

Comments
 (0)