Extend advance height when font is collection

This commit is contained in:
Filip Sykala - NTB T15p 2022-11-08 12:23:43 +01:00
parent 2886d26fa0
commit bf55f63c39
3 changed files with 10 additions and 3 deletions

View file

@ -735,6 +735,10 @@ void GLGizmoEmboss::initialize()
ImVec2(cfg.minimal_window_size.x,
cfg.minimal_window_size.y + advance_height);
cfg.minimal_window_size_with_collections =
ImVec2(cfg.minimal_window_size_with_advance.x,
cfg.minimal_window_size_with_advance.y + input_height);
int max_style_image_width = cfg.max_style_name_width /2 -
2 * style.FramePadding.x;
int max_style_image_height = 1.5 * input_height;
@ -2811,9 +2815,9 @@ void GLGizmoEmboss::set_minimal_window_size(bool is_advance_edit_style)
const ImVec2 &GLGizmoEmboss::get_minimal_window_size() const
{
return m_is_advanced_edit_style ?
m_gui_cfg->minimal_window_size_with_advance :
m_gui_cfg->minimal_window_size;
return (!m_is_advanced_edit_style) ? m_gui_cfg->minimal_window_size :
((!m_style_manager.has_collections())? m_gui_cfg->minimal_window_size_with_advance :
m_gui_cfg->minimal_window_size_with_collections);
}
#ifdef ALLOW_ADD_FONT_BY_OS_SELECTOR

View file

@ -178,6 +178,7 @@ private:
// Zero means it is calculated in init function
ImVec2 minimal_window_size = ImVec2(0, 0);
ImVec2 minimal_window_size_with_advance = ImVec2(0, 0);
ImVec2 minimal_window_size_with_collections = ImVec2(0, 0);
float input_width = 0.f;
float delete_pos_x = 0.f;
float max_style_name_width = 0.f;

View file

@ -112,6 +112,8 @@ public:
const std::optional<wxFont> &get_wx_font() const { return m_style_cache.wx_font; }
const std::optional<wxFont> &get_stored_wx_font() const { return m_style_cache.stored_wx_font; }
Emboss::FontFileWithCache &get_font_file_with_cache() { return m_style_cache.font_file; }
bool has_collections() const { return m_style_cache.font_file.font_file != nullptr &&
m_style_cache.font_file.font_file->infos.size() > 1; }
// True when activ style has same name as some of stored style
bool exist_stored_style() const { return m_style_cache.style_index != std::numeric_limits<size_t>::max(); }