Skip to content

Commit

Permalink
Fix computation of smallness for tuplets
Browse files Browse the repository at this point in the history
Tuplets will now be small if all containing elements are either 1) small chordrests or 2) tuplets with all small chordrests or tuplets

Backport of musescore#9850
  • Loading branch information
asattely authored and Jojo-Schmitz committed Nov 28, 2021
1 parent 95133d9 commit 0da479c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libmscore/tuplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ void Tuplet::layout()
else
_number->setXmlText(QString("%1:%2").arg(_ratio.numerator()).arg(_ratio.denominator()));

bool isSmall = true;
_isSmall = true;
for (const DurationElement* e : _elements) {
if (e->isChordRest() && !toChordRest(e)->isSmall()) {
isSmall = false;
if ((e->isChordRest() && !toChordRest(e)->isSmall()) || (e->isTuplet() && !toTuplet(e)->isSmall())) {
_isSmall = false;
break;
}
}
_number->setMag(isSmall ? score()->styleD(Sid::smallNoteMag) : 1.0);
_number->setMag(_isSmall ? score()->styleD(Sid::smallNoteMag) : 1.0);

}
else {
Expand Down
2 changes: 2 additions & 0 deletions libmscore/tuplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Tuplet final : public DurationElement {
TDuration _baseLen; // 1/8 for a triplet of 1/8

bool _isUp;
bool _isSmall;

Fraction _tick;

Expand Down Expand Up @@ -119,6 +120,7 @@ class Tuplet final : public DurationElement {
void setDirection(Direction d) { _direction = d; }
Direction direction() const { return _direction; }
bool isUp() const { return _isUp; }
bool isSmall() const { return _isSmall; }
Fraction tick() const override { return _tick; }
Fraction rtick() const override;
void setTick(const Fraction& v) { _tick = v; }
Expand Down

0 comments on commit 0da479c

Please sign in to comment.