mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-10 10:47:16 +00:00
match em_unit value for on_dpi_change for linux (#15043)
* Update GUI_Utils.hpp * Update GUI_Utils.hpp
This commit is contained in:
@@ -113,14 +113,7 @@ public:
|
|||||||
update_dark_ui(this);
|
update_dark_ui(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
|
update_em_unit();
|
||||||
// So, calculate the m_em_unit value from the font size, as before
|
|
||||||
#if !defined(__WXGTK__)
|
|
||||||
m_em_unit = std::max<size_t>(10, 10.0f * m_scale_factor);
|
|
||||||
#else
|
|
||||||
// initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
|
|
||||||
m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
|
|
||||||
#endif // __WXGTK__
|
|
||||||
|
|
||||||
// recalc_font();
|
// recalc_font();
|
||||||
|
|
||||||
@@ -235,6 +228,19 @@ private:
|
|||||||
// m_em_unit = metrics.averageWidth;
|
// m_em_unit = metrics.averageWidth;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// update em_unit value for new window font
|
||||||
|
void update_em_unit()
|
||||||
|
{
|
||||||
|
// Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
|
||||||
|
// So, calculate the m_em_unit value from the font size, as before
|
||||||
|
#if !defined(__WXGTK__)
|
||||||
|
m_em_unit = std::max<size_t>(10, 10.0f * m_scale_factor);
|
||||||
|
#else
|
||||||
|
// initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
|
||||||
|
m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
|
||||||
|
#endif // __WXGTK__
|
||||||
|
}
|
||||||
|
|
||||||
// check if new scale is differ from previous
|
// check if new scale is differ from previous
|
||||||
bool is_new_scale_factor() const { return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }
|
bool is_new_scale_factor() const { return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }
|
||||||
|
|
||||||
@@ -247,8 +253,7 @@ private:
|
|||||||
// set normal application font as a current window font
|
// set normal application font as a current window font
|
||||||
m_normal_font = this->GetFont();
|
m_normal_font = this->GetFont();
|
||||||
|
|
||||||
// update em_unit value for new window font
|
update_em_unit();
|
||||||
m_em_unit = std::max<int>(10, 10.0f * m_scale_factor);
|
|
||||||
|
|
||||||
// rescale missed controls sizes and images
|
// rescale missed controls sizes and images
|
||||||
on_dpi_changed(suggested_rect);
|
on_dpi_changed(suggested_rect);
|
||||||
|
|||||||
Reference in New Issue
Block a user