1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

FontEditor: Simplify start-up

Previusly a cloned or newly loaded font was moved twice from main to
the constructor and then from constructor to an init routine where it
was finally used. The unmasked font is now moved only once, directly
to initialization, and redundant error checking is discarded.
This commit is contained in:
thankyouverycool 2021-11-29 09:07:47 -05:00 committed by Andreas Kling
parent 56a8a2b493
commit 922e80e72b
4 changed files with 20 additions and 34 deletions

View file

@ -31,6 +31,9 @@ void GlyphMapWidget::initialize(Gfx::BitmapFont& mutable_font)
void GlyphMapWidget::resize_event(GUI::ResizeEvent& event)
{
if (!m_font)
return;
int event_width = event.size().width() - this->vertical_scrollbar().width() - (frame_thickness() * 2) - m_horizontal_spacing;
int event_height = event.size().height() - (frame_thickness() * 2);
m_visible_glyphs = (event_width * event_height) / (font().max_glyph_width() * font().glyph_height());