diff options
author | LuK1337 <priv.luk@gmail.com> | 2021-07-12 10:05:05 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-12 11:08:09 +0200 |
commit | 8992271c5c01372b527e508d847a858b29d66e5e (patch) | |
tree | 320cd435697ae257562125b6987dea02c68dd052 | |
parent | b40d77151286a5c3a7fbb793804064d8ad770c25 (diff) | |
download | serenity-8992271c5c01372b527e508d847a858b29d66e5e.zip |
LibGUI: Redraw widgets when default font changes
-rw-r--r-- | Userland/Libraries/LibGUI/Widget.cpp | 9 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Widget.h | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index 2a5737c0a9..855d830a6b 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -562,6 +562,8 @@ void Widget::theme_change_event(ThemeChangeEvent&) void Widget::fonts_change_event(FontsChangeEvent&) { + if (m_default_font) + set_font(nullptr); } void Widget::screen_rects_change_event(ScreenRectsChangeEvent&) @@ -705,10 +707,13 @@ void Widget::set_font(const Gfx::Font* font) if (m_font.ptr() == font) return; - if (!font) + if (!font) { m_font = Gfx::FontDatabase::default_font(); - else + m_default_font = true; + } else { m_font = *font; + m_default_font = false; + } did_change_font(); update(); diff --git a/Userland/Libraries/LibGUI/Widget.h b/Userland/Libraries/LibGUI/Widget.h index 07913a6ac5..a46a735e89 100644 --- a/Userland/Libraries/LibGUI/Widget.h +++ b/Userland/Libraries/LibGUI/Widget.h @@ -361,6 +361,7 @@ private: bool m_updates_enabled { true }; bool m_accepts_emoji_input { false }; bool m_shrink_to_fit { false }; + bool m_default_font { true }; NonnullRefPtr<Gfx::PaletteImpl> m_palette; |