diff --git a/private/raid/application.cpp b/private/raid/application.cpp index 0983476..92a656d 100644 --- a/private/raid/application.cpp +++ b/private/raid/application.cpp @@ -155,21 +155,23 @@ bool Application::loadFonts(std::span fonts) // by default ImGui takes ownership of the data, that's now what we want ImFontConfig config; config.FontDataOwnedByAtlas = false; - std::vector glyphRangesConverted; + std::vector> glyphRangesConverted; + glyphRangesConverted.reserve(fonts.size()); for (const auto& [font, data] : mijin::zip(fonts, buffers)) { ImWchar* glyphRanges = nullptr; if (!font.glyphRanges.empty()) { - glyphRangesConverted.reserve(2 * font.glyphRanges.size() + 1); - glyphRangesConverted.clear(); + std::vector& glyphData = glyphRangesConverted.emplace_back(); + glyphData.reserve(2 * font.glyphRanges.size() + 1); + glyphData.clear(); for (const std::pair& range : font.glyphRanges) { - glyphRangesConverted.push_back(range.first); - glyphRangesConverted.push_back(range.second); + glyphData.push_back(range.first); + glyphData.push_back(range.second); } - glyphRangesConverted.push_back(0); - glyphRanges = glyphRangesConverted.data(); + glyphData.push_back(0); + glyphRanges = glyphData.data(); } config.PixelSnapH = font.flags.pixelSnapH; imguiIO.Fonts->AddFontFromMemoryTTF(data.data(), static_cast(data.byteSize()), font.size, &config, glyphRanges);