Extra whitespace around flat symbol in chords when using custom fonts

• Oct 14, 2019 - 07:44
Reported version
3.0
Type
Functional
Frequency
Few
Severity
S4 - Minor
Reproducibility
Always
Status
active
Regression
No
Workaround
Yes
Project

When I change the font of a chord from the default FreeSerif font to almost any another font (FreeSans being a notable exception), flat symbols in chords are rendered with extra whitespace on either side.

Steps to reproduce:

  1. Select a note and press Ctrl+K to enter a chord.
  2. Type in a chord that contains a flat symbol, such as “Bbm” (for B♭m).
  3. In the Inspector, change the chord's font to something else, such as Times New Roman.
  4. Observe that the flat symbol now has extra whitespace on either side.

Bbm.png

I've briefly played with the various XML files in the styles folder (such as chords.xml and chords_std.xml), but can't figure out how to fix or even work around this problem.

It's worth noting that this problem does not occur with sharp symbols in chords.

Version information: OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit): 3.3.0.8529, revision: 2e7a18c


Comments

Not much we can do about that, those fonts are out of MuseScore's control. Those fonts simply have bad kerning infos for these flat symbols

Workaround No Yes

Workaround is of course not to use those but stick with FreeSerif/FreeSans, that's why MuseScore provides them in the first place.

In MuseScore 1 I worked around that issue via those xml files in the styles folder, I believe via this:

  <renderRoot>:n m:1:-1 :a m:0:1</renderRoot>
  <renderBase>m:0:2 / :n m:1:-1 :a</renderBase>
Attachment Size
jojochords.xml 12.86 KB

In reply to by Jojo-Schmitz

I don't think that's true. Times New Roman and Arial don't even contain a glyph for the flat symbol. (I just double-checked both of them using a font editor: neither contains an entry for Unicode code point U+266D.) Consequently they don't contain any kerning pairs involving that glyph.

It appears that the “B♭m” that MuseScore displays when a font doesn't contain a glyph for the flat symbol is created by inserting the “♭” glyph from some fallback font that I can't identify. Because there are never any kerning pairs available when concatenating glyphs from different fonts, this problem can't be caused by bad kerning info.

If we can figure out what this fallback font is, maybe we take a look at its metrics and figure out why the layout is being calculated so badly. In the meantime I'll look at your suggested workaround; thanks.

Well possible, I never went that deep into it. I believe for Windows that fallback font might be "MS Shell Dlg 2"?

Edit: no, that font doesn't have that glyph either. (it is the fallbackfonf for unknown/unavailable fonts though)

BTW: "Arial Unicode MS" gets it right (as does "Malgun Gothic", "MS Reference Sans Serif", "Segoe UI Symbol"), not just FreeSerif and FreeSans, Bravura Text and the other fonts MuseScore provides (except "MScoreBC", "MScoreTabulature")

Also interesting: it seems to work just fine for a double b (“Bbbm”) and double sharp ("Bxm" or "B##m") and also natural ("Bnatural m"). And of course for # too, so only flat is having this issue

I'm not sure what the fallback font is either, and likely it would different from system to system. So the lesson is - don't use fonts for chord symbols that don't actually contain the necessary glyphs (this includes the accidentals but also the symbols for diminished and half-diminished, triangle for major, etc). It's possible to hack around and fix individual problems here and there, but realistically, that bottom line is going to remain good advice.

BTW, kerning isn't directly used in chord symbol rendering, it's all done character by character. Although we can't stop the underlying system doing additional kerning if it detects an opportunity.

In reply to by Marc Sabatella

For Mac - We are using a default called ヒラギノ角ゴシック W3. And (I believe) the default is MS Gothic for Windows. Can we override these defaults, so that we use Bravura Text or Emmentaler Text? I've tested the spacing on the mac font and it's excessively wide. Clearly not built for use in actual notation or to be displayed alongside text. If we could use another default, it would likely look a lot better.

In the image attached, you can see that the flat symbol in Bravura text (using the same unicode) is much narrower. I imagine this is true of the other text alternatives too.

Incidentally, although I prefer Bravura for notation. I'm not as big a fan of how it looks with other fonts. Perhaps Emmenaler Text instead?

Link to "ヒラギノ角ゴシック W3"
https://translate.google.com/translate?hl=en&sl=ja&u=https://www.morisa…

Attachment Size
Font_Default.jpg 259.13 KB
Reported version 3.3 3.4

Still happens in: OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit): 3.4.2.9788, revision: 148e43f

I'm planning to investigate this further and come up with a fix if possible.

Use a font that looks good, like Free Serif or Edwin
And complain to the authors/owners of that bad looking fonts
Or use the workaround I've provided way above

I just made a list of fonts on my system that had decent kerning for chord symbols:

Andale Mono
Apple Braille
Apple SD Gothic Neo
Arial Unicode MS
Consolas
Courier
Courier New
Edwin
Finale Broadway
Finale Maestro
FreeSans
FreeSerif
Helvetica Neue
MScore
SF Pro

I personally liked Helvetica Neue best; in addition to the kerning, the actual letterform of the flat symbol was clear and quintessential.

Of these the following should be preferred, as they are guaranteed to be available with MuseScore:

Edwin
Finale Broadway
Finale Maestro
FreeSans
FreeSerif
MScore