Skip to content

Commit

Permalink
improve default key signature accidental gaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Mazuk committed Nov 30, 2021
1 parent 8bae5cd commit 5a4aa50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/engraving/libmscore/keysig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,18 @@ void KeySig::addLayout(SymId sym, int line)
if (_sig.keySymbols().size() > 0) {
KeySym& previous = _sig.keySymbols().back();
qreal accidentalGap = score()->styleS(Sid::keysigAccidentalDistance).val();
if (previous.sym != sym) {
accidentalGap *= 2;
} else if (previous.sym == SymId::accidentalNatural && sym == SymId::accidentalNatural) {
accidentalGap = score()->styleS(Sid::keysigNaturalDistance).val();
}
// width is divided by mag() to get the staff-scaling-independent width of the symbols
qreal previousWidth = symWidth(previous.sym) / score()->spatium() / mag();
x = previous.spos.x() + previousWidth + accidentalGap;
bool isAscending = y < previous.spos.y();
SmuflAnchorId currentCutout = isAscending ? SmuflAnchorId::cutOutSW : SmuflAnchorId::cutOutNW;
SmuflAnchorId previousCutout = isAscending ? SmuflAnchorId::cutOutNE : SmuflAnchorId::cutOutSE;
PointF cutout = symSmuflAnchor(sym, isAscending ? SmuflAnchorId::cutOutSW : SmuflAnchorId::cutOutNW);
PointF cutout = symSmuflAnchor(sym, currentCutout);
qreal currentCutoutY = y * spatium() + cutout.y();
qreal previousCoutoutY = previous.spos.y() * spatium() + symSmuflAnchor(previous.sym, previousCutout).y();
if ((isAscending && currentCutoutY < previousCoutoutY) || (!isAscending && currentCutoutY > previousCoutoutY)) {
Expand Down
3 changes: 2 additions & 1 deletion src/engraving/style/styledef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::accidentalNoteDistance, "accidentalNoteDistance", Spatium(0.25) },
{ Sid::bracketedAccidentalPadding, "bracketedAccidentalPadding", Spatium(0.175) }, // Padding inside parentheses for bracketed accidentals
{ Sid::alignAccidentalsLeft, "alignAccidentalsLeft", false }, // When laid out in columns, whether accidentals align left or right. Musescore <= 3.5 uses left alignment.
{ Sid::keysigAccidentalDistance, "keysigAccidentalDistance", Spatium(0.22) },
{ Sid::keysigAccidentalDistance, "keysigAccidentalDistance", Spatium(0.3) },
{ Sid::keysigNaturalDistance, "keysigNaturalDistance", Spatium(0.4) },

{ Sid::beamWidth, "beamWidth", Spatium(0.5) }, // was 0.48
{ Sid::beamDistance, "beamDistance", PropertyValue(0.5) },
Expand Down

0 comments on commit 5a4aa50

Please sign in to comment.