diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-14 13:06:05 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-14 13:06:05 +0200 |
commit | fc1facf5c09a92cf49ce2b2db729cac51f6e75e2 (patch) | |
tree | 04c6dfbd75252593f7e13b8959b07fa1fd501a58 /Widgets/TerminalWidget.cpp | |
parent | e5acbca0e84b0b1d350d20372016436d7708afe1 (diff) | |
download | serenity-fc1facf5c09a92cf49ce2b2db729cac51f6e75e2.zip |
Let widget have a font() instead of using Font::defaultFont() everywhere.
Diffstat (limited to 'Widgets/TerminalWidget.cpp')
-rw-r--r-- | Widgets/TerminalWidget.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Widgets/TerminalWidget.cpp b/Widgets/TerminalWidget.cpp index 729cf16b16..56782eba37 100644 --- a/Widgets/TerminalWidget.cpp +++ b/Widgets/TerminalWidget.cpp @@ -14,9 +14,7 @@ TerminalWidget::TerminalWidget(Widget* parent) { g_tw = this; - auto& font = Font::defaultFont(); - - setWindowRelativeRect({ 0, 0, (columns() * font.glyphWidth()) + 4, (rows() * font.glyphHeight()) + 4 }); + setWindowRelativeRect({ 0, 0, (columns() * font().glyphWidth()) + 4, (rows() * font().glyphHeight()) + 4 }); printf("rekt: %d x %d\n", width(), height()); m_screen = new CharacterWithAttributes[rows() * columns()]; @@ -65,15 +63,13 @@ void TerminalWidget::paintEvent(PaintEvent&) Painter painter(*this); painter.fillRect(rect(), Color::Black); - auto& font = Font::defaultFont(); - char buf[2] = { 0, 0 }; for (unsigned row = 0; row < m_rows; ++row) { - int y = row * font.glyphHeight(); + int y = row * font().glyphHeight(); for (unsigned column = 0; column < m_columns; ++column) { - int x = column * font.glyphWidth(); + int x = column * font().glyphWidth(); buf[0] = at(row, column).character; - painter.drawText({ x + 2, y + 2, width(), font.glyphHeight() }, buf, Painter::TextAlignment::TopLeft, Color(0xa0, 0xa0, 0xa0)); + painter.drawText({ x + 2, y + 2, width(), font().glyphHeight() }, buf, Painter::TextAlignment::TopLeft, Color(0xa0, 0xa0, 0xa0)); } } |