From 3c83fa17cc02bce7bd3a835a578cf584255c305e Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 6 Feb 2019 10:55:11 +0100 Subject: [PATCH] Fixed a scale for the LegendTexture in a Preview --- src/slic3r/GUI/GLCanvas3D.cpp | 5 +++-- src/slic3r/GUI/GUI_App.hpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 84a2b61cf..6d7afaa4a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3834,7 +3834,8 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c wxMemoryDC mask_memDC; // calculate scaling - const float scale = canvas.get_canvas_size().get_scale_factor(); +// const float scale = canvas.get_canvas_size().get_scale_factor(); + const float scale = wxGetApp().em_unit()*0.1; // get scale from em_unit() value, because of get_scale_factor() return 1 const int scaled_square = std::floor((float)Px_Square * scale); const int scaled_title_offset = Px_Title_Offset * scale; const int scaled_text_offset = Px_Text_Offset * scale; @@ -3842,7 +3843,7 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c const int scaled_border = Px_Border * scale; // select default font - const wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale); + const wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)/*.Scale(scale)*/; // font is no need to scale now memDC.SetFont(font); mask_memDC.SetFont(font); diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index ec9684d29..e1050b73a 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -80,8 +80,8 @@ class GUI_App : public wxApp wxFont m_small_font; wxFont m_bold_font; - size_t m_em_unit; // "m" string width in pixels. - // Used like a coefficient for a size setting of controls + size_t m_em_unit; // width of a "m"-symbol in pixels for current system font + // Note: for 100% Scale m_em_unit = 10 -> it's a good enough coefficient for a size setting of controls wxLocale* m_wxLocale{ nullptr };