Skip to content

Commit

Permalink
Tweak MusicXML tempo inference logic
Browse files Browse the repository at this point in the history
This commit changes the method by which Staff Text is checked for
boldness, using a slightly more robust regex.

Duplicate of musescore#8412, part 5
  • Loading branch information
iveshenry18 authored and Jojo-Schmitz committed May 12, 2022
1 parent 27cd823 commit 12aea7d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2610,7 +2610,7 @@ bool MusicXMLDelayedDirectionElement::isTempoOrphanCandidate() const
{
return _element->isStaffText()
&& _placement == "above"
&& toStaffText(_element)->xmlText().contains("<b>");
&& toStaffText(_element)->xmlText().contains(QRegularExpression("^(<.*/>)*<b>.*</b>$"));
}

//---------------------------------------------------------
Expand Down Expand Up @@ -3379,11 +3379,12 @@ bool MusicXMLParserDirection::attemptTempoTextCoercion(const Fraction& tick)
_tpoSound = tempoVal / noteVal;
return true;
}
else if (placement() == "above" && _wordsText.contains("<b>"))
else if (placement() == "above" && _wordsText.contains(QRegularExpression("^(<.*/>)*<b>.*</b>$"))) {
if (tick == Fraction(0, 1)) return true;
for (auto tempoWord : tempoWords)
if (_wordsText.contains(tempoWord, Qt::CaseInsensitive))
return true;
}
return false;
}

Expand Down

0 comments on commit 12aea7d

Please sign in to comment.