Respect font scale for fixed-width fonts

This commit is contained in:
baldurk
2021-04-12 13:04:02 +01:00
parent 34ea6529c9
commit 95e6a4a971
14 changed files with 37 additions and 29 deletions
+6
View File
@@ -2075,8 +2075,10 @@ int Formatter::m_minFigures = 2, Formatter::m_maxFigures = 5, Formatter::m_expNe
double Formatter::m_expNegValue = 0.00001; // 10^(-5)
double Formatter::m_expPosValue = 10000000.0; // 10^7
QFont *Formatter::m_Font = NULL;
QFont *Formatter::m_FixedFont = NULL;
float Formatter::m_FontBaseSize = 10.0f; // this should always be overridden below, but just in
// case let's pick a sensible value
float Formatter::m_FixedFontBaseSize = 10.0f;
QColor Formatter::m_DarkChecker, Formatter::m_LightChecker;
void Formatter::setParams(const PersistantConfig &config)
@@ -2093,6 +2095,8 @@ void Formatter::setParams(const PersistantConfig &config)
{
m_Font = new QFont();
m_FontBaseSize = QApplication::font().pointSizeF();
m_FixedFont = new QFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
m_FixedFontBaseSize = m_FixedFont->pointSizeF();
}
*m_Font =
@@ -2103,6 +2107,8 @@ void Formatter::setParams(const PersistantConfig &config)
f.setPointSizeF(m_FontBaseSize * config.Font_GlobalScale);
QApplication::setFont(f);
m_FixedFont->setPointSizeF(m_FixedFontBaseSize * config.Font_GlobalScale);
Formatter::setPalette(QApplication::palette());
}
+3 -2
View File
@@ -256,13 +256,14 @@ struct Formatter
static QString Format(int32_t i, bool hex = false) { return QString::number(i); }
static QString Format(int64_t i, bool hex = false) { return QString::number(i); }
static const QFont &PreferredFont() { return *m_Font; }
static const QFont &FixedFont() { return *m_FixedFont; }
static const QColor DarkCheckerColor() { return m_DarkChecker; }
static const QColor LightCheckerColor() { return m_LightChecker; }
private:
static int m_minFigures, m_maxFigures, m_expNegCutoff, m_expPosCutoff;
static double m_expNegValue, m_expPosValue;
static QFont *m_Font;
static float m_FontBaseSize;
static QFont *m_Font, *m_FixedFont;
static float m_FontBaseSize, m_FixedFontBaseSize;
static QColor m_DarkChecker, m_LightChecker;
};
-1
View File
@@ -245,7 +245,6 @@ void ConfigureSyntax(ScintillaEdit *scintilla, int language)
}
scintilla->setLexer(language);
scintilla->styleSetSize(STYLE_DEFAULT, 10);
#define SC_COL(qcol) SCINTILLA_COLOUR(qcol.red(), qcol.green(), qcol.blue())