소스 검색

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.
Sam Atkins 2 년 전
부모
커밋
e54a03d497
1개의 변경된 파일1개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 5
      Userland/Libraries/LibGUI/TextEditor.cpp

+ 1 - 5
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) {