1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

FontEditor: Calculate GlyphEditor toolbar widths more precisely

Fixes pixel imperfect toolbar widths when editing small fonts.
This commit is contained in:
thankyouverycool 2022-01-09 12:41:13 -05:00 committed by Andreas Kling
parent 2e849250eb
commit 24bd2a427c

View file

@ -737,7 +737,10 @@ void FontEditorWidget::drop_event(GUI::DropEvent& event)
void FontEditorWidget::did_resize_glyph_editor()
{
constexpr int glyph_toolbars_width = 100;
constexpr int button_width = 22;
constexpr int buttons_per_bar = 4;
constexpr int spacing = (buttons_per_bar - 1) * 2 + 10;
constexpr int glyph_toolbars_width = button_width * buttons_per_bar + spacing;
m_glyph_editor_container->set_fixed_size(m_glyph_editor_widget->preferred_width(), m_glyph_editor_widget->preferred_height());
m_left_column_container->set_fixed_width(max(m_glyph_editor_widget->preferred_width(), glyph_toolbars_width));
}