From bf11e85bff650fcaee45241a3e453b9e935c1231 Mon Sep 17 00:00:00 2001 From: LovelyA72 <29054052+LovelyA72@users.noreply.github.com> Date: Fri, 13 May 2022 21:52:33 -0400 Subject: [PATCH] Enable loading of common Chinese characters --- src/gui/gui.h | 2 ++ src/gui/settings.cpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/gui/gui.h b/src/gui/gui.h index 4017dcca..957ee16a 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -867,6 +867,7 @@ class FurnaceGUI { int roundedButtons; int roundedMenus; int loadJapanese; + int loadChinese; int fmLayout; int sampleLayout; int waveLayout; @@ -955,6 +956,7 @@ class FurnaceGUI { roundedButtons(1), roundedMenus(0), loadJapanese(0), + loadChinese(0), fmLayout(0), sampleLayout(0), waveLayout(0), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index f44c2aa9..741705ae 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -978,6 +978,19 @@ void FurnaceGUI::drawSettings() { ); } + bool loadChineseB=settings.loadChinese; + if (ImGui::Checkbox("Display Chinese (Simplified) characters",&loadChineseB)) { + settings.loadChinese=loadChineseB; + } + if (ImGui::IsItemHovered()) { + ImGui::SetTooltip( + "Only toggle this option if you have enough graphics memory.\n" + "This is a temporary solution until dynamic font atlas is implemented in Dear ImGui.\n\n" + "请在确保你有足够的显存后再启动此设定\n" + "这是一个在ImGui实现动态字体加载之前的临时解决方案" + ); + } + ImGui::Separator(); ImGui::Text("Orders row number format:"); @@ -1855,6 +1868,7 @@ void FurnaceGUI::syncSettings() { settings.roundedButtons=e->getConfInt("roundedButtons",1); settings.roundedMenus=e->getConfInt("roundedMenus",0); settings.loadJapanese=e->getConfInt("loadJapanese",0); + settings.loadChinese=e->getConfInt("loadChinese",0); settings.fmLayout=e->getConfInt("fmLayout",0); settings.sampleLayout=e->getConfInt("sampleLayout",0); settings.waveLayout=e->getConfInt("waveLayout",0); @@ -1931,6 +1945,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.roundedButtons,0,1); clampSetting(settings.roundedMenus,0,1); clampSetting(settings.loadJapanese,0,1); + clampSetting(settings.loadChinese,0,1); clampSetting(settings.fmLayout,0,3); clampSetting(settings.susPosition,0,1); clampSetting(settings.effectCursorDir,0,2); @@ -2048,6 +2063,7 @@ void FurnaceGUI::commitSettings() { e->setConf("roundedButtons",settings.roundedButtons); e->setConf("roundedMenus",settings.roundedMenus); e->setConf("loadJapanese",settings.loadJapanese); + e->setConf("loadChinese",settings.loadChinese); e->setConf("fmLayout",settings.fmLayout); e->setConf("sampleLayout",settings.sampleLayout); e->setConf("waveLayout",settings.waveLayout); @@ -2638,6 +2654,9 @@ void FurnaceGUI::applyUISettings(bool updateFonts) { if (settings.loadJapanese) { range.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesJapanese()); } + if (settings.loadChinese) { + range.AddRanges(ImGui::GetIO().Fonts->GetGlyphRangesChineseSimplifiedCommon()); + } // I'm terribly sorry range.UsedChars[0x80>>5]=0;