From b4302187dd0e93e905d4319297e7b35868839590 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 17 May 2016 19:47:13 +0200 Subject: [PATCH] ImFontAtlas: Tweak to allow MergeMode to apply on a font that isn't the previous one, by setting the DstFont field. --- imgui_draw.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 57b13bf82..9f3c265b0 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -1141,7 +1141,8 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) ConfigData.push_back(*font_cfg); ImFontConfig& new_font_cfg = ConfigData.back(); - new_font_cfg.DstFont = Fonts.back(); + if (!new_font_cfg.DstFont) + new_font_cfg.DstFont = Fonts.back(); if (!new_font_cfg.FontDataOwnedByAtlas) { new_font_cfg.FontData = ImGui::MemAlloc(new_font_cfg.FontDataSize); @@ -1151,7 +1152,7 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg) // Invalidate texture ClearTexData(); - return Fonts.back(); + return new_font_cfg.DstFont; } // Default font TTF is compressed with stb_compress then base85 encoded (see extra_fonts/binary_to_compressed_c.cpp for encoder)