Misalignment of shared note heads in a multivoices context and a whole note involved

• Mar 13, 2016 - 15:03
Reported version
S3 - Major

GIT commit: 5e75f57 / Windows 10

First reported here (with comments): https://musescore.org/en/node/101326

1) "My First Score"
2) Enter a quarter note in Voice 1
3) Enter two eighth notes in Voice2: the first one must share its note head with the quarter note.
4) Enter a whole note in Voice 4, or open this test file (with steps): note heads.mscz

Result: the shared note heads are not aligned

Other examples in images:


I'm looking at this. It's pretty easy to fix this case, but harder to do so without messing up other cases - like what if the whole note is in voice 3 instead of voice 4, also what if the shared notehead is a half note instead of a quarter, etc. because there is some risk of this, and also because a fix would break existing scores that are using manual adjustments to work around the issue, I'm kind of thinking this is something we'll have to live with for 2.0.3. But I'm leaving a note here for myself or whomever might want to work on this for later:

The code responsible for this is in Score::layoutChords1(), in layout.cpp. This is where we do the centering adjustments. It's possible Werner's new layout code rewrites all of this, or that this would all need to be rewritten to work with it, but in the current state of the code, I think the place to add the fix would be here:


The fix I am contemplating is basically a matter of resetting centerUp, centerDown, centerAdjustUp, and/or centerAdjustDown to basically defeat (or at least adjust) the center that would otherwise happen. Depending on the exact configuration of voices, though, we might need to keep some of these adjsutments but stop others. And there is one case that has no real solution: if voice 1 & 2 have a shared quarter note and voices 2 & 4 have a shared half note, there is no way to get them *both* to share perfectly, since the noteheads are different sizes. We can make the noteheads themselves share perfectly, but either the stems will be positioned correctly for the quarter or for the half - there is no way to have both. For example, in this version, thems are correct for the quarter note head but a little off for the half note:


Perhaps we should simply refuse to share heads in this case, since there is no good solution.

Attachment Size
sharehead-300.png 1.26 KB