Bad layout in part with empty key signature segment

• Aug 23, 2014 - 18:08
Type
Functional
Severity
S4 - Minor
Status
closed
Project

Ubuntu Studio 14.04, GIT commit: 2670860

1) load attached score
2) generate parts
3) view parts

Result: for most of the parts, the first notes on the second system are too close to the initial clef. Debugger shows an empty key signature segment between clef and notes, I guess that's throwing off the layout. Nor sure how it got there or what other problems might result.


Comments

I can reproduce this in a score created from scratch.

1) load attached score
2) generate parts
3) view flute part
4) add line break after first measure

Result: note overlaps clef

The same thing is happening here: there is an empty key signature segment at the beginning of the measure. As far as I can tell, that happens any time there is an explicit line break in the score and one of the other parts has a key signature but this one doesn't (eg, it's a score involving transposing instruments, and at least one of the intruments ends up in the key of C).

It sort of feels like maybe we shouldn't generate the empty key signature segment at all, but maybe that's necessary for the linking to work, so I won't mess with that. If someone else (eg, Werner) wants to, have a ball. But I will fix the layout.

Attachment Size
empty-key-sig-segment-20.mscx 7.96 KB
Status (old) active patch (code needs review)

https://github.com/musescore/MuseScore/pull/1215

I am reasonably confident of this fix, but so close to beta, I'd love it to get a little extra review. i do think this is important to include in the beta if at all possible, since the results can be pretty bad otherwise = lots of systems potentially starting out like this:

empty-key-sig.png

Of course, it's still the case that if it makes to not generate the empty key signature segments in the first place, that is fine by me. I still think it seems best to include my code (or the equivalent) anyhow just to be safe - if empty segments occur after the clef for any other reason.

Attachment Size
empty-key-sig.png 2.45 KB
Status (old) fixed active

Found another case where this can happen:

1) new score for flute & drumset
2) add line break after ms 4
3) add key sig change before ms 5
4) remove flute staff

Result: same as before. Removing the flute staff gets rid of the only key signature in the segment but leaves the empty segment behind. I see the code in segment.cpp that *appears* to be responsible:

https://github.com/musescore/MuseScore/blob/master/libmscore/segment.cp…

Setting "empty" to false here appears to be a holdover from a copy & paste or something, since this is done explicitly everywhere in the add() method but doesn't seem to make sense here. Unfortunately, removing this line doesn't seem to fix the problem; not sure why.

Even assuming we find and fix the problem leading to the empty keysig segment, it still seems it would be a good idea to fix the layout routines as I originally proposed - to ignore irrelevant segments before the first note - so we aren't bit by other empty segment issues in the future.