-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #280244 : [Workaround] User fonts not visible to MuseScore 3 (Windows 10) #6084
Conversation
As @Jojo-Schmitz correctly points out, this could probably not work well if duplicates are present. However, in that case it was the user responsibility for locally installing a font with the same name of a font already installd in the system folder (if Windows allows this at all). Note that the same workaround is also done by Inkscape (e.g. https://gitlab.com/inkscape/inkscape/-/commit/a456169068e7a1ca8715860715fbe912d6cf7fa5 ) |
Well, I was not talking about fonts installed twice, for system and for user, but for systems pre Windows 10 1809, which see both sort of fonts by default and without the workaround already, and my question was whether these now seem them twice, once by default and a 2nd time due to the workaround. |
Ah sorry, I misunderstood your comments. 😅 |
Do we have someone that can test the possible duplication? |
I tested with two different fonts that I modified with FontForge so that they have the exact same name (including internal names). I then installed one in the user folder and one in the system folder.
Therefore in presence of a duplicate font (where the two copies have the exact same name, including the internal names) MuseScore with this PR behaves like MuseScore 2.3.2, MS Word 2010 and LibreOffice 6.4.3.2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from this one small correction, this PR looks good to me.
I want to point out, however, that this is only a partial workaround. As I explained in this comment:
That workaround works only if the user has direct access to the font files.
In some cases the user does not have access to the font files. One popular example is the Adobe Fonts service, which is one of the benefits of an Adobe Creative Cloud subscription. Another popular example is SkyFonts, which is used by several large font providers, including Google Fonts. Fonts installed via services like these are usable in applications that use native Windows APIs for font handling, but the files themselves (e.g.,
.ttf
and.otf
files) are protected behind a DRM layer. This means that third-party font renderers, such as FreeType, cannot access them at all (and cannot even enumerate them). The only workaround for such fonts is to disable FreeType in MuseScore in favor of native Windows APIs.
In short, this workaround will fix fonts that are missing because they were installed per-user, but not fonts that are missing because they're DRM-protected.
The only way to fix the latter is to use native font rendering instead of FreeType. But that would make MuseScore's visual output different on Windows from other platforms, which would in turn break vtests
under Windows.
In principle, we could return to using the native Windows Qt font engine, but I don't know if it behaves properly for those DRM-layered fonts. Moreover, it would reintroduce a bug for underlined words ( https://musescore.org/en/node/276566 ) and possibly hyphen position. |
I just did a quick test with several DRM-protected Adobe fonts (by setting the Qt renderer back to BTW, I want to be clear that I'm not at all suggesting that we change the default font renderer as part of this PR. (This PR is good as it is.) I'm just requesting that we consider this PR to be only part of the full solution. And now that I've learned that we actually used to use the native font renderer under Windows (as recently as 2018), and that we switched to FreeType to work around some bugs, I'm suggesting that we investigate the possibility of going back to it because of this issue. I guess it would make the most sense to consider this PR to be a full fix specifically for the “user fonts” issue, and to open another issue for “DRM-protected fonts” — even though both issues are fixable by switching back to native rendering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good working fix for the “missing user fonts” issue. We can consider the “missing DRM-protected fonts” issue a separate one to be addressed later.
No need for master since we will probably use Qt 5.12 LTS version there. |
Maybe even Qt 5.15 LTS? |
Resolves: https://musescore.org/en/node/280244
Because of QTBUG-73241 ( https://bugreports.qt.io/browse/QTBUG-73241 ), when using freetype engine under Windows 10 (after update 1809), fonts installed in the user-specific folder C:\Users\UserName\AppData\Local\Microsoft\Windows\Fonts cannot be found by Qt. This is solved for Qt 5.12.2. However, current MuseScore build still uses Qt 5.9.
This is a workaround to add those user-specific fonts to the application.