From 308cbb3ee8e112e44aea791b9b9eaf956d7d408e Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 12 Apr 2024 20:18:06 +0800 Subject: [PATCH] - change: Turn off font hinting. --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 2 ++ RedPandaIDE/mainwindow.cpp | 2 ++ RedPandaIDE/mainwindow.ui | 2 +- RedPandaIDE/widgets/cpudialog.cpp | 2 ++ libs/qsynedit/qsynedit/qsynedit.cpp | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 5ed6addd..24e452e1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -138,6 +138,7 @@ Red Panda C++ Version 2.27 - enhancement: Auto hide Project menu if no project openning. - fix: Toggle breakpoint by shortcut may use wrong line. - fix: Size of the icons in problem and problem set panel are not correct. + - change: Turn off font hinting. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index ab73f887..fe77d53c 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -5346,6 +5346,7 @@ void Editor::applySettings() f.setFamilies(pSettings->editor().fontFamiliesWithControlFont()); f.setPixelSize(pointToPixel(pSettings->editor().fontSize())); f.setStyleStrategy(QFont::PreferAntialias); + f.setHintingPreference(QFont::PreferNoHinting); setFont(f); // QFont f=QFont(pSettings->editor().fontName()); @@ -5371,6 +5372,7 @@ void Editor::applySettings() f.setPixelSize(pointToPixel(pSettings->editor().fontSize())); } f.setStyleStrategy(QFont::PreferAntialias); + f.setHintingPreference(QFont::PreferNoHinting); gutter().setFont(f); gutter().setDigitCount(pSettings->editor().gutterDigitsCount()); gutter().setVisible(pSettings->editor().gutterVisible()); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index ea15177f..98435af9 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1031,6 +1031,7 @@ void MainWindow::applySettings() QFont font(pSettings->environment().interfaceFont()); font.setPixelSize(pointToPixel(pSettings->environment().interfaceFontSize())); font.setStyleStrategy(QFont::PreferAntialias); + font.setHintingPreference(QFont::PreferNoHinting); qApp->setFont(font); this->setFont(font); for (QWidget* p:findChildren()) { @@ -1052,6 +1053,7 @@ void MainWindow::applySettings() QFont caseEditorFont(pSettings->executor().caseEditorFontName()); caseEditorFont.setPixelSize(pointToPixel(pSettings->executor().caseEditorFontSize())); font.setStyleStrategy(QFont::PreferAntialias); + font.setHintingPreference(QFont::PreferNoHinting); ui->txtProblemCaseInput->setFont(caseEditorFont); ui->lblProblemCaseInput->setFont(caseEditorFont); ui->txtProblemCaseOutput->setFont(caseEditorFont); diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 330aa690..03365a58 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -6,7 +6,7 @@ 0 0 - 955 + 936 619 diff --git a/RedPandaIDE/widgets/cpudialog.cpp b/RedPandaIDE/widgets/cpudialog.cpp index 42ada22c..c583560b 100644 --- a/RedPandaIDE/widgets/cpudialog.cpp +++ b/RedPandaIDE/widgets/cpudialog.cpp @@ -104,6 +104,7 @@ void CPUDialog::updateDPI(float dpi) QFont font(pSettings->environment().interfaceFont()); font.setPixelSize(pointToPixel(pSettings->environment().interfaceFontSize(),dpi)); font.setStyleStrategy(QFont::PreferAntialias); + font.setHintingPreference(QFont::PreferNoHinting); setFont(font); for (QWidget* p:findChildren()) { if (p!=ui->txtCode) @@ -151,6 +152,7 @@ void CPUDialog::resetEditorFont(float dpi) f.setFamilies(pSettings->editor().fontFamiliesWithControlFont()); f.setPixelSize(pointToPixel(pSettings->editor().fontSize(),dpi)); f.setStyleStrategy(QFont::PreferAntialias); + f.setHintingPreference(QFont::PreferNoHinting); ui->txtCode->setFont(f); } diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index b1cda448..d3363133 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -61,6 +61,7 @@ QSynEdit::QSynEdit(QWidget *parent) : QAbstractScrollArea(parent), mPaintLock = 0; mFontDummy = QFont("monospace",14); mFontDummy.setStyleStrategy(QFont::PreferAntialias); + mFontDummy.setHintingPreference(QFont::PreferNoHinting); mDocument = std::make_shared(mFontDummy, this); mMouseMoved = false;