Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring diag font path at build time #1523

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ set(CASPARCG_DOWNLOAD_CACHE ${CMAKE_CURRENT_BINARY_DIR}/external CACHE STRING "D

option(ENABLE_HTML "Enable HTML module, require CEF" ON)

set(DIAG_FONT_PATH "LiberationMono-Regular.ttf" CACHE STRING
"Path to font that will be used to load diag font at runtime. By default
this loads the font distribtued with the application from the working
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo - distribtued, should be distributed

directory. It can be set to an absolute path to instead load a font from
the system."
)
add_compile_definitions("DIAG_FONT_PATH=\"${DIAG_FONT_PATH}\"")

# Add custom cmake modules path
SET (CASPARCG_PATCH_DIR ${CMAKE_SOURCE_DIR}/CMakeModules/patches)
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
Expand Down
4 changes: 0 additions & 4 deletions src/CMakeModules/Bootstrap_Linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ 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
10 changes: 2 additions & 8 deletions src/core/diagnostics/osd_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,8 @@ 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
if (!font.loadFromFile(DIAG_FONT_PATH))
CASPAR_THROW_EXCEPTION(file_not_found() << msg_info(DIAG_FONT_PATH " not found"));
return font;
}();

Expand Down