Skip to content

Commit

Permalink
Fix GH#19489: Center fermatas over rests on resized staves
Browse files Browse the repository at this point in the history
Backport of musescore#19552

Plus another apparently forgotten change
  • Loading branch information
miiizen authored and Jojo-Schmitz committed Sep 29, 2023
1 parent 3f14257 commit fef847e
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 3 deletions.
6 changes: 5 additions & 1 deletion libmscore/fermata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,12 @@ void Fermata::layout()
if (e) {
if (e->isChord())
rxpos() += score()->noteHeadWidth() * staff()->mag(Fraction(0, 1)) * .5;
else if (e->isRest()) {
const Rest* rest = toRest(e);
rxpos() += e->x() + rest->centerX();
}
else
rxpos() += e->x() + e->width() * staff()->mag(Fraction(0, 1)) * .5;
rxpos() += e->x() - e->shape().left() + e->width() * staff()->mag(Fraction(0, 1)) * .5;
}

QString name = Sym::id2name(_symId);
Expand Down
7 changes: 7 additions & 0 deletions libmscore/rest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,13 @@ qreal Rest::rightEdge() const
return x() + width();
}

qreal Rest::centerX() const
{
SymId sym = this->sym();
const auto& bbox = symBbox(sym);
return symWidth(sym) / 2 + bbox.bottomLeft().x();
}

//---------------------------------------------------------
// accent
//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libmscore/rest.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Rest : public ChordRest {
virtual qreal stemPosX() const;
virtual QPointF stemPosBeam() const;
virtual qreal rightEdge() const override;
qreal centerX() const;

void localSpatiumChanged(qreal oldValue, qreal newValue) override;
QVariant propertyDefault(Pid) const override;
Expand Down
306 changes: 306 additions & 0 deletions vtest/fermata-1.mscx
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="3.02">
<programVersion>3.6.3</programVersion>
<programRevision></programRevision>
<Score>
<LayerTag id="0" tag="default"></LayerTag>
<currentLayer>0</currentLayer>
<Division>480</Division>
<Style>
<pageWidth>5.12047</pageWidth>
<pageHeight>3.06811</pageHeight>
<pagePrintableWidth>5.12047</pagePrintableWidth>
<pageEvenLeftMargin>0</pageEvenLeftMargin>
<pageOddLeftMargin>0</pageOddLeftMargin>
<pageEvenTopMargin>0.590551</pageEvenTopMargin>
<pageEvenBottomMargin>0.590551</pageEvenBottomMargin>
<pageOddTopMargin>0</pageOddTopMargin>
<pageOddBottomMargin>0</pageOddBottomMargin>
<enableVerticalSpread>1</enableVerticalSpread>
<lyricsMinBottomDistance>1.5</lyricsMinBottomDistance>
<lyricsDashLineThickness>0.1</lyricsDashLineThickness>
<minMeasureWidth>8</minMeasureWidth>
<doubleBarDistance>0.37</doubleBarDistance>
<endBarDistance>0.37</endBarDistance>
<repeatBarlineDotSeparation>0.37</repeatBarlineDotSeparation>
<bracketWidth>0.45</bracketWidth>
<bracketDistance>0.45</bracketDistance>
<akkoladeWidth>1.5</akkoladeWidth>
<akkoladeBarDistance>0.35</akkoladeBarDistance>
<clefLeftMargin>0.75</clefLeftMargin>
<stemWidth>0.1</stemWidth>
<shortestStem>2.5</shortestStem>
<minNoteDistance>0.5</minNoteDistance>
<measureSpacing>1.5</measureSpacing>
<ledgerLineLength>0.33</ledgerLineLength>
<beamDistance>0</beamDistance>
<beamMinLen>1.1</beamMinLen>
<propertyDistanceHead>0.4</propertyDistanceHead>
<propertyDistanceStem>0.4</propertyDistanceStem>
<propertyDistance>0.4</propertyDistance>
<articulationAnchorLuteFingering>1</articulationAnchorLuteFingering>
<hairpinLinePosAbove x="0" y="-1.5"/>
<hairpinLinePosBelow x="0" y="2.5"/>
<chordSymbolAFontSize>10</chordSymbolAFontSize>
<chordSymbolBFontSize>10</chordSymbolBFontSize>
<minMMRestWidth>6</minMMRestWidth>
<mmRestNumberPos>-0.5</mmRestNumberPos>
<slurEndWidth>0.05</slurEndWidth>
<evenFooterC>$C</evenFooterC>
<oddFooterC>$C</oddFooterC>
<ottavaLineStyle>0</ottavaLineStyle>
<tupletStemLeftDistance>0.5</tupletStemLeftDistance>
<tupletNoteLeftDistance>0</tupletNoteLeftDistance>
<scaleBarlines>0</scaleBarlines>
<subTitleFontSize>14</subTitleFontSize>
<dynamicsFontSize>10</dynamicsFontSize>
<measureNumberPosBelow x="0" y="1"/>
<headerAlign>center,top</headerAlign>
<footerAlign>center,bottom</footerAlign>
<letRingLineWidth>0.11</letRingLineWidth>
<palmMutePosAbove x="0" y="0"/>
<palmMutePosBelow x="0" y="0"/>
<palmMuteLineWidth>0.11</palmMuteLineWidth>
<articulationMinDistance>0.4</articulationMinDistance>
<defaultsVersion>420</defaultsVersion>
<Spatium>1.74978</Spatium>
</Style>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<metaTag name="arranger"></metaTag>
<metaTag name="composer">Composer / arranger</metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="creationDate">2023-09-28</metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="movementNumber"></metaTag>
<metaTag name="movementTitle"></metaTag>
<metaTag name="platform">Apple Macintosh</metaTag>
<metaTag name="poet"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="sourceRevisionId"></metaTag>
<metaTag name="subtitle">Subtitle</metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workNumber"></metaTag>
<metaTag name="workTitle">Untitled score</metaTag>
<Order id="orchestral" customized="1">
<name>Orchestral</name>
<instrument id="piano">
<family id="keyboards">Tasteninstrumente</family>
</instrument>
<section id="woodwind" brackets="true" showSystemMarkings="true" barLineSpan="true" thinBrackets="true">
<family>flutes</family>
<family>oboes</family>
<family>clarinets</family>
<family>saxophones</family>
<family>bassoons</family>
<unsorted group="woodwinds"/>
</section>
<section id="brass" brackets="true" showSystemMarkings="false" barLineSpan="true" thinBrackets="true">
<family>horns</family>
<family>trumpets</family>
<family>cornets</family>
<family>flugelhorns</family>
<family>trombones</family>
<family>baritone-horns</family>
<family>euphoniums</family>
<family>tubas</family>
</section>
<section id="timpani" brackets="true" showSystemMarkings="false" barLineSpan="true" thinBrackets="true">
<family>timpani</family>
</section>
<section id="percussion" brackets="true" showSystemMarkings="false" barLineSpan="true" thinBrackets="true">
<family>keyboard-percussion</family>
<family>drums</family>
<family>unpitched-metal-percussion</family>
<family>unpitched-wooden-percussion</family>
<family>other-percussion</family>
</section>
<family>keyboards</family>
<family>harps</family>
<family>organs</family>
<family>synths</family>
<section id="plucked-strings" brackets="true" showSystemMarkings="false" barLineSpan="true" thinBrackets="true">
<family>plucked-strings</family>
</section>
<soloists/>
<section id="voices" brackets="true" showSystemMarkings="false" barLineSpan="false" thinBrackets="true">
<family>voices</family>
</section>
<section id="strings" brackets="true" showSystemMarkings="true" barLineSpan="true" thinBrackets="true">
<family>orchestral-strings</family>
</section>
<unsorted/>
</Order>
<Part>
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
<small>1</small>
</StaffType>
</Staff>
<Staff id="2">
<StaffType group="pitched">
<name>stdNormal</name>
<mag>1.5</mag>
</StaffType>
<defaultClef>F</defaultClef>
<bracket type="1" span="3" col="0"/>
<barLineSpan>1</barLineSpan>
</Staff>
<Staff id="3">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
</Staff>
<trackName>Piano</trackName>
<preferSharpFlat>flats</preferSharpFlat>
<Instrument id="piano">
<longName>Piano</longName>
<shortName>Pno.</shortName>
<trackName>Piano</trackName>
<minPitchP>21</minPitchP>
<maxPitchP>108</maxPitchP>
<minPitchA>21</minPitchA>
<maxPitchA>108</maxPitchA>
<instrumentId>keyboard.piano</instrumentId>
<clef staff="2">F</clef>
<Channel>
<program value="0"/>
<synti>Fluid</synti>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<Measure>
<voice>
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<voice>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>half</durationType>
</Rest>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>quarter</durationType>
</Rest>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>eighth</durationType>
</Rest>
<Rest>
<durationType>eighth</durationType>
</Rest>
</voice>
</Measure>
</Staff>
<Staff id="2">
<Measure>
<voice>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
</Clef>
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<voice>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>half</durationType>
</Rest>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>quarter</durationType>
</Rest>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>eighth</durationType>
</Rest>
<Rest>
<durationType>eighth</durationType>
</Rest>
</voice>
</Measure>
</Staff>
<Staff id="3">
<Measure>
<voice>
<TimeSig>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>measure</durationType>
<duration>4/4</duration>
</Rest>
</voice>
</Measure>
<Measure>
<voice>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>half</durationType>
</Rest>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>quarter</durationType>
</Rest>
<Fermata>
<subtype>fermataAbove</subtype>
</Fermata>
<Rest>
<durationType>eighth</durationType>
</Rest>
<Rest>
<durationType>eighth</durationType>
</Rest>
</voice>
</Measure>
</Staff>
</Score>
</museScore>
2 changes: 1 addition & 1 deletion vtest/gen
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else
SRC="mmrest-1 bravura-mmrest gonville-mmrest mmrest-2 mmrest-4 mmrest-5 mmrest-6 mmrest-7 mmrest-8 mmrest-9\
mmrest-10 mmrest-11 mmrest-12 mmrest-13 mmrest-14 mmrest-15 mmrest-16 mmrest-17 mmrest-18\
mmrest-19 mmrest-20 mmrest-21 mmrest-22 mmrest-23\
fmrest-1 fmrest-2 fmrest-3 fmrest-4 fmrest-5 fmrest-6 measure-repeat-1\
fermata-1 fmrest-1 fmrest-2 fmrest-3 fmrest-4 fmrest-5 fmrest-6 measure-repeat-1\
noteheadposition-1 valign-1 valign-2 valign-3\
emmentaler-1 bravura-1 gonville-1 musejazz-1\
emmentaler-2 bravura-2 gonville-2 musejazz-2\
Expand Down
2 changes: 1 addition & 1 deletion vtest/gen.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set SRC=bravura-mmrest,gonville-mmrest, ^
mmrest-1,mmrest-2,mmrest-4,mmrest-5,mmrest-6,mmrest-7,mmrest-8,mmrest-9, ^
mmrest-10,mmrest-11,mmrest-12,, mmrest-13, mmrest-14, mmrest-15, mmrest-16, mmrest-17, mmrest-18, ^
mmrest-19, mmrest-20, mmrest-21, mmrest-22, mmrest-23, ^
fmrest-1,fmrest-2,fmrest-3,fmrest-4,fmrest-5,fmrest-6,measure-repeat-1, ^
fermata-1 fmrest-1,fmrest-2,fmrest-3,fmrest-4,fmrest-5,fmrest-6,measure-repeat-1, ^
noteheadposition-1,valign-1,valign-2,valign-3, ^
emmentaler-1,bravura-1,gonville-1, musejazz-1, ^
emmentaler-2,bravura-2,gonville-2, musejazz-2, ^
Expand Down

0 comments on commit fef847e

Please sign in to comment.