From de075fffc395410062832d77e192413530e0d68a Mon Sep 17 00:00:00 2001 From: Silent Date: Tue, 5 Jan 2021 18:17:18 +0100 Subject: [PATCH] Register more glyph ranges supported by Roboto Adds support for Polish, makes Russian use a default font --- src/duckstation-qt/qthostinterface.cpp | 6 ------ src/frontend-common/imgui_styles.cpp | 22 +++++++++++++++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/duckstation-qt/qthostinterface.cpp b/src/duckstation-qt/qthostinterface.cpp index 2ed5ed1fc..7a0a5bc3a 100644 --- a/src/duckstation-qt/qthostinterface.cpp +++ b/src/duckstation-qt/qthostinterface.cpp @@ -1442,12 +1442,6 @@ static bool AddImGuiFont(const std::string& language, float size, float framebuf path = GetFontPath("msgothic.ttc"); range = ImGui::GetIO().Fonts->GetGlyphRangesJapanese(); } - else if (language == "ru") - { - path = GetFontPath("segoeui.ttf"); - range = ImGui::GetIO().Fonts->GetGlyphRangesCyrillic(); - size *= 1.15f; - } else if (language == "zh-cn") { path = GetFontPath("msyh.ttc"); diff --git a/src/frontend-common/imgui_styles.cpp b/src/frontend-common/imgui_styles.cpp index 01fefc2a5..1f69bb489 100644 --- a/src/frontend-common/imgui_styles.cpp +++ b/src/frontend-common/imgui_styles.cpp @@ -61,6 +61,26 @@ void ImGui::StyleColorsDarker(ImGuiStyle* dst) void ImGui::AddRobotoRegularFont(float size /*= 15.0f*/) { + static const ImWchar ranges[] = { + // Basic Latin + Latin Supplement + Central European diacritics + 0x0020, + 0x017F, + + // Cyrillic + Cyrillic Supplement + 0x0400, + 0x052F, + + // Cyrillic Extended-A + 0x2DE0, + 0x2DFF, + + // Cyrillic Extended-B + 0xA640, + 0xA69F, + + 0, + }; + ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(s_font_roboto_regular_compressed_data, - s_font_roboto_regular_compressed_size, size); + s_font_roboto_regular_compressed_size, size, nullptr, ranges); }