Skip to content

Commit

Permalink
Fix path on Windows where SMuFL expects system fonts to be
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Dec 8, 2024
1 parent de7bb02 commit 389b2c0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libmscore/sym.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6601,11 +6601,12 @@ void Ms::ScoreFont::initScoreFonts()
// Linux: "$XDG_DATA_HOME/SMuFL/Fonts", "$XDG_DATA_DIRS/SMuFL/Fonts"
// as per https://doc.qt.io/qt-5/qstandardpaths.html#standardLocations that is the (start of the) list
// which `GenericDataLocation` gives (without the "/SMuFL/Fonts")
#ifdef Q_OS_WIN
// take only the first two entries of that list on Windows (on Mac it is 2 elements only anyway)
// take only the first two entries of that list (on Windows, on Mac it is 2 elements only anyway).
QStringList systemFontsPaths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).mid(0, 2);
#else
QStringList systemFontsPaths = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
#ifdef Q_OS_WIN
// On Windows, the second standard Qt location is C:/ProgramData (%PROGRAMDATA%),
// but SMuFL wants C:/Program Files/Common Files (%COMMONPROGRAMFILES%)
systemFontsPaths[1] = qgetenv("CommonProgramFiles").replace("\\", "/"); // "C:\\Program Files\\Common Files"
#endif
for (QString& systemFontsPath : systemFontsPaths) {
systemFontsPath += "/SMuFL/Fonts";
Expand Down

0 comments on commit 389b2c0

Please sign in to comment.