Can anyone tell me how fonts are loaded in Imgui?
I mean: downloading at least 10 fonts at a time: no problem, everything works.
ImGuiIO* ImGuiIO_p = &ImGui::GetIO();
(*ImGuiIO_p).Fonts->AddFontDefault();
(*ImGuiIO_p).Fonts->AddFontFromFileTTF(&path_utf8__to_TTF_file_1[0], size_Font, ImFontConfig_p, 0);
(*ImGuiIO_p).Fonts->AddFontFromFileTTF(&path_utf8__to_TTF_file_2[0], size_Font, ImFontConfig_p, 0);
The problem arises when I need to load some other font before I applied Build (), in this case, if I understand correctly, I need to remove ALL the downloaded fonts first:
(*ImGuiIO_p).Fonts->Clear();
Download them again and download the new font immediately:
ImGuiIO* ImGuiIO_p = &ImGui::GetIO();
(*ImGuiIO_p).Fonts->AddFontDefault();
(*ImGuiIO_p).Fonts->AddFontFromFileTTF(&path_utf8__to_TTF_file_1[0], size_Font, ImFontConfig_p, 0);
(*ImGuiIO_p).Fonts->AddFontFromFileTTF(&path_utf8__to_TTF_file_2[0], size_Font, ImFontConfig_p, 0);
(*ImGuiIO_p).Fonts->AddFontFromFileTTF(&path_utf8__to_TTF_file_NEW[0], size_Font, ImFontConfig_p, 0); //new Load Font
(*ImGuiIO_p).Fonts->Build();
But somehow it's a bit weird. Maybe there is a way without deleting and reloading?
PS:I apparently somehow incorrectly checked the work of this code. There is no need to delete anything. You just need to add the Font and then call Build() again.