//globals or settings
std::map<std::string, ImFont*> fonts_map;
ImFont* current_font = nullptr;
//where imgui is initialized
void init_fonts()
{
ImGuiIO& io = ImGui::GetIO();
fonts_map.emplace("font1", io.Fonts->AddFontFromFileTTF("font1.ttf", 13.f));
fonts_map.emplace("font2", io.Fonts->AddFontFromFileTTF("font2.ttf", 13.f));
fonts_map.emplace("font3", io.Fonts->AddFontFromFileTTF("font3.ttf", 13.f));
current_font = fonts_map["font1"];
}
//menu
void draw_fonts_choice()
{
if (BeginListBox("Font##CHOICE_FONT_FOR_WATERMARK"))
{
for (auto [name, font] : fonts_map)
{
if (Selectable((name + "##CHOICE_FONT_FOR_WATERMARK_LIST_BOX").c_str(), *current_font == *font)) //*current_font == *font mb not exactly
current_font = font;
}
EndListBox();
}
}
//watermark
void draw_watermark()
{
PushFont(current_font);
//draw watermark
PopFont();
}