From 45d22e3f0d3ed2e673878ef12b1745b911ebad73 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 25 Jun 2026 11:38:42 +0100 Subject: [PATCH] Set font size properly on scintilla editors --- qrenderdoc/Windows/CommentView.cpp | 1 + qrenderdoc/Windows/PythonShell.cpp | 16 ++++++++++------ qrenderdoc/Windows/PythonShell.h | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/qrenderdoc/Windows/CommentView.cpp b/qrenderdoc/Windows/CommentView.cpp index 5a3b49e54..41f24a45c 100644 --- a/qrenderdoc/Windows/CommentView.cpp +++ b/qrenderdoc/Windows/CommentView.cpp @@ -41,6 +41,7 @@ CommentView::CommentView(ICaptureContext &ctx, QWidget *parent) m_commentsEditor = new ScintillaEdit(this); m_commentsEditor->styleSetFont(STYLE_DEFAULT, Formatter::FixedFont().family().toUtf8().data()); + m_commentsEditor->styleSetSize(STYLE_DEFAULT, Formatter::FixedFont().pointSize()); m_commentsEditor->setTabWidth(4); m_commentsEditor->setWrapMode(SC_WRAP_WORD); diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp index 1aa6e7dda..7c989e12c 100644 --- a/qrenderdoc/Windows/PythonShell.cpp +++ b/qrenderdoc/Windows/PythonShell.cpp @@ -181,9 +181,11 @@ PythonShell::PythonShell(ICaptureContext &ctx, QWidget *parent) m_FindResults = new ScintillaEdit(this); m_FindResults->styleSetFont(STYLE_DEFAULT, Formatter::FixedFont().family().toUtf8().data()); - m_FindResults->styleSetFont(100, Formatter::FixedFont().family().toUtf8().data()); - m_FindResults->styleSetBack( - 100, IsDarkTheme() ? SCINTILLA_COLOUR(175, 70, 70) : SCINTILLA_COLOUR(255, 150, 150)); + m_FindResults->styleSetSize(STYLE_DEFAULT, Formatter::FixedFont().pointSize()); + m_FindResults->styleSetFont(STYLE_ERROR, Formatter::FixedFont().family().toUtf8().data()); + m_FindResults->styleSetSize(STYLE_ERROR, Formatter::FixedFont().pointSize()); + m_FindResults->styleSetBack(STYLE_ERROR, IsDarkTheme() ? SCINTILLA_COLOUR(175, 70, 70) + : SCINTILLA_COLOUR(255, 150, 150)); ConfigureSyntax(m_FindResults, SCLEX_NULL); m_FindResults->usePopUp(SC_POPUP_NEVER); @@ -494,7 +496,7 @@ void PythonShell::doSyntaxCheck() editor->annotationSetText(parseError.lineno - 1, parseError.errStr.c_str()); editor->annotationSetVisible(ANNOTATION_BOXED); - editor->annotationSetStyle(parseError.lineno - 1, 100); + editor->annotationSetStyle(parseError.lineno - 1, STYLE_ERROR); } } @@ -667,9 +669,11 @@ ScintillaEdit *PythonShell::makeEditor(rdcstr filename) m_FindReplace->configureFindIndicator(editor); editor->styleSetFont(STYLE_DEFAULT, Formatter::FixedFont().family().toUtf8().data()); - editor->styleSetFont(100, Formatter::FixedFont().family().toUtf8().data()); + editor->styleSetSize(STYLE_DEFAULT, Formatter::FixedFont().pointSize()); + editor->styleSetFont(STYLE_ERROR, Formatter::FixedFont().family().toUtf8().data()); + editor->styleSetSize(STYLE_ERROR, Formatter::FixedFont().pointSize()); editor->styleSetBack( - 100, IsDarkTheme() ? SCINTILLA_COLOUR(175, 70, 70) : SCINTILLA_COLOUR(255, 150, 150)); + STYLE_ERROR, IsDarkTheme() ? SCINTILLA_COLOUR(175, 70, 70) : SCINTILLA_COLOUR(255, 150, 150)); editor->setMarginLeft(4.0); editor->setMarginWidthN(0, 32.0); diff --git a/qrenderdoc/Windows/PythonShell.h b/qrenderdoc/Windows/PythonShell.h index 77afe0ee6..7727acc02 100644 --- a/qrenderdoc/Windows/PythonShell.h +++ b/qrenderdoc/Windows/PythonShell.h @@ -159,6 +159,7 @@ private: int m_InteractiveCompletionPrefix = 0; static const int CURRENT_MARKER = 0; + static const int STYLE_ERROR = 100; bool m_CurLineDirty = false; int m_CurLine = 0;