summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-02-20 16:22:03 +0000
committerAndreas Kling <kling@serenityos.org>2023-02-20 18:41:47 +0100
commite54a03d49744c3ef9c2fce3df2f4cae047e960fb (patch)
tree69b811081aa9c2043f6a48a850fd8fe4288cc70e
parentefd56cda6a01d81be4bbb5c061def7f69052f9d0 (diff)
downloadserenity-e54a03d49744c3ef9c2fce3df2f4cae047e960fb.zip
LibGUI: Use Gfx::Font::bold_variant() instead of a manual lookup
This has the nice side-effect of being cached in the Font, instead of being repeatedly looked up in the FontDatabase.
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 56b25466aa..95b61fb274 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -606,11 +606,7 @@ void TextEditor::paint_event(PaintEvent& event)
// draw unspanned text between spans
draw_text_helper(next_column, span_start, unspanned_font, { unspanned_color });
}
- auto font = unspanned_font;
- if (span.attributes.bold) {
- if (auto bold_font = Gfx::FontDatabase::the().get(font->family(), font->presentation_size(), 700, font->width(), 0))
- font = bold_font;
- }
+ auto font = span.attributes.bold ? unspanned_font->bold_variant() : unspanned_font;
draw_text_helper(span_start, span_end, font, span.attributes);
next_column = span_end;
if (!span_consumed) {