Merge pull request #1395 from CookiePLMonster/add-roboto-glyphs

Register more glyph ranges supported by Roboto
This commit is contained in:
Connor McLaughlin 2021-01-07 12:14:48 +10:00 committed by GitHub
commit e80cd69811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View File

@ -1442,12 +1442,6 @@ static bool AddImGuiFont(const std::string& language, float size, float framebuf
path = GetFontPath("msgothic.ttc"); path = GetFontPath("msgothic.ttc");
range = ImGui::GetIO().Fonts->GetGlyphRangesJapanese(); 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") else if (language == "zh-cn")
{ {
path = GetFontPath("msyh.ttc"); path = GetFontPath("msyh.ttc");

View File

@ -61,6 +61,26 @@ void ImGui::StyleColorsDarker(ImGuiStyle* dst)
void ImGui::AddRobotoRegularFont(float size /*= 15.0f*/) 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, 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);
} }