Notes on staff with no/narrow key signature can overlap key signature on other staves

• May 30, 2019 - 19:34
Reported version
3.1
Priority
P2 - Medium
Type
Functional
Frequency
Once
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

I'm filing this to have a record of why I'm making a particular change that isn't technically necessary in order to fix #289933: Layout shift in measure at start of system. As I (eventually) explain in that thread, there are really two separate problems that each contribute to that problem, and fixing either would be sufficient to solve the issue it. But in testing the second fix (better handling of space calculation between key signature and measure rest), I realized there was another benefit of making the change, as it also addresses another layout issue:

1) score for flute and snare drum, C# major (7 sharps)
2) second system, first measure beat 1: enter a note in each staff
3) use the Inspector to increase the X offset for the flute note

Result: rather than the note moving to the right, the snare note moves left, sneaking under the flute key signature:

key-encroachment.png

This shouldn't really happen unless you explicitly move the snare note. The reason it does is that we don't really enforce that the first note or rest for each staff should default to starting after the end of the widest staff header. Instead, we process the staves one at a time in Segment::minHorizontalDistance and just trust that taking the max of the distances for each staff shape will do that job. This only works if all staves have something right there at the beginning of the first chord rest segment. Full measure rests that have already been centered by a previous layout operation were breaking this in #289933: Layout shift in measure at start of system, but here we see a manual offset applied to a note doing the same.


Comments

Fix version
3.2.0