Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #302114: Wrong default GUI font under Windows
Worked around a problem in Qt that caused MuseScore to use the wrong default GUI font on Windows. Qt 5.x and below use the deprecated function GetStockObject() with DEFAULT_GUI_FONT, which returns MS Shell Dlg 2 in 8 pt. MS Shell Dlg 2 is a virtual font that maps to Tahoma, which has not been the default Windows GUI font since 2006. The correct way to determine the default GUI font is to call SystemParametersInfoW() with SPI_GETNONCLIENTMETRICS and use the returned lfMessageFont structure. On all versions of Windows from Windows Vista through Windows 10, this typically returns Segoe UI in 9 pt. This problem is slated to be fixed in Qt 6, and the code here is equivalent to the code that's already been written for Qt 6 in QWindowsFontDatabase::systemDefaultFont(). For details, see: https://bugreports.qt.io/browse/QTBUG-58610 There are two parts to this fix: 1. Override Qt's detection of the default GUI font with the correct method. This code is functionally equivalent to the code already written for Qt 6, and is implemented as a single block so that it can easily be removed in the future should MuseScore move to Qt 6. 2. Detect existing settings files that have been saved with the incorrect default GUI font, and reset the incorrect font settings so that the correct font can be picked up automatically by existing MuseScore installations. Note that this will have the side effect of making the MS Shell Dlg 2 font no longer “stick” if the user explicitly selects it. However, this is a virtual placeholder font that shouldn't be explicitly selected anyway, and any users who prefer its look can always explicitly select the actual underlying font, Tahoma.
- Loading branch information