Skip to content

Conversation

@krasko78
Copy link
Contributor

@krasko78 krasko78 commented Dec 15, 2025

Resolves: #16555

Overview
Adds a string type property to StyledDropdown, StyledDropdownLoader and StyledDropdownView that can be set to "font" to make the drop down display the actual fonts. TextInspectorView and TextStylePopup enable this. StyledDropdownView uses the type property to choose a corresponding StyledTextLabel to render. For type "font", it is almost identical to the default one except it of course sets the font.family. I have made it also set clip to true and textFormat to Text.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:
image

Font drop down in the Text popup:
image

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.:
image
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):
image

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@Eism
Copy link
Contributor

Eism commented Dec 17, 2025

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.
The idea of ​​passing a component through is practically no different from passing a type through, so I'd still suggest creating a separate component.

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.

@krasko78 krasko78 force-pushed the 16555-FontDropdownToDisplayActualFonts branch from 8b39c02 to bbddfb2 Compare December 18, 2025 01:17
@krasko78
Copy link
Contributor Author

Thanks for the feedback @Eism! Here's what I was able to come up with.

Copy link
Contributor

@Eism Eism left a 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?

@Jojo-Schmitz
Copy link
Contributor

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.: image 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?

These fonts (Finale Broadway, Finale Maestro...) are plain musical symbol fonts, as opposed to their ...Text variants (which are musical text fonts), I'd drop them from being shown, that also seems consistent with Mu3. which does showr e.g. Bravita Text but not Bravura, Gootville Text but not Gotville/Gonville, MuseJazz Text, but not MuseJazz and MScore Text but not MScore/Emmentaler etc.

@krasko78
Copy link
Contributor Author

krasko78 commented Dec 19, 2025

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.

@krasko78
Copy link
Contributor Author

@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?
addMusicFont("Gonville", FontDataKey(u"Gootville"), ":/fonts/gootville/Gootville.otf"); in src\engraving\engravingmodule.cpp

@MarcSabatella
Copy link
Contributor

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.

@Jojo-Schmitz
Copy link
Contributor

Showing Gootville Text as Gonville (Text) would be good IMHO

@krasko78
Copy link
Contributor Author

I meant something else. "Gootville" and "Gootville Text" do appear as fonts but I cannot automatically hide "Gootville" because in the code it is named "Gonville". All those musical fonts are added in src\engraving\engravingmodule.cpp like this:

image

As you can see, "Gootville" is added with the [internal] name "Gonville". Qt adds the font as "Gootville" taking the name from the font file I believe because the font file is the only parameter we pass it. So we see "Gootville" and "Gootville Text" in the list of fonts returned by Qt.

In src\notation\internal\engravingfontscontroller.cpp the musical fonts are stored as a list in the uiConfiguration via this line: uiConfiguration()->setNonTextFonts(musicFonts);. That list is a convenient way to hide the musical fonts from the user but it contains "Gonville" instead of "Gootville" due to the above mentioned registration of "Gootville" with the name "Gonville". I am trying to find out if changing "Gonville" to "Gootville" would be a safe change.

@Jojo-Schmitz
Copy link
Contributor

I see. Maybe specialcasing Gooteville in allTextFonts() is needed

@krasko78 krasko78 changed the title Font dropdown will display the actual fonts Font dropdowns will display the actual fonts Dec 21, 2025
@krasko78
Copy link
Contributor Author

@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!

@DmitryArefiev
Copy link
Contributor

@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
Copy link
Contributor

Tested on Win10, Mac13.7.8, LinuxUbuntu24.04.3 LTS. PASS Other issues can be logged separately (if possible to fix)

@bkunda @avvvvve Please also review when you have time

@krasko78
Copy link
Contributor Author

@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?

@DmitryArefiev
Copy link
Contributor

Are these Sibelius fonts?

Yeah, they from Sibelius installation

In the meantime can you check what those fonts look like in another app, e.g. Microsoft Word?

How they look in LibreOffice:

bandicam.2025-12-22.23-11-38-716.mp4

@krasko78
Copy link
Contributor Author

krasko78 commented Dec 22, 2025

I was able to download "Opus Percussion" and reproduce it on my machine. This font does not contain the latin alphabet characters so it does not display its name. And if you try to write anything in MU in it, it won't display anything (at least not in English). I don't know what LibreOffice does and manages to display its name, but in MS Word here is what I get for "Opus Percussion":
image

With this info, I am able to check if let's say the first character of the font's name is in the font. For "Opus Percussion" this check returns false. On my machine it returns false also for "Bookshelf Symbol 7" which displays as all dots (you can see it in one of my screenshots above, just below "Bookman Old Style"). So I think I have found a way to recognize those fonts and this should help us display them in the default font (perhaps with an indicator).

@krasko78
Copy link
Contributor Author

@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?

@Eism
Copy link
Contributor

Eism commented Dec 23, 2025

@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.

@avvvvve
Copy link

avvvvve commented Dec 29, 2025

Thanks for the work on this @krasko78!

Addressing problems listed above:

  • @DmitryArefiev I can't reproduce any of the empty rows that you showed above
  • @krasko78 I see 'Gootville Text' in the list but not 'Gonville'. Is that the expected behavior that was decided on?

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:
image


And a couple ideas, both of which are nice-to-haves (FYI @bkunda):

Minimum font size

We 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:
image

16px looks like this, so perhaps we could make it the minimum size:
image

So if in Preferences > Appearance > App text, 'Body text size' is set to...

  • 10–16px, display the fonts in the dropdown as 16px
  • 17px, display the fonts as 17px
  • 18px, display the fonts as 18px

The text displayed in the un-clicked dropdown should still follow the body text size.

Symbol/ornament fonts

For 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.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Font dropdown menu should display what a font looks like.

6 participants