mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-13 04:57:40 +00:00
Fix Celsius symbol rendering in Preview (#15202)
This commit is contained in:
@@ -2856,6 +2856,7 @@ const ImWchar* ImFontAtlas::GetGlyphRangesDefault()
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x2000, 0x206F, // General Punctuation
|
||||
0x2103, 0x2103, // ℃ Celsius symbol
|
||||
0x3000, 0x30FF, // CJK Symbols and Punctuations, Hiragana, Katakana
|
||||
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
||||
0xFF00, 0xFFEF, // Half-width characters
|
||||
|
||||
@@ -2809,12 +2809,26 @@ void ImGuiWrapper::init_font(bool compress)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
|
||||
ImFontConfig fallback_cfg = cfg;
|
||||
fallback_cfg.MergeMode = true;
|
||||
static constexpr ImWchar celsius_range[] = { 0x2103, 0x2103, 0 };
|
||||
io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Regular.ttf").c_str(), m_font_size, &fallback_cfg, celsius_range);
|
||||
}
|
||||
|
||||
bold_font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/" + font_name_bold).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"); }
|
||||
}
|
||||
|
||||
if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
|
||||
ImFontConfig fallback_cfg = cfg;
|
||||
fallback_cfg.MergeMode = true;
|
||||
static constexpr ImWchar celsius_range[] = { 0x2103, 0x2103, 0 };
|
||||
io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/HarmonyOS_Sans_SC_Bold.ttf").c_str(), m_font_size, &fallback_cfg, celsius_range);
|
||||
}
|
||||
|
||||
if (m_glyph_ranges == ImGui::GetIO().Fonts->GetGlyphRangesThai()) {
|
||||
default_font->Scale *= 1.25f;
|
||||
bold_font->Scale *= 1.25f;
|
||||
|
||||
Reference in New Issue
Block a user