diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 703ed60ad..49101cf0f 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -441,6 +441,16 @@ bool ImGuiWrapper::want_any_input() const return io.WantCaptureMouse || io.WantCaptureKeyboard || io.WantTextInput; } +#ifdef __APPLE__ +static const ImWchar ranges_keyboard_shortcuts[] = +{ + 0x2318, 0x2318, // OSX Command Key symbol + 0x2325, 0x2325, // OSX Option Key symbol + 0x21E7, 0x21E7, // OSX Shift Key symbol + 0, +}; +#endif // __APPLE__ + void ImGuiWrapper::init_font(bool compress) { destroy_font(); @@ -453,9 +463,9 @@ void ImGuiWrapper::init_font(bool compress) ImFontAtlas::GlyphRangesBuilder builder; builder.AddRanges(m_glyph_ranges); #ifdef __APPLE__ - builder.AddChar(0x2318); // OSX Command Key symbol - builder.AddChar(0x2325); // OSX Option Key symbol - builder.AddChar(0x21E7); // OSX Shift Key symbol + if (m_font_cjk) + // Apple keyboard shortcuts are only contained in the CJK fonts. + builder.AddRanges(ranges_keyboard_shortcuts); #endif builder.BuildRanges(&ranges); // Build the final result (ordered ranges with all the unique characters submitted) @@ -469,6 +479,12 @@ void ImGuiWrapper::init_font(bool compress) } } +#ifdef __APPLE__ + if (! m_font_cjk) + // Apple keyboard shortcuts are only contained in the CJK fonts. + io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSansCJK-Regular.ttf").c_str(), m_font_size, nullptr, ranges_keyboard_shortcuts); +#endif + // Build texture atlas unsigned char* pixels; int width, height;