diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 316cbefb91..3323315d4e 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -347,6 +347,17 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) // accept drops on the window, get handled in dropEvent, dragEnterEvent setAcceptDrops(true); + + // setup font substitutions for NaviCube + // Helvetica usually gives good enough results on mac & linux + // in rare cases Helvetica matches a bad font on linux + // Nimbus Sans Narrow and Open Sans Condensed added as fallback + // Bahnschrift is a condensed font available on windows versions since 2017 + // Arial added as fallback for older version + auto substitutions = QStringLiteral("Bahnschrift,Helvetica,Nimbus Sans Narrow,Open Sans Condensed,Arial,Sans"); + auto family = QStringLiteral("FreeCAD NaviCube"); + QFont::insertSubstitutions(family, substitutions.split(QLatin1Char(','))); + statusBar()->showMessage(tr("Ready"), 2001); } diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 5f7a291b46..ee93d43116 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -325,15 +325,8 @@ void NaviCube::setBorderColor(QColor BorderColor) QString NaviCube::getDefaultSansserifFont() { - // Windows versions since 2017 have the 'Bahnschrift' font (a condensed - // sans serif font, optimized for readability despite being condensed), - // we first check for that. - QFont font(QStringLiteral("Bahnschrift")); - if (!font.exactMatch()) - // On systems without 'Bahnschrift' we check for 'Helvetica' or its closest match - // as default sans serif font. (For Windows 7 this will e.g. result in 'Arial'.) - font = QFont(QStringLiteral("Helvetica")); - + // "FreeCAD NaviCube" family susbtitutions are set in MainWindow::MainWindow + QFont font(QStringLiteral("FreeCAD NaviCube")); font.setStyleHint(QFont::SansSerif); // QFontInfo is required to get the actually matched font family return QFontInfo(font).family();