-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Font dropdowns will display the actual fonts #31457
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
base: master
Are you sure you want to change the base?
Font dropdowns will display the actual fonts #31457
Conversation
|
Hey @krasko78 I actually like the subclass idea. A dropdown is like a base class and shouldn't contain specific use cases. I can imagine a use case where we want to display a dropdown with colors, then we'd have to add another component to the base class, and so on, the base class would grow. As for displaying text with different fonts, maybe we can solve this with cacheBuffer or perhaps TextMetrics/FontMetrics? I think we need to solve this problem somehow, but hiding such fonts isn't a good idea. |
8b39c02 to
bbddfb2
Compare
|
Thanks for the feedback @Eism! Here's what I was able to come up with. |
Eism
left a comment
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.
Looks good! Can you please also use FontDropdown in Preferences->Appearance?
src/framework/uicomponents/qml/Muse/UiComponents/internal/StyledDropdownLoader.qml
Outdated
Show resolved
Hide resolved
|
Changed the Font dropdown in Preferences too. This was a trickier change. I think I got it right and tested out everything but it needs a closer look. I've put the latest changes in separate commits for easier review. I'll see what I can do about hiding the musical MU fonts. I see that all those along with their " Text" versions are filtered out on the Preferences dialog. I could probably do the same for the text popup and the Font property in the Properties Panel but this would mean a breaking change because currently MU does show them. I am thinking of hiding just the non-text versions since they don't render well in the font dropdown (see my screenshots above) and leave the "Text" versions because they could be actually used by some users. |
|
@Eism @Jojo-Schmitz I pushed another commit to hide the musical fonts but not their "Text" variants. Let me know what you think. I am still having an issue with "Googtville" appearing in the font dropdowns. Looking at the code it turns out this font is defined with the name "Gonville" and that is why "Gootville" is not removed from the list. Is this something that needs to be changed or not? Jojo, I found a discussion involving the author of the font and you so maybe you will know? |
|
Personally, I'm fine with skipping the music fonts because it's almost never what the user wants. But, if we decided there was some corner case worth supporting, we could simply display those fonts in system UI font, and maybe put a special notation by them like "(notation)" or even a few music symbols like a treble clef. |
|
Showing Gootville Text as Gonville (Text) would be good IMHO |
|
I see. Maybe specialcasing Gooteville in |
src/preferences/qml/MuseScore/Preferences/internal/ComboBoxWithTitle.qml
Outdated
Show resolved
Hide resolved
|
@DmitryArefiev Can you also do a quick testing of at least a few dropdowns in Preferences? Can they be navigated to with the keyboard, open properly, another item selected in them? Also the "Show processing visualization" dropdown on the Audio & MIDI page: it is a little special because when the "Automatically process online sounds in the background" checkbox above it is checked, the drop down's list appears wider when open due to the inclusion of a long item in the list. When the checkbox is not checked, that item does not appear in th dropdown list and its width equals the width of the dropdown. If you could test this too, that'd be great! Many thanks! |
|
@krasko78 All seems to be fine. I only see some empty spaces on Win10 (2K display, 125% scaling). But this can be fixed separately, I guess? bandicam.2025-12-22.19-41-24-460.mp4 |
|
@DmitryArefiev I don't have any of those completely empty entries. I just downloaded the Reprise font from the internet and it displays fine although I cannot be sure whether it the same as yours. Are these Sibelius fonts? Let's wait for bkunda & avvvvve's opinions. In the meantime can you check what those fonts look like in another app, e.g. Microsoft Word? |
Yeah, they from Sibelius installation
How they look in LibreOffice: bandicam.2025-12-22.23-11-38-716.mp4 |
|
@Eism In this PR I added a new QML file - FontDropdown.qml. I added it to the QML_FILES section in the respective CMakeLists file. While the file is present on disk and the FontDropdown component works, I see that Qt Creator no longer sees this file as part of the project on the next launch. What am I missing? |
|
@krasko78 I think this is a problem with QtCreator, because to register a component, you only need to add it to QML_FILES. Perhaps restarting QtCreator will help. |
|
Thanks for the work on this @krasko78! Addressing problems listed above:
Not sure there's anything to be done about this, but one installed font ('Opus Big Time Std', from Sibelius) was not properly vertically centered in its row: And a couple ideas, both of which are nice-to-haves (FYI @bkunda): Minimum font sizeWe could consider implementing a minimum UI text size for the text only in the font dropdowns. At the default app text size of 12px, it's pretty difficult to read some of the font names: 16px looks like this, so perhaps we could make it the minimum size: So if in Preferences > Appearance > App text, 'Body text size' is set to...
The text displayed in the un-clicked dropdown should still follow the body text size. Symbol/ornament fontsFor fonts like Wingdings, we could have a special style of dropdown row that shows the font name in the app font on the left (so it can be read) and a sampling of its character set on the right, like LibreOffice seems to do. Feel free to work on this in a follow-up PR if you like, but for now the way we're handling it is fine, especially now that you can type any font name while the dropdown is open to move focus to it quickly.
|







Resolves: #16555
Overview
Adds a string
typeproperty toStyledDropdown,StyledDropdownLoaderandStyledDropdownViewthat can be set to "font" to make the drop down display the actual fonts.TextInspectorViewandTextStylePopupenable this.StyledDropdownViewuses thetypeproperty to choose a correspondingStyledTextLabelto render. For type "font", it is almost identical to the default one except it of course sets thefont.family. I have made it also setcliptotrueandtextFormattoText.PlainText.We could instead go with the subclass solution described by Casper in the issue. I had it implemented initially but decided to simplify it like this. The customization we need for the font is really small and with this solution both the default (non-font) scenario as well as the font scenario live in the same file next to each other. Let me know what you think.
Preview

Font drop down in Properties panel for text elements:
Font drop down in the Text popup:

Remarks

On my machine, there are a few fonts that have extra spacing at the bottom and do not render well (they are not vertically centered within the list item bounds), e.g.:
I believe all of those fonts that exhibit this behavior are followed by the same font with " Text" added to the name that does not exhibit this behavior. In the image above "FinaleBroadway" is not centered but is followed by "FinaleBroadway Text". Same for "Finale Maestro". Should we hide some fonts and if yes, based on what? Aren't these MuseScore related fonts?
In this comment it was brought up that some fonts are made up of symbols and therefore do not display their names in a legible form such as Wingdings and it was proposed to exclude them manually. Personally I am not a big fan of this approach as it hides fonts that the users may look for (and the exclusion code is too manual). I don't mind seeing a font that is only symbols even if I am not able to read its name; I am much more interested in what the font looks like than its name. The name can always be looked up by selecting the font in the drop down. If seeing the name is important, we could add tooltips to each font item. Currently tooltips only appear for truncated font names, such as this one (very few names are truncated on my machine):
