Shortening notes too much leads to bad stem layout

• Oct 29, 2018 - 09:44
Reported version
3.0
Type
Functional
Severity
S4 - Minor
Status
closed
Regression
No
Workaround
No
Project

Steps to reproduce:
1) Create a score
2) Enter a quarter note
3) Press Q (half note duration) 6 times.
Result: stem looks bad:
Screenshot_20181029_114312.png

Not sure which of these is the bug: that stem layout or the fact that MuseScore allows shortening notes so much but some of these is probably a bug.
After pressing Q five times all looks great.

OS: Debian GNU/Linux 9 (stretch), Arch.: x86_64, MuseScore version (64-bit): 3.0.0, revision: 64d3653


Comments

The code for adjusting the length of a stem to accommodate multiple flags does not do anything in the case of 6 or more flags. The switch statement in Chord::defaultStemLength() can be replaced with this generic formula

            if (hookIdx > 2)
                  normalStemLen += (hookIdx - 2) * (small() ? .5 : .75);

This produces fairly good results for fonts other than Emmentaler, which probably needs to be special-cased. But if there are more than 5 flags, the fallback font Bravura is used instead of Emmentaler. I will try to come up with a good formula for the Emmentaler font.