1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:18:11 +00:00

LibVT: Don't cache bold variant of VT font in a member variable

Remove some leftovers from back when we had to resolve a bold variant
of the terminal font manually. Now we can just use bold_variant().
This commit is contained in:
Andreas Kling 2021-05-22 10:19:42 +02:00
parent 636c43db6c
commit ee5cf92b3d
2 changed files with 4 additions and 13 deletions

View file

@ -380,6 +380,9 @@ void TerminalWidget::paint_event(GUI::PaintEvent& event)
painter.draw_rect(rect.inflated(2, 2).intersected(frame_inner_rect()), palette().base_text());
}
auto& font = this->font();
auto& bold_font = font.bold_variant();
// Pass: Paint foreground (text).
for (u16 visual_row = 0; visual_row < m_terminal.rows(); ++visual_row) {
auto row_rect = this->row_rect(visual_row);
@ -408,7 +411,7 @@ void TerminalWidget::paint_event(GUI::PaintEvent& event)
painter.draw_glyph_or_emoji(
character_rect.location(),
code_point,
attribute.flags & VT::Attribute::Bold ? bold_font() : font(),
attribute.flags & VT::Attribute::Bold ? bold_font : font,
text_color);
}
}
@ -1062,14 +1065,6 @@ void TerminalWidget::did_change_font()
{
GUI::Frame::did_change_font();
m_line_height = font().glyph_height() + m_line_spacing;
const Gfx::Font& bold_font = font().bold_variant();
if (bold_font.glyph_height() == font().glyph_height() && bold_font.glyph_width(' ') == font().glyph_width(' '))
m_bold_font = &bold_font;
else
m_bold_font = font();
if (!size().is_empty())
relayout(size());
}

View file

@ -39,8 +39,6 @@ public:
void apply_size_increments_to_window(GUI::Window&);
const Gfx::Font& bold_font() const { return *m_bold_font; }
void set_opacity(u8);
float opacity() { return m_opacity; };
@ -175,8 +173,6 @@ private:
bool m_cursor_blink_state { true };
bool m_automatic_size_policy { false };
RefPtr<Gfx::Font> m_bold_font;
enum class AutoScrollDirection {
None,
Up,