Read the system CJK font once, and hold fonts as ImFont pointers

Each of the four fonts merged the system CJK font from a fresh read of its file, twice, and never freed it.
It is now read once and shared. Startup memory with a document open went from 412 MB to 269 MB.
This commit is contained in:
shweet committed 2026-11-22 17:44:07 -05:00
1 parent 2f1e75da37
commit 20209e655e
12 files changed
+58 -106

No files matched your search

+1 -1
View File
@@ -891,7 +891,7 @@ void AnimationPreview::update(Manager& manager, Settings& settings, Resources& r
auto textPos = to_imvec2(to_vec2(cursorScreenPos) + to_vec2(ImGui::GetStyle().WindowPadding));
drawList->PushClipRect(clipMin, clipMax);
ImGui::PushFont(resources.fonts[FONT_BOLD].get(), FONT_SIZE_LARGE);
ImGui::PushFont(resources.fonts[FONT_BOLD], FONT_SIZE_LARGE);
auto triggerTextColor = isLightTheme ? TRIGGER_TEXT_COLOR_LIGHT : TRIGGER_TEXT_COLOR_DARK;
drawList->AddText(textPos, ImGui::GetColorU32(triggerTextColor), names.c_str());
ImGui::PopFont();