FIX: korean font display issue
Jira: STUDIO-3995 Change-Id: If92b05c1a38041f976fc5a5823feb674549c4993
This commit is contained in:
parent
f964842d8f
commit
5927b5f87a
4 changed files with 10 additions and 2 deletions
BIN
resources/fonts/NotoSansKR-Bold.ttf
Normal file
BIN
resources/fonts/NotoSansKR-Bold.ttf
Normal file
Binary file not shown.
BIN
resources/fonts/NotoSansKR-Regular.ttf
Normal file
BIN
resources/fonts/NotoSansKR-Regular.ttf
Normal file
Binary file not shown.
|
@ -371,6 +371,7 @@ void ImGuiWrapper::set_language(const std::string &language)
|
|||
} else if (lang == "ko") {
|
||||
ranges = ImGui::GetIO().Fonts->GetGlyphRangesKorean(); // Default + Korean characters
|
||||
m_font_cjk = true;
|
||||
m_is_korean = true;
|
||||
} else if (lang == "zh") {
|
||||
ranges = (language == "zh_TW") ?
|
||||
// Traditional Chinese
|
||||
|
@ -2090,7 +2091,10 @@ void ImGuiWrapper::init_font(bool compress)
|
|||
cfg.OversampleH = cfg.OversampleV = 1;
|
||||
//FIXME replace with io.Fonts->AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, m_font_size, nullptr, ranges.Data);
|
||||
//https://github.com/ocornut/imgui/issues/220
|
||||
default_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &cfg, m_font_cjk ? ImGui::GetIO().Fonts->GetGlyphRangesChineseFull() : ranges.Data);
|
||||
if (m_is_korean)
|
||||
default_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "NotoSansKR-Regular.ttf").c_str(), m_font_size, &cfg, ranges.Data);
|
||||
else
|
||||
default_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &cfg, ranges.Data);
|
||||
if (default_font == nullptr) {
|
||||
default_font = io.Fonts->AddFontDefault();
|
||||
if (default_font == nullptr) {
|
||||
|
@ -2098,7 +2102,10 @@ void ImGuiWrapper::init_font(bool compress)
|
|||
}
|
||||
}
|
||||
|
||||
bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &cfg, ranges.Data);
|
||||
if (m_is_korean)
|
||||
bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "NotoSansKR-Bold.ttf").c_str(), m_font_size, &cfg, ranges.Data);
|
||||
else
|
||||
bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + "HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &cfg, ranges.Data);
|
||||
if (bold_font == nullptr) {
|
||||
bold_font = io.Fonts->AddFontDefault();
|
||||
if (bold_font == nullptr) { throw Slic3r::RuntimeError("ImGui: Could not load deafult font"); }
|
||||
|
|
|
@ -48,6 +48,7 @@ class ImGuiWrapper
|
|||
const ImWchar* m_glyph_basic_ranges { nullptr };
|
||||
// Chinese, Japanese, Korean
|
||||
bool m_font_cjk{ false };
|
||||
bool m_is_korean{ false };
|
||||
float m_font_size{ 18.0 };
|
||||
unsigned m_font_texture{ 0 };
|
||||
unsigned m_font_another_texture{ 0 };
|
||||
|
|
Loading…
Reference in a new issue