diff options
author | Andreas Kling <kling@serenityos.org> | 2023-02-02 14:29:34 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-02 14:49:54 +0100 |
commit | 5577d5f7890edd18ddcb01647adeeec395597523 (patch) | |
tree | 9c1cec571b6c519771736bc267358135cccf1258 /Userland/Libraries/LibGUI/Breadcrumbbar.cpp | |
parent | 63ac6ced31d7bbbe31552b73f1108715352e6970 (diff) | |
download | serenity-5577d5f7890edd18ddcb01647adeeec395597523.zip |
LibGUI: Use the correct font when relayouting Breadcrumbbar
When the system is broadcasting a "system font changed" notification,
the Breadcrumbbar will be notified before its button children. This
means that we have to use the Breadcrumbbar's font() for calculations
inside Breadcrumbbar as the buttons themselves still have the old font
at this point.
Diffstat (limited to 'Userland/Libraries/LibGUI/Breadcrumbbar.cpp')
-rw-r--r-- | Userland/Libraries/LibGUI/Breadcrumbbar.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp index 343b8b60e9..ad16f33126 100644 --- a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp +++ b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp @@ -175,7 +175,9 @@ void Breadcrumbbar::relayout() for (auto& segment : m_segments) { VERIFY(segment.button); auto& button = *segment.button; - auto button_text_width = button.font().width(segment.text); + // NOTE: We use our own font instead of the button's font here in case we're being notified about + // a system font change, and the button hasn't been notified yet. + auto button_text_width = font().width(segment.text); auto icon_width = button.icon() ? button.icon()->width() : 0; auto icon_padding = button.icon() ? 4 : 0; |