Automatic addition of missing glyphs: require extra frame when chars are added

This commit is contained in:
Lukas Matena 2024-06-06 13:15:10 +02:00
parent ccd8910442
commit 5fac6934ec
2 changed files with 1 additions and 11 deletions

View File

@ -407,6 +407,7 @@ void ImGuiWrapper::render()
// If there were some characters that ImGui was unable to render, we will destroy current font.
// It will be rebuilt in the next call of new_frame including these.
destroy_font();
this->set_requires_extra_frame();
}
}
@ -1176,16 +1177,6 @@ void ImGuiWrapper::init_font(bool compress)
}
}
#ifdef __APPLE__
ImFontConfig config;
config.MergeMode = true;
if (! m_font_cjk) {
// Apple keyboard shortcuts are only contained in the CJK fonts.
[[maybe_unused]]ImFont *font_cjk = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttc").c_str(), m_font_size, &config, ranges_keyboard_shortcuts);
assert(font_cjk != nullptr);
}
#endif
float font_scale = m_font_size/15;
int icon_sz = lround(16 * font_scale); // default size of icon is 16 px

View File

@ -32,7 +32,6 @@ namespace GUI {
class ImGuiWrapper
{
std::vector<std::tuple<std::string, const ImWchar*, bool>> m_lang_glyphs_info; // language prefix, ranges, whether it needs CLK font
const ImWchar* m_notosans_regular_ranges;
const ImWchar* m_glyph_ranges{ nullptr };
// Chinese, Japanese, Korean
float m_font_size{ 18.0 };