Skip to content

Commit

Permalink
fix(linux): allow loading diag font from system path
Browse files Browse the repository at this point in the history
Not the cleanest solution, but easy and low risk
  • Loading branch information
Julusian committed Dec 21, 2023
1 parent 4e254d0 commit 7366b83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CMakeModules/Bootstrap_Linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ if (NOT USE_STATIC_BOOST)
ADD_DEFINITIONS (-DBOOST_ALL_DYN_LINK)
endif()

if (USE_SYSTEM_DIAG_FONT)
ADD_DEFINITIONS(-DUSE_SYSTEM_DIAG_FONT)
endif()

IF (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
ADD_COMPILE_OPTIONS (-O3) # Needed for precompiled headers to work
endif()
Expand Down
5 changes: 5 additions & 0 deletions src/core/diagnostics/osd_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ sf::Font& get_default_font()
{
static sf::Font DEFAULT_FONT = []() {
sf::Font font;
#ifdef USE_SYSTEM_DIAG_FONT
if (!font.loadFromFile("/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf"))
CASPAR_THROW_EXCEPTION(file_not_found() << msg_info("/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf not found"));
#else
if (!font.loadFromFile("LiberationMono-Regular.ttf"))
CASPAR_THROW_EXCEPTION(file_not_found() << msg_info("LiberationMono-Regular.ttf not found"));
#endif
return font;
}();

Expand Down

0 comments on commit 7366b83

Please sign in to comment.