Skip to content

Commit

Permalink
fix musescore#25497: unison head size comparison fails sometimes
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Apr 28, 2014
1 parent 6d15b97 commit 0d8614d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ void Score::layoutChords1(Segment* segment, int staffIdx)
Note* n = overlapNotes[i];
NoteHeadType nHeadType;
NoteHeadType pHeadType;
Chord* nchord = n->chord();
Chord* pchord = p->chord();
if (n->mirror()) {
if (separation < 0) {
// don't try to share heads if there is any mirroring
Expand All @@ -269,20 +271,21 @@ void Score::layoutChords1(Segment* segment, int staffIdx)
pHeadType = (p->headType() == NoteHeadType::HEAD_AUTO) ? p->chord()->durationType().headType() : p->headType();
// the most important rules for sharing noteheads on unisons between voices are
// that notes must be one same line with same tpc
// and noteheads must be unmirrored and of same group and type
if (n->headGroup() != p->headGroup() || nHeadType != pHeadType || n->tpc() != p->tpc() || n->mirror() || p->mirror()) {
// noteheads must be unmirrored and of same group and type
// and chords must be same size (or sharing code won't work)
if (n->headGroup() != p->headGroup() || nHeadType != pHeadType || n->tpc() != p->tpc() || n->mirror() || p->mirror() || nchord->small() != pchord->small()) {
shareHeads = false;
}
else {
// noteheads are potentially shareable
// it is more subjective at this point
// current default is to require *either* of the following:
// 1) both have same number of dots, both have stems, and both are the same size
// 1) both chords have same number of dots, both have stems, and both noteheads are full size
// or 2) one or more of the noteheads is not of type AUTO, but is explicitly set to match the other
// thus user can force notes to be shared despite differing number of dots or either being stemless
// by setting one of the notehead types to match the other
// TODO: consider adding a style option, staff properties, or note property to control sharing
if ((n->chord()->dots() != p->chord()->dots() || !n->chord()->stem() || !p->chord()->stem() || n->headWidth() != p->headWidth()) &&
if ((nchord->dots() != pchord->dots() || !nchord->stem() || !pchord->stem() || n->small() || p->small()) &&
(n->headType() == NoteHeadType::HEAD_AUTO && p->headType() == NoteHeadType::HEAD_AUTO)) {
shareHeads = false;
}
Expand Down
Binary file added vtest/chord-layout-11-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vtest/chord-layout-11.mscz
Binary file not shown.
2 changes: 1 addition & 1 deletion vtest/gen
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else
emmentaler-8 bravura-8 emmentaler-9 bravura-9 emmentaler-10 bravura-10\
emmentaler-11 bravura-11 frametext ottava slurs-1\
chord-layout-1 chord-layout-2 chord-layout-3 chord-layout-4 chord-layout-5\
chord-layout-6 chord-layout-7 chord-layout-8 chord-layout-9 chord-layout-10\
chord-layout-6 chord-layout-7 chord-layout-8 chord-layout-9 chord-layout-10 chord-layout-11\
accidental-1 accidental-2 accidental-3 accidental-4 accidental-5 accidental-6\
tie-1 grace-1"
fi
Expand Down
2 changes: 1 addition & 1 deletion vtest/gen.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set SRC=mmrest-1,bravura-mmrest,mmrest-2,mmrest-4,mmrest-5,mmrest-6,mmrest-7,mmr
emmentaler-6,bravura-6,emmentaler-7,bravura-7, ^
emmentaler-8,bravura-8,emmentaler-9,bravura-9,emmentaler-10,bravura-10, ^
chord-layout-1,chord-layout-2,chord-layout-3,chord-layout-4,chord-layout-5, ^
chord-layout-6,chord-layout-7,chord-layout-8,chord-layout-9,chord-layout-10, ^
chord-layout-6,chord-layout-7,chord-layout-8,chord-layout-9,chord-layout-10, chord-layout-11, ^
accidental-1,accidental-2,accidental-3,accidental-4,accidental-5,accidental-6, ^
tie-1,grace-1

Expand Down

0 comments on commit 0d8614d

Please sign in to comment.