feat(text): optional vendored stb_truetype backend for runtime external fonts

This commit is contained in:
Martino Ferrari committed 2026-09-28 16:07:27 +02:00
1 parent daff60e3f0
commit 14d664a246
12 files changed
+6511 -19

No files matched your search

+18
View File
@@ -75,6 +75,24 @@ target_sources(plot_tests PRIVATE test_qt_pointer.cpp)
target_sources(plot_tests PRIVATE test_gtk_input.cpp)
target_include_directories(plot_tests PRIVATE "${CMAKE_SOURCE_DIR}/adapters")
# The optional runtime-font backend brings its own cases, and they exist only when
# its target does: the header, the class and the archive are all absent otherwise,
# so there would be nothing to compile them against (see PLOT_BUILD_TTF_FONT in the
# top-level CMakeLists.txt). Guarded on the target rather than on the option, like
# the adapter cases above, so a target that exists for any reason gets its cases.
#
# Two paths are handed over as definitions because a case needs them and should
# not guess: the core archive the "no stb_truetype in plot_core" case inspects
# (a generator expression, so it is this build's own archive) and the cmake the
# umbrella check is re-run with.
if(TARGET plot::font_ttf)
target_sources(plot_tests PRIVATE test_true_type_font.cpp)
target_link_libraries(plot_tests PRIVATE plot::font_ttf)
target_compile_definitions(plot_tests PRIVATE
PLOT_CORE_ARCHIVE="$<TARGET_FILE:plot_core>"
PLOT_CMAKE_COMMAND="${CMAKE_COMMAND}")
endif()
# Same switches the library is built with: the cost tests read the counters
# behind them (see include/plot/data/detail/{cover,merge}_count.hpp).
target_compile_definitions(plot_tests PRIVATE PLOT_PYRAMID_COUNT_COVERS