optionally use freetype and plutosvg for color fonts

This commit is contained in:
Green Sky
2025-03-15 00:27:59 +01:00
parent 74f2de81e8
commit 7ef29c9f04
7 changed files with 96 additions and 1 deletions

View File

@ -7,6 +7,7 @@
#include <nlohmann/json.hpp>
#include <imgui/imgui.h>
#include <imgui/misc/freetype/imgui_freetype.h>
#include <imgui/misc/cpp/imgui_stdlib.h>
#include <cctype>
@ -105,6 +106,10 @@ StartScreen::StartScreen(const std::vector<std::string_view>& args, SDL_Renderer
fontcfg.OversampleH = 2;
fontcfg.OversampleV = 1;
fontcfg.MergeMode = false;
#if defined(IMGUI_ENABLE_FREETYPE) && defined(IMGUI_ENABLE_FREETYPE_PLUTOSVG)
std::cout << "Font: enabling freetype color loading\n";
fontcfg.FontBuilderFlags |= ImGuiFreeTypeBuilderFlags_LoadColor;
#endif
for (const auto [font_path, should_load] : _conf.entries_bool("ImGuiFonts", "fonts")) {
if (!should_load) {