From 2c3477d3d745db29124e7a3fb5db52a86506fd8f Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Wed, 12 Jan 2022 09:48:53 +0100 Subject: [PATCH] Dynamic skew not only for linux --- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 14 +++++++++++--- src/slic3r/Utils/WxFontUtils.cpp | 9 --------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index f9a00edf02..e411722dfb 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -314,10 +314,9 @@ void GLGizmoEmboss::on_render_input_window(float x, float y, float bottom_limit) // ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse; m_imgui->begin(on_get_name(), flag); - - ImGui::GetWindowSize(); draw_window(); m_imgui->end(); + ImGui::PopStyleVar(); // WindowMinSize } @@ -1043,6 +1042,14 @@ bool GLGizmoEmboss::choose_font_by_wxdialog() wxFont font = data.GetChosenFont(); size_t font_index = m_font_list.size(); FontItem font_item = WxFontUtils::get_font_item(font); + + // fix dynamic creation of italic font + wxFontStyle wx_style = font.GetStyle(); + if ((wx_style == wxFONTSTYLE_ITALIC || wx_style == wxFONTSTYLE_SLANT) && + !Emboss::is_italic(*m_font)) { + font_item.prop.skew = 0.2; + } + make_unique_name(font_item.name, m_font_list); m_font_list.emplace_back(font_item); @@ -1053,7 +1060,8 @@ bool GLGizmoEmboss::choose_font_by_wxdialog() if (!use_deserialized_font) m_font_selected = font_index; // Try load and use new added font if ((!use_deserialized_font && !load_font(font)) || - (use_deserialized_font && !load_font(font_index)) || !process()) { + (use_deserialized_font && !load_font(font_index)) || + !process()) { // reverse index for font_selected std::swap(font_index, m_font_selected); // when not process // remove form font list diff --git a/src/slic3r/Utils/WxFontUtils.cpp b/src/slic3r/Utils/WxFontUtils.cpp index efb9fcd97c..81e9f6a755 100644 --- a/src/slic3r/Utils/WxFontUtils.cpp +++ b/src/slic3r/Utils/WxFontUtils.cpp @@ -209,13 +209,4 @@ void WxFontUtils::update_property(FontProp &font_prop, const wxFont &font) auto it = from_weight.find(wx_weight); if (it != from_weight.end()) font_prop.weight = it->second; } - -#ifdef __linux__ - // dynamic creation of italic, on linux is italic made by skew of normal font - wxFontStyle style = font.GetStyle(); - if ((style == wxFONTSTYLE_ITALIC || style == wxFONTSTYLE_SLANT) && - !Emboss::is_italic(*m_font)) { - font_prop.skew = 0.2; - } -#endif }