Skip to content

Commit

Permalink
Diag font: use path relative to executable.
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
gizahNL committed Jun 2, 2020
1 parent 14f5288 commit 9729563
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/diagnostics/osd_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#include <tbb/concurrent_unordered_map.h>

#include <boost/dll.hpp>

#include <GL/glew.h>

#include <atomic>
Expand Down Expand Up @@ -65,8 +67,9 @@ sf::Font& get_default_font()
{
static sf::Font DEFAULT_FONT = []() {
sf::Font font;
if (!font.loadFromFile("LiberationMono-Regular.ttf"))
CASPAR_THROW_EXCEPTION(file_not_found() << msg_info("LiberationMono-Regular.ttf not found"));
auto font_path = boost::dll::program_location().parent_path().parent_path().string() + "/LiberationMono-Regular.ttf";
if (!font.loadFromFile(font_path))
CASPAR_THROW_EXCEPTION(file_not_found() << msg_info(font_path + " not found"));
return font;
}();

Expand Down

0 comments on commit 9729563

Please sign in to comment.