diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp
index 45e4cb03..ac2c7bdd 100644
--- a/RedPandaIDE/editor.cpp
+++ b/RedPandaIDE/editor.cpp
@@ -5285,15 +5285,8 @@ void Editor::applySettings()
codeFolding().indentGuidesColor = pSettings->editor().indentLineColor();
codeFolding().fillIndents = pSettings->editor().fillIndents();
- QStringList fontFamilies{
- pSettings->editor().fontName(),
- pSettings->editor().fallbackFontName(),
- pSettings->editor().fallbackFontName2(),
- pSettings->editor().fallbackFontName3(),
- };
-
QFont f=QFont();
- f.setFamilies(fontFamilies);
+ f.setFamilies(pSettings->editor().fontFamilies());
f.setPixelSize(pointToPixel(pSettings->editor().fontSize()));
f.setStyleStrategy(QFont::PreferAntialias);
setFont(f);
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp
index d5a750c6..2c2144e5 100644
--- a/RedPandaIDE/settings.cpp
+++ b/RedPandaIDE/settings.cpp
@@ -697,7 +697,34 @@ void Settings::Editor::setFallbackFontName3(const QString &newFontName)
mFallbackFontName3 = newFontName;
}
+bool Settings::Editor::useFallbackFont2() const {
+ return mUseFallbackFont2;
+}
+void Settings::Editor::setUseFallbackFont2(bool useFont) {
+ mUseFallbackFont2 = useFont;
+}
+
+bool Settings::Editor::useFallbackFont3() const {
+ return mUseFallbackFont3;
+}
+
+void Settings::Editor::setUseFallbackFont3(bool useFont) {
+ mUseFallbackFont3 = useFont;
+}
+
+QStringList Settings::Editor::fontFamilies() const
+{
+ QStringList result {
+ mFontName,
+ mFallbackFontName,
+ };
+ if (mUseFallbackFont2)
+ result.append(mFallbackFontName2);
+ if (mUseFallbackFont3)
+ result.append(mFallbackFontName3);
+ return result;
+}
int Settings::Editor::mouseSelectionScrollSpeed() const
{
@@ -1373,6 +1400,9 @@ void Settings::Editor::doSave()
saveValue("fallback_font_name", mFallbackFontName);
saveValue("fallback_font_name2", mFallbackFontName2);
saveValue("fallback_font_name3", mFallbackFontName3);
+ saveValue("use_fallback_font2", mUseFallbackFont2);
+ saveValue("use_fallback_font3", mUseFallbackFont3);
+
saveValue("font_size", mFontSize);
saveValue("font_only_monospaced", mFontOnlyMonospaced);
saveValue("line_spacing",mLineSpacing);
@@ -1518,6 +1548,8 @@ void Settings::Editor::doLoad()
mFallbackFontName = stringValue("fallback_font_name",defaultCjkFontName);
mFallbackFontName2 = stringValue("fallback_font_name2",DEFAULT_MONO_FONT);
mFallbackFontName3 = stringValue("fallback_font_name3",DEFAULT_MONO_FONT);
+ mUseFallbackFont2 = boolValue("use_fallback_font2", false);
+ mUseFallbackFont3 = boolValue("use_fallback_font3", false);
mFontSize = intValue("font_size",12);
mFontOnlyMonospaced = boolValue("font_only_monospaced",true);
mLineSpacing = doubleValue("line_spacing",1.1);
diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h
index ae92007f..ed225df1 100644
--- a/RedPandaIDE/settings.h
+++ b/RedPandaIDE/settings.h
@@ -364,6 +364,14 @@ public:
const QString &fallbackFontName3() const;
void setFallbackFontName3(const QString &newFontName);
+ bool useFallbackFont2() const;
+ void setUseFallbackFont2(bool useFont);
+
+ bool useFallbackFont3() const;
+ void setUseFallbackFont3(bool useFont);
+
+ QStringList fontFamilies() const;
+
int mouseSelectionScrollSpeed() const;
void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed);
@@ -456,6 +464,8 @@ public:
QString mFallbackFontName;
QString mFallbackFontName2;
QString mFallbackFontName3;
+ bool mUseFallbackFont2;
+ bool mUseFallbackFont3;
int mFontSize;
bool mFontOnlyMonospaced;
double mLineSpacing;
diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.cpp b/RedPandaIDE/settingsdialog/editorfontwidget.cpp
index 66a1f6b9..ced4bda2 100644
--- a/RedPandaIDE/settingsdialog/editorfontwidget.cpp
+++ b/RedPandaIDE/settingsdialog/editorfontwidget.cpp
@@ -24,6 +24,10 @@ EditorFontWidget::EditorFontWidget(const QString& name, const QString& group, QW
ui(new Ui::EditorFontWidget)
{
ui->setupUi(this);
+ connect(ui->chkFallbackFont2, &QCheckBox::stateChanged,
+ this, &EditorFontWidget::onFallbackFontsCheckStateChanged);
+ connect(ui->chkFallbackFont3, &QCheckBox::stateChanged,
+ this, &EditorFontWidget::onFallbackFontsCheckStateChanged);
}
EditorFontWidget::~EditorFontWidget()
@@ -59,6 +63,9 @@ void EditorFontWidget::doLoad()
ui->cbFallbackFont->setCurrentFont(QFont(pSettings->editor().fallbackFontName()));
ui->cbFallbackFont2->setCurrentFont(QFont(pSettings->editor().fallbackFontName2()));
ui->cbFallbackFont3->setCurrentFont(QFont(pSettings->editor().fallbackFontName3()));
+ ui->chkFallbackFont2->setChecked(pSettings->editor().useFallbackFont2());
+ ui->chkFallbackFont3->setChecked(pSettings->editor().useFallbackFont3());
+
ui->spinFontSize->setValue(pSettings->editor().fontSize());
ui->spinLineSpacing->setValue(pSettings->editor().lineSpacing());
ui->chkLigature->setChecked(pSettings->editor().enableLigaturesSupport());
@@ -89,6 +96,8 @@ void EditorFontWidget::doSave()
pSettings->editor().setFallbackFontName(ui->cbFallbackFont->currentFont().family());
pSettings->editor().setFallbackFontName2(ui->cbFallbackFont2->currentFont().family());
pSettings->editor().setFallbackFontName3(ui->cbFallbackFont3->currentFont().family());
+ pSettings->editor().setUseFallbackFont2(ui->chkFallbackFont2->isChecked());
+ pSettings->editor().setUseFallbackFont3(ui->chkFallbackFont3->isChecked());
pSettings->editor().setFontSize(ui->spinFontSize->value());
pSettings->editor().setLineSpacing(ui->spinLineSpacing->value());
@@ -114,3 +123,10 @@ void EditorFontWidget::doSave()
pSettings->editor().save();
pMainWindow->updateEditorSettings();
}
+
+void EditorFontWidget::onFallbackFontsCheckStateChanged()
+{
+ ui->cbFallbackFont2->setEnabled(ui->chkFallbackFont2->isChecked());
+ ui->cbFallbackFont3->setEnabled(ui->chkFallbackFont3->isChecked());
+}
+
diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.h b/RedPandaIDE/settingsdialog/editorfontwidget.h
index 15cd5833..8b9cf5a2 100644
--- a/RedPandaIDE/settingsdialog/editorfontwidget.h
+++ b/RedPandaIDE/settingsdialog/editorfontwidget.h
@@ -27,13 +27,13 @@ class EditorFontWidget;
class EditorFontWidget : public SettingsWidget
{
Q_OBJECT
-
public:
explicit EditorFontWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
~EditorFontWidget();
private slots:
+ void onFallbackFontsCheckStateChanged();
void on_chkOnlyMonospacedFonts_stateChanged(int arg1);
void on_chkGutterOnlyMonospacedFonts_stateChanged(int arg1);
diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.ui b/RedPandaIDE/settingsdialog/editorfontwidget.ui
index 80f3968d..79f4b7f2 100644
--- a/RedPandaIDE/settingsdialog/editorfontwidget.ui
+++ b/RedPandaIDE/settingsdialog/editorfontwidget.ui
@@ -7,7 +7,7 @@
0
0
876
- 713
+ 781
@@ -156,13 +156,6 @@
- -
-
-
- Fallback Font 2:
-
-
-
-
@@ -249,15 +242,8 @@
- -
-
-
- Fallback Font 3:
-
-
-
-
-
+
0
@@ -272,7 +258,11 @@
0
-
-
+
+
+ false
+
+
-
@@ -298,7 +288,7 @@
-
-
+
0
@@ -313,7 +303,11 @@
0
-
-
+
+
+ false
+
+
-
@@ -338,6 +332,20 @@
+ -
+
+
+ Fallback Font 2:
+
+
+
+ -
+
+
+ Fallback Font 3:
+
+
+
diff --git a/RedPandaIDE/widgets/cpudialog.cpp b/RedPandaIDE/widgets/cpudialog.cpp
index 0a27a6bf..f366bcc0 100644
--- a/RedPandaIDE/widgets/cpudialog.cpp
+++ b/RedPandaIDE/widgets/cpudialog.cpp
@@ -144,13 +144,7 @@ void CPUDialog::resetEditorFont(float dpi)
{
QFont f=QFont();
- f.setFamilies(
- QStringList{
- pSettings->editor().fontName(),
- pSettings->editor().fallbackFontName(),
- pSettings->editor().fallbackFontName2(),
- pSettings->editor().fallbackFontName3(),
- });
+ f.setFamilies(pSettings->editor().fontFamilies());
f.setPixelSize(pointToPixel(pSettings->editor().fontSize(),dpi));
f.setStyleStrategy(QFont::PreferAntialias);
ui->txtCode->setFont(f);