From 7dd931e8a9f36f6348df0d8884221fc4ac7e6fbe Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Thu, 7 Nov 2024 13:58:20 -0500 Subject: [PATCH] Try to fix pixelated console on Windows machines with small resolutions --- app/src/UI/Widgets/Terminal.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/UI/Widgets/Terminal.cpp b/app/src/UI/Widgets/Terminal.cpp index 6f72fbf8..345de85b 100644 --- a/app/src/UI/Widgets/Terminal.cpp +++ b/app/src/UI/Widgets/Terminal.cpp @@ -86,7 +86,7 @@ Widgets::Terminal::Terminal(QQuickItem *parent) setAcceptedMouseButtons(Qt::AllButtons); // Set performance hints - setMipmap(true); + setMipmap(false); setOpaquePainting(true); // Set font @@ -159,9 +159,13 @@ Widgets::Terminal::Terminal(QQuickItem *parent) void Widgets::Terminal::paint(QPainter *painter) { // Skip if item is not visible - if (!isVisible()) + if (!isVisible() || !painter) return; + // Set painter flags + painter->setRenderHint(QPainter::Antialiasing, true); + painter->setRenderHint(QPainter::TextAntialiasing, true); + // Set font and prepare painter painter->setFont(m_font); int lineHeight = m_cHeight; @@ -626,6 +630,9 @@ void Widgets::Terminal::setFont(const QFont &font) // Update font m_font = font; + // Ensure that antialiasing is enabled + m_font.setStyleStrategy(QFont::PreferAntialias); + // Get size of font (in pixels) auto metrics = QFontMetrics(font);