diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index f68285c3b..ecb20c6cb 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -162,6 +162,49 @@ void gui_init() }; io.Fonts->AddFontFromMemoryCompressedTTF(roboto_medium_compressed_data, roboto_medium_compressed_size, 17.f * scaling, nullptr, ranges); + ImFontConfig font_cfg; + font_cfg.MergeMode = true; +#ifdef _WIN32 + u32 cp = GetACP(); + std::string fontDir = std::string(nowide::getenv("SYSTEMROOT")) + "\\Fonts\\"; + switch (cp) + { + case 932: // Japanese + { + font_cfg.FontNo = 2; // UIGothic + ImFont* font = io.Fonts->AddFontFromFileTTF((fontDir + "msgothic.ttc").c_str(), 17.f * scaling, &font_cfg, io.Fonts->GetGlyphRangesJapanese()); + font_cfg.FontNo = 2; // Meiryo UI + if (font == nullptr) + io.Fonts->AddFontFromFileTTF((fontDir + "Meiryo.ttc").c_str(), 17.f * scaling, &font_cfg, io.Fonts->GetGlyphRangesJapanese()); + } + break; + case 949: // Korean + { + ImFont* font = io.Fonts->AddFontFromFileTTF((fontDir + "Malgun.ttf").c_str(), 17.f * scaling, &font_cfg, io.Fonts->GetGlyphRangesKorean()); + if (font == nullptr) + { + font_cfg.FontNo = 2; // Dotum + io.Fonts->AddFontFromFileTTF((fontDir + "Gulim.ttc").c_str(), 17.f * scaling, &font_cfg, io.Fonts->GetGlyphRangesKorean()); + } + } + break; + case 950: // Traditional Chinese + { + font_cfg.FontNo = 1; // Microsoft JhengHei UI Regular + ImFont* font = io.Fonts->AddFontFromFileTTF((fontDir + "Msjh.ttc").c_str(), 17.f * scaling, &font_cfg, io.Fonts->GetGlyphRangesChineseFull()); + font_cfg.FontNo = 0; + if (font == nullptr) + io.Fonts->AddFontFromFileTTF((fontDir + "MSJH.ttf").c_str(), 17.f * scaling, &font_cfg, io.Fonts->GetGlyphRangesChineseFull()); + } + break; + case 936: // Simplified Chinese + io.Fonts->AddFontFromFileTTF((fontDir + "Simsun.ttc").c_str(), 17.f * scaling, &font_cfg, io.Fonts->GetGlyphRangesChineseSimplifiedCommon()); + break; + default: + break; + } + // TODO linux, macOS, Android... +#endif INFO_LOG(RENDERER, "Screen DPI is %d, size %d x %d. Scaling by %.2f", screen_dpi, screen_width, screen_height, scaling); EventManager::listen(Event::Resume, emuEventCallback);