Option to preserve HTML when specifying instrument/part name
MuseScore already supports instrument/part names with HTML formatting, but in its infinite wisdom escapes all HTML tags them when you try to specify them on the Staff Properties dialog.
Ideally there needs to be an option to leave them in, accepting that some amount of sanitisation or verification would be required to ensure the resultant msxc/xml isn't invalid when saved (any sort of basic XML syntax validation should do). The major score I've tried typesetting uses sub- and superscript in instrument names, and this is not uncommon by any means.
In principle this could apply to any text in the score, but this was the first place I needed it.
Comments
FWIW, there is I think some limited form of HTML parsing in the instrument name dialog (e.g., the "b" tag works, just tried it). Probably just a matter of adding support for the "sup" tag too.
In reply to FWIW, there is I think some… by Marc Sabatella
Actually "sub" and "sup" should work, not sure why they don't in this case? See:
In reply to "sup" does not by Jojo-Schmitz
Wow, that's a...curious way to do it - but it should mean you can use !!sub!! and !!/sub!! - and that doesn't work either.
FWIW Visual Studio is telling me that that function is never called anywhere (and a simple find-in-files seems to verify that). Yet to try debugging any of the UI stuff (dialogs etc.) so I'll see what I can dig up...
So EditStaff::apply( ) calls
And it's Text::validateText that does the escaping, there's no checking for sub etc.
But even after changing that it still doesn't work as expected because StaffName::StaffName escapes it again!
Text::validateText(_name); // enforce HTML encoding
In reply to Wow, that's a...curious way… by Dylan Nicholson1
Ok I've worked out how to fix, but my thinking it might be better to have a flag to pass to Text::validateText to indicate whether limited HTML tags are permitted.
For now I've just changed to use Text::tagEscape (without removing the calls to validateText in EditStaff::apply(), as they obviously do something useful, but the resulting string is ignored).
Not sure if worth putting up a PR, MU4 is in a pretty weird state...
In reply to Ok I've worked out how to… by Dylan Nicholson1
Ah OK, Text::validateText has this:
then allows just those tags. I think adding sub and sup to that might be a better fix.
And it should be the same for MU4.
In reply to Ah OK, Text::validateText… by Dylan Nicholson1
See #321924: Allow sub and sup tags in instrument/part names