diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index ba4d232c..d5a750c6 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -677,6 +677,28 @@ void Settings::Editor::setFallbackFontName(const QString &newFontName) mFallbackFontName = newFontName; } +const QString &Settings::Editor::fallbackFontName2() const +{ + return mFallbackFontName2; +} + +void Settings::Editor::setFallbackFontName2(const QString &newFontName) +{ + mFallbackFontName2 = newFontName; +} + +const QString &Settings::Editor::fallbackFontName3() const +{ + return mFallbackFontName3; +} + +void Settings::Editor::setFallbackFontName3(const QString &newFontName) +{ + mFallbackFontName3 = newFontName; +} + + + int Settings::Editor::mouseSelectionScrollSpeed() const { return mMouseSelectionScrollSpeed; @@ -1349,6 +1371,8 @@ void Settings::Editor::doSave() //font saveValue("font_name", mFontName); saveValue("fallback_font_name", mFallbackFontName); + saveValue("fallback_font_name2", mFallbackFontName2); + saveValue("fallback_font_name3", mFallbackFontName3); saveValue("font_size", mFontSize); saveValue("font_only_monospaced", mFontOnlyMonospaced); saveValue("line_spacing",mLineSpacing); @@ -1492,6 +1516,8 @@ void Settings::Editor::doLoad() else if (defaultLocaleName == "zh_CN") defaultCjkFontName = CJK_MONO_FONT_SC; mFallbackFontName = stringValue("fallback_font_name",defaultCjkFontName); + mFallbackFontName2 = stringValue("fallback_font_name2",DEFAULT_MONO_FONT); + mFallbackFontName3 = stringValue("fallback_font_name3",DEFAULT_MONO_FONT); 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 32c46cb7..ae92007f 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -356,7 +356,13 @@ public: void setEnableLigaturesSupport(bool newEnableLigaturesSupport); const QString &fallbackFontName() const; - void setFallbackFontName(const QString &newNonAsciiFontName); + void setFallbackFontName(const QString &newFontName); + + const QString &fallbackFontName2() const; + void setFallbackFontName2(const QString &newFontName); + + const QString &fallbackFontName3() const; + void setFallbackFontName3(const QString &newFontName); int mouseSelectionScrollSpeed() const; void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed); @@ -448,6 +454,8 @@ public: //font QString mFontName; QString mFallbackFontName; + QString mFallbackFontName2; + QString mFallbackFontName3; int mFontSize; bool mFontOnlyMonospaced; double mLineSpacing; diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.cpp b/RedPandaIDE/settingsdialog/editorfontwidget.cpp index 49437b8f..66a1f6b9 100644 --- a/RedPandaIDE/settingsdialog/editorfontwidget.cpp +++ b/RedPandaIDE/settingsdialog/editorfontwidget.cpp @@ -57,6 +57,8 @@ void EditorFontWidget::doLoad() ui->chkOnlyMonospacedFonts->setChecked(pSettings->editor().fontOnlyMonospaced()); ui->cbFont->setCurrentFont(QFont(pSettings->editor().fontName())); ui->cbFallbackFont->setCurrentFont(QFont(pSettings->editor().fallbackFontName())); + ui->cbFallbackFont2->setCurrentFont(QFont(pSettings->editor().fallbackFontName2())); + ui->cbFallbackFont3->setCurrentFont(QFont(pSettings->editor().fallbackFontName3())); ui->spinFontSize->setValue(pSettings->editor().fontSize()); ui->spinLineSpacing->setValue(pSettings->editor().lineSpacing()); ui->chkLigature->setChecked(pSettings->editor().enableLigaturesSupport()); @@ -85,6 +87,8 @@ void EditorFontWidget::doSave() pSettings->editor().setFontOnlyMonospaced(ui->chkOnlyMonospacedFonts->isChecked()); pSettings->editor().setFontName(ui->cbFont->currentFont().family()); pSettings->editor().setFallbackFontName(ui->cbFallbackFont->currentFont().family()); + pSettings->editor().setFallbackFontName2(ui->cbFallbackFont2->currentFont().family()); + pSettings->editor().setFallbackFontName3(ui->cbFallbackFont3->currentFont().family()); pSettings->editor().setFontSize(ui->spinFontSize->value()); pSettings->editor().setLineSpacing(ui->spinLineSpacing->value()); diff --git a/RedPandaIDE/settingsdialog/editorfontwidget.ui b/RedPandaIDE/settingsdialog/editorfontwidget.ui index 214f5684..80f3968d 100644 --- a/RedPandaIDE/settingsdialog/editorfontwidget.ui +++ b/RedPandaIDE/settingsdialog/editorfontwidget.ui @@ -23,160 +23,20 @@ 11 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - false - - - QComboBox::AdjustToContents - - - - - - - *Needs restart - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1.000000000000000 - - - 3.000000000000000 - - - 0.100000000000000 - - - - - - - Qt::Horizontal - - - - 563 - 20 - - - - - - - - - + + - Size: + Font: - + Enable ligatures support - - - - Line Spacing: - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 2 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - @@ -228,6 +88,67 @@ + + + + Size: + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + 1.000000000000000 + + + 3.000000000000000 + + + 0.100000000000000 + + + + + + + Qt::Horizontal + + + + 563 + 20 + + + + + + + + + + + Line Spacing: + + + @@ -235,13 +156,188 @@ - - + + - Font: + Fallback Font 2: + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + QComboBox::AdjustToContents + + + + + + + *Needs restart + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 2 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Fallback Font 3: + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + *Needs restart + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + *Needs restart + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts index 9e385f4f..6caa1fd2 100644 --- a/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts +++ b/RedPandaIDE/translations/RedPandaIDE_pt_BR.ts @@ -1561,6 +1561,14 @@ *Needs restart *Necessário reiniciar + + Fallback Font 2: + + + + Fallback Font 3: + + EditorGeneralWidget diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts index fa90d7b0..b8bab14d 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_CN.ts @@ -2059,25 +2059,27 @@ p, li { white-space: pre-wrap; } 表单 - + + + *Needs restart *需要重启之后生效 - - + + Size: 大小: - - + + Font: 字体: - - + + Show only monospaced fonts 只显示等宽字体 @@ -2094,92 +2096,102 @@ p, li { white-space: pre-wrap; } 显示特殊字符 - + Enable ligatures support 启用连字(ligratures)功能 - + Line Spacing: 行高: - + Fallback Font: 备选字体: - + + Fallback Font 2: + 备选字体2: + + + + Fallback Font 3: + 备选字体3: + + + Show whitespaces 显示空白字符 - + Leading 行首 - + Inner 中间 - + Trailing 行尾 - + Line break 换行符 - + Gutter 装订线 - + Gutter is visible 显示装订线区域 - + Left Offset 左侧留白 - + Right Offset 右侧留白 - + Show Line Numbers 显示行号 - + Add leading zeros to line numbers 在行号前补齐前导0 - + Line numbers starts at zero 第一行从0开始编号 - + Auto calculate the digit count of line number 自动计算行号位数 - + Digit count 行号位数 - + Use Custom Font 使用自定义字体 @@ -9059,7 +9071,7 @@ p, li { white-space: pre-wrap; } 生成调试信息(-g3) - + Would you like Red Panda C++ to search for compilers in PATH? 您同意小熊猫C++在PATH路径中寻找gcc编译器吗? @@ -9270,7 +9282,7 @@ p, li { white-space: pre-wrap; } 只生成汇编代码(-S) - + Confirm 确认 @@ -9291,13 +9303,13 @@ p, li { white-space: pre-wrap; } 如果仍然保留这些设置,可能会导致编译错误。<br /><br />请选择“是”,除非您清楚的知道选择“否”的后果, - - + + Compiler set not configuared. 未配置编译器设置。 - + Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? 您需要小熊猫C++在下列位置搜索编译器吗:<br />%1<br />%2 @@ -9666,7 +9678,7 @@ p, li { white-space: pre-wrap; } - + Can't open file '%1' for read. @@ -9721,7 +9733,7 @@ p, li { white-space: pre-wrap; } 无法检测适用于 “%1” 的终端参数模式。 - + Error executing platform compiler hint add-on 执行平台编译器提示附加组件错误 @@ -10685,12 +10697,12 @@ p, li { white-space: pre-wrap; } Settings - + Error 错误 - + Can't find terminal program! 找不到合适的终端程序! diff --git a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts index 2ce3dcbd..fe485d38 100644 --- a/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts +++ b/RedPandaIDE/translations/RedPandaIDE_zh_TW.ts @@ -1394,6 +1394,14 @@ *Needs restart + + Fallback Font 2: + + + + Fallback Font 3: + + EditorGeneralWidget diff --git a/RedPandaIDE/widgets/cpudialog.cpp b/RedPandaIDE/widgets/cpudialog.cpp index 740886ab..0a27a6bf 100644 --- a/RedPandaIDE/widgets/cpudialog.cpp +++ b/RedPandaIDE/widgets/cpudialog.cpp @@ -147,7 +147,10 @@ void CPUDialog::resetEditorFont(float dpi) f.setFamilies( QStringList{ pSettings->editor().fontName(), - pSettings->editor().fallbackFontName()}); + pSettings->editor().fallbackFontName(), + pSettings->editor().fallbackFontName2(), + pSettings->editor().fallbackFontName3(), + }); f.setPixelSize(pointToPixel(pSettings->editor().fontSize(),dpi)); f.setStyleStrategy(QFont::PreferAntialias); ui->txtCode->setFont(f); diff --git a/libs/qsynedit/qsynedit/document.cpp b/libs/qsynedit/qsynedit/document.cpp index c96adf2d..c6a672ef 100644 --- a/libs/qsynedit/qsynedit/document.cpp +++ b/libs/qsynedit/qsynedit/document.cpp @@ -1750,7 +1750,7 @@ int Document::glyphWidth(const QString &glyph, int left, const QFontMetrics &fon if (ch == '\t') { glyphWidth = tabWidth() - left % tabWidth(); } else { - glyphWidth = fontMetrics.horizontalAdvance(ch); + glyphWidth = fontMetrics.horizontalAdvance(glyph); //qDebug()<