mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
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.
This commit is contained in:
parent
efd56cda6a
commit
e54a03d497
1 changed files with 1 additions and 5 deletions
|
@ -606,11 +606,7 @@ void TextEditor::paint_event(PaintEvent& event)
|
||||||
// draw unspanned text between spans
|
// draw unspanned text between spans
|
||||||
draw_text_helper(next_column, span_start, unspanned_font, { unspanned_color });
|
draw_text_helper(next_column, span_start, unspanned_font, { unspanned_color });
|
||||||
}
|
}
|
||||||
auto font = unspanned_font;
|
auto font = span.attributes.bold ? unspanned_font->bold_variant() : 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;
|
|
||||||
}
|
|
||||||
draw_text_helper(span_start, span_end, font, span.attributes);
|
draw_text_helper(span_start, span_end, font, span.attributes);
|
||||||
next_column = span_end;
|
next_column = span_end;
|
||||||
if (!span_consumed) {
|
if (!span_consumed) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue