Skip to content

Commit

Permalink
Support more symbol fonts used in xml files
Browse files Browse the repository at this point in the history
Backport of musescore#24041
  • Loading branch information
miiizen authored and Jojo-Schmitz committed Dec 29, 2024
1 parent 6d178d9 commit ebaa773
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
10 changes: 6 additions & 4 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3307,7 +3307,6 @@ void MusicXMLParserDirection::direction(const QString& partId,
else
skipLogCurrElem();
}
handleTempo();
handleRepeats(measure, track, tick + _offset);
handleNmiCmi(measure, track, tick + _offset, delayedDirections);
handleChordSym(track, tick + _offset, harmonyMap);
Expand Down Expand Up @@ -3648,14 +3647,17 @@ void MusicXMLParserDirection::directionType(QList<MusicXmlSpannerDesc>& starts,
if (_e.name() == "metronome")
_metroText = metronome(_tpoMetro);
else if (_e.name() == "words") {
_enclosure = _e.attributes().value("enclosure").toString();
_enclosure = _e.attributes().value("enclosure").toString();
_fontFamily = _e.attributes().value("font-family").toString();
QString nextPart = nextPartOfFormattedString(_e);

textToDynamic(nextPart);
textToCrescLine(nextPart);
handleTempo(nextPart);
_wordsText += nextPart;
}
else if (_e.name() == "rehearsal") {
_enclosure = _e.attributes().value("enclosure").toString();
_enclosure = _e.attributes().value("enclosure").toString();
if (_enclosure.isEmpty())
_enclosure = "square"; // note different default
_rehearsalText += nextPartOfFormattedString(_e);
Expand Down Expand Up @@ -4429,7 +4431,7 @@ void MusicXMLParserDirection::handleChordSym(const int track, const Fraction tic
_wordsText.clear();
}

void MusicXMLParserDirection::handleTempo()
void MusicXMLParserDirection::handleTempo(QString& wordsString)
{
// Pick up any tempo markings which may have been exported from Sibelius as <words>
// eg. andante (q = c. 90)
Expand Down
3 changes: 2 additions & 1 deletion importexport/musicxml/importmxmlpass2.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ class MusicXMLParserDirection {
Hairpin* _inferredHairpinStart = nullptr;
QStringList _dynamicsList;
QString _enclosure;
QString _fontFamily;
QString _wordsText;
QString _metroText;
QString _rehearsalText;
Expand Down Expand Up @@ -453,7 +454,7 @@ class MusicXMLParserDirection {
void handleRepeats(Measure* measure, const int track, const Fraction tick);
QString matchRepeat() const;
void handleNmiCmi(Measure* measure, const int track, const Fraction tick, DelayedDirectionsList& delayedDirections);
void handleTempo();
void handleTempo(QString& wordsString);
void handleChordSym(const int track, const Fraction tick, HarmonyMap& harmonyMap);
bool isLikelyFingering(const QString& fingeringStr) const;
bool isLikelyCredit(const Fraction& tick) const;
Expand Down
2 changes: 2 additions & 0 deletions importexport/musicxml/musicxmlsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef __MUSICXMLSUPPORT_H__
#define __MUSICXMLSUPPORT_H__

#include "libmscore/durationtype.h"
#include "libmscore/fraction.h"
#include "libmscore/fret.h"
#include "libmscore/note.h"
Expand Down Expand Up @@ -184,6 +185,7 @@ struct MusicXMLInstrument {

typedef QMap<QString, MusicXMLInstrument> MusicXMLInstruments;
typedef QMapIterator<QString, MusicXMLInstrument> MusicXMLInstrumentsIterator;
typedef QMap<QString, QPair<QString, TDuration::DurationType> > MetronomeTextMap;


//---------------------------------------------------------
Expand Down

0 comments on commit ebaa773

Please sign in to comment.